-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from RADAR-base/release-0.5.2
Release 0.5.2
- Loading branch information
Showing
21 changed files
with
325 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
# | ||
# ******** NOTE ******** | ||
# We have attempted to detect the languages in your repository. Please check | ||
# the `language` matrix defined below to confirm you have the correct set of | ||
# supported CodeQL languages. | ||
# | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ "master", "dev" ] | ||
pull_request: | ||
branches: [ "master", "dev" ] | ||
schedule: | ||
- cron: '24 21 * * 0' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
# Runner size impacts CodeQL analysis time. To learn more, please see: | ||
# - https://gh.io/recommended-hardware-resources-for-running-codeql | ||
# - https://gh.io/supported-runners-and-hardware-resources | ||
# - https://gh.io/using-larger-runners | ||
# Consider using larger runners for possible analysis time improvements. | ||
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} | ||
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} | ||
permissions: | ||
# required for all workflows | ||
security-events: write | ||
|
||
# only required for workflows in private repositories | ||
actions: read | ||
contents: read | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'java-kotlin' ] | ||
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ] | ||
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both | ||
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both | ||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' # See 'Supported distributions' for available options | ||
java-version: '17' | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v3 | ||
with: | ||
languages: ${{ matrix.language }} | ||
# If you wish to specify custom queries, you can do so here or in a config file. | ||
# By default, queries listed here will override any specified in a config file. | ||
# Prefix the list here with "+" to use these queries and those in the config file. | ||
|
||
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs | ||
# queries: security-extended,security-and-quality | ||
|
||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). | ||
# If this step fails, then you should remove it and run the build manually (see below) | ||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v3 | ||
|
||
# ℹ️ Command-line programs to run using the OS shell. | ||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun | ||
|
||
# If the Autobuild fails above, remove it and uncomment the following three lines. | ||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. | ||
|
||
# - run: | | ||
# echo "Run, Build Application using script" | ||
# ./location_of_script_within_repo/buildscript.sh | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v3 | ||
with: | ||
category: "/language:${{matrix.language}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
plugins { | ||
kotlin("jvm") version "1.9.10" | ||
kotlin("jvm") version "1.9.22" | ||
} | ||
|
||
repositories { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
@Suppress("ConstPropertyName", "MemberVisibilityCanBePrivate") | ||
object Versions { | ||
const val project = "0.5.1" | ||
const val project = "0.5.2" | ||
|
||
const val java = 11 | ||
const val java = 17 | ||
const val kotlin = "1.9.10" | ||
const val wrapper = "8.4" | ||
|
||
const val radarCommons = "1.1.1" | ||
const val confluent = "7.5.0" | ||
const val radarCommons = "1.1.2" | ||
const val confluent = "7.6.0" | ||
const val kafka = "$confluent-ce" | ||
const val avro = "1.11.0" | ||
const val avro = "1.11.3" | ||
|
||
const val managementPortal = "2.0.0" | ||
|
||
// From image | ||
const val jackson = "2.14.2" | ||
const val jackson = "2.16.1" | ||
|
||
const val log4j2 = "2.20.0" | ||
const val slf4j = "2.0.9" | ||
|
||
const val okhttp = "4.11.0" | ||
const val okhttp = "4.12.0" | ||
|
||
const val firebaseAdmin = "9.1.0" | ||
const val radarSchemas = "0.8.6" | ||
const val radarSchemas = "0.8.7-hotfix" | ||
const val ktor = "2.3.5" | ||
|
||
const val junit = "5.9.3" | ||
const val wiremock = "2.27.2" | ||
const val mockito = "5.3.1" | ||
|
||
const val kotlinVersion = "1.8.21" | ||
const val kotlinVersion = "1.9.10" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
...ain/java/org/radarbase/connect/rest/fitbit/converter/FitbitIntradaySpo2AvroConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Copyright 2018 The Hyve | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package org.radarbase.connect.rest.fitbit.converter; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import io.confluent.connect.avro.AvroData; | ||
import org.radarbase.connect.rest.RestSourceConnectorConfig; | ||
import org.radarbase.connect.rest.fitbit.FitbitRestSourceConnectorConfig; | ||
import org.radarbase.connect.rest.fitbit.request.FitbitRestRequest; | ||
import org.radarcns.connector.fitbit.FitbitIntradaySpo2; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.time.Instant; | ||
import java.time.LocalDateTime; | ||
import java.time.ZonedDateTime; | ||
import java.util.stream.Stream; | ||
|
||
import static org.radarbase.connect.rest.util.ThrowingFunction.tryOrNull; | ||
|
||
public class FitbitIntradaySpo2AvroConverter extends FitbitAvroConverter { | ||
private static final Logger logger = LoggerFactory.getLogger(FitbitIntradaySpo2AvroConverter.class); | ||
private String spo2Topic; | ||
|
||
public FitbitIntradaySpo2AvroConverter(AvroData avroData) { | ||
super(avroData); | ||
} | ||
|
||
@Override | ||
public void initialize(RestSourceConnectorConfig config) { | ||
spo2Topic = ((FitbitRestSourceConnectorConfig) config).getFitbitIntradaySpo2Topic(); | ||
logger.info("Using intraday spo2 topic {}", spo2Topic); | ||
} | ||
|
||
@Override | ||
protected Stream<TopicData> processRecords(FitbitRestRequest request, JsonNode root, double timeReceived) { | ||
JsonNode spo2 = root; | ||
if (spo2 == null || !spo2.isArray()) { | ||
logger.warn("No Spo2 is provided for {}: {}", request, root); | ||
return Stream.empty(); | ||
} | ||
ZonedDateTime startDate = request.getDateRange().end(); | ||
|
||
return iterableToStream(spo2) | ||
.filter(m -> m != null && m.isObject()) | ||
.map(m -> m.get("minutes")) | ||
.filter(minutes -> minutes != null && minutes.isArray()) | ||
.flatMap(FitbitAvroConverter::iterableToStream) | ||
.map(tryOrNull(minuteData -> parseSpo2(minuteData, startDate, timeReceived), | ||
(a, ex) -> logger.warn("Failed to convert spo2 from request {}, {}", request, a, ex))); | ||
} | ||
|
||
private TopicData parseSpo2(JsonNode minuteData, ZonedDateTime startDate, double timeReceived) { | ||
Instant time = startDate.with(LocalDateTime.parse(minuteData.get("minute").asText())).toInstant(); | ||
Float value = (float) minuteData.get("value").asDouble(); | ||
if (value == null) { | ||
return null; | ||
} | ||
FitbitIntradaySpo2 fitbitSpo2 = new FitbitIntradaySpo2(time.toEpochMilli() / 1000d, | ||
timeReceived, | ||
(float) value); | ||
return new TopicData(time, spo2Topic, fitbitSpo2); | ||
} | ||
} |
Oops, something went wrong.