diff --git a/.travis.yml b/.travis.yml index 4c12c17e..242767ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ deploy: provider: releases api_key: ${GH_TOKEN} file_glob: true - file: "${TRAVIS_BUILD_DIR}/java-sdk/build/libs/*.jar" + file: "*/build/libs/*.jar" skip_cleanup: true on: tags: true @@ -16,5 +16,8 @@ deploy: before_install: - cd java-sdk +before_deploy: + - pwd + after_deploy: - ./gradlew bintrayUpload diff --git a/commons/biovotion/biovotion_vsm_battery_state.avsc b/commons/biovotion/biovotion_vsm_battery_state.avsc index ea3bcbc4..85cbdab9 100644 --- a/commons/biovotion/biovotion_vsm_battery_state.avsc +++ b/commons/biovotion/biovotion_vsm_battery_state.avsc @@ -7,8 +7,8 @@ {"name": "time", "type": "double", "doc": "device timestamp in UTC (s)"}, {"name": "timeReceived", "type": "double", "doc": "device receiver timestamp in UTC (s)"}, {"name": "batteryLevel", "type": "float", "doc": "battery level (0-1)"}, - {"name": "batteryChargeRate", "type": "float", "doc": "battery charge rate (0-1)"}, + {"name": "batteryChargeRate", "type": "float", "doc": "battery charge rate, level change per hour (0-1)"}, {"name": "batteryVoltage", "type": "float", "doc": "battery voltage (V)"}, - {"name": "batteryStatus", "type": "float", "doc": "battery status"} + {"name": "batteryStatus", "type": "float", "doc": "battery status; 0:not charging, not on charger; 2:not charging, on charger; 3:charging, on charger"} ] } diff --git a/commons/biovotion/biovotion_vsm_led_current.avsc b/commons/biovotion/biovotion_vsm_led_current.avsc new file mode 100644 index 00000000..77bdc169 --- /dev/null +++ b/commons/biovotion/biovotion_vsm_led_current.avsc @@ -0,0 +1,14 @@ +{ + "namespace": "org.radarcns.biovotion", + "type": "record", + "name": "BiovotionVSMLedCurrent", + "doc": "Applied current for red, green and ir leds.", + "fields": [ + {"name": "time", "type": "double", "doc": "device timestamp in UTC (s)"}, + {"name": "timeReceived", "type": "double", "doc": "device receiver timestamp in UTC (s)"}, + {"name": "red", "type": "float", "doc": "current for red LED (mA)"}, + {"name": "green", "type": "float", "doc": "current for green LED (mA)"}, + {"name": "ir", "type": "float", "doc": "current for IR LED (mA)"}, + {"name": "offset", "type": "float", "doc": "current offset (mA)"} + ] +} diff --git a/commons/biovotion/biovotion_vsm_ppg_raw.avsc b/commons/biovotion/biovotion_vsm_ppg_raw.avsc new file mode 100644 index 00000000..e34f9dd6 --- /dev/null +++ b/commons/biovotion/biovotion_vsm_ppg_raw.avsc @@ -0,0 +1,14 @@ +{ + "namespace": "org.radarcns.biovotion", + "type": "record", + "name": "BiovotionVSMPhotoRaw", + "doc": "Raw 14bit Photodiode ADC data for red, green, IR and dark portions (PPG raw data).", + "fields": [ + {"name": "time", "type": "double", "doc": "device timestamp in UTC (s)"}, + {"name": "timeReceived", "type": "double", "doc": "device receiver timestamp in UTC (s)"}, + {"name": "red", "type": "float", "doc": "raw red light ADC response (normalized)"}, + {"name": "green", "type": "float", "doc": "raw green light ADC response (normalized)"}, + {"name": "ir", "type": "float", "doc": "raw IR light ADC response (normalized)"}, + {"name": "dark", "type": "float", "doc": "raw dark light ADC response (normalized)"} + ] +} diff --git a/commons/biovotion/biovotion_vsm_temperature.avsc b/commons/biovotion/biovotion_vsm_temperature.avsc index b6bdf5b8..f794f78d 100644 --- a/commons/biovotion/biovotion_vsm_temperature.avsc +++ b/commons/biovotion/biovotion_vsm_temperature.avsc @@ -2,12 +2,12 @@ "namespace": "org.radarcns.biovotion", "type": "record", "name": "BiovotionVSMTemperature", - "doc": "Data from temperature sensor expressed degrees on the Celsius (°C) scale.", + "doc": "Data from temperature sensor expressed in degrees on the Celsius (°C) scale.", "fields": [ {"name": "time", "type": "double", "doc": "device timestamp in UTC (s)"}, {"name": "timeReceived", "type": "double", "doc": "device receiver timestamp in UTC (s)"}, - {"name": "temperature", "type": "float", "doc": "local temperature (°C)"}, - {"name": "temperatureObject", "type": "float", "doc": "object temperature (°C)"}, + {"name": "temperature", "type": "float", "doc": "skin temperature (°C)"}, + {"name": "temperatureLocal", "type": "float", "doc": "device (board) temperature (°C)"}, {"name": "temperatureBarometer", "type": "float", "doc": "barometer temperature (°C)"} ] } diff --git a/commons/key/windowed_key.avsc b/commons/key/windowed_key.avsc index 315f8a93..a6ccdbc1 100644 --- a/commons/key/windowed_key.avsc +++ b/commons/key/windowed_key.avsc @@ -3,8 +3,8 @@ "name": "WindowedKey", "doc": "Windowed key in the RADAR-CNS project", "fields": [ - {"name": "userID", "type": "string"}, - {"name": "sourceID", "type": "string"}, + {"name": "userId", "type": "string"}, + {"name": "sourceId", "type": "string"}, {"name": "start", "type": "long"}, {"name": "end", "type": "long"} ] diff --git a/commons/phone/phone_call.avsc b/commons/phone/phone_call.avsc index c9e3fc60..4997dddf 100644 --- a/commons/phone/phone_call.avsc +++ b/commons/phone/phone_call.avsc @@ -8,6 +8,9 @@ {"name": "timeReceived", "type": "double", "doc": "device receiver timestamp in UTC (s)"}, {"name": "duration", "type": "float", "doc": "duration of the call (s)", "default": "NaN"}, {"name": "target", "type": ["null", "bytes"], "doc": "HMAC SHA-256 one-way source/target of the call. This hash of a given phone number will be the same unless the app is reinstalled. If the number is unknown or anonymous, this contains null.", "default": null}, - {"name": "type", "type": {"name": "PhoneCallType", "type": "enum", "symbols": ["INCOMING", "OUTGOING", "MISSED", "VOICEMAIL", "UNKNOWN"]}, "doc": "direction of phone call", "default": "UNKNOWN"} + {"name": "type", "type": {"name": "PhoneCallType", "type": "enum", "symbols": ["INCOMING", "OUTGOING", "MISSED", "VOICEMAIL", "UNKNOWN"]}, "doc": "direction of phone call", "default": "UNKNOWN"}, + {"name": "targetIsContact", "type": ["null","boolean"], "doc": "call to/from a known contact, null if unknown", "default": null}, + {"name": "targetIsNonNumeric", "type": "boolean", "doc": "sms sender ID is replaced by text, e.g. a company name", "default": false}, + {"name": "targetLength", "type": "int", "doc": "length of the target phone number, -1 if not collected.", "default": -1} ] -} \ No newline at end of file +} diff --git a/commons/phone/phone_gyroscope.avsc b/commons/phone/phone_gyroscope.avsc new file mode 100644 index 00000000..df5a1c33 --- /dev/null +++ b/commons/phone/phone_gyroscope.avsc @@ -0,0 +1,13 @@ +{ + "namespace": "org.radarcns.phone", + "type": "record", + "name": "PhoneGyroscope", + "doc": "Data from the 3-axis gyroscope.", + "fields": [ + {"name": "time", "type": "double", "doc": "device timestamp in UTC (s)"}, + {"name": "timeReceived", "type": "double", "doc": "device receiver timestamp in UTC (s)"}, + {"name": "x", "type": "float", "doc": "gyration in the x-axis (rad/s)"}, + {"name": "y", "type": "float", "doc": "gyration in the y-axis (rad/s)"}, + {"name": "z", "type": "float", "doc": "gyration in the z-axis (rad/s)"} + ] +} diff --git a/commons/phone/phone_magnetic_field.avsc b/commons/phone/phone_magnetic_field.avsc new file mode 100644 index 00000000..7a562d64 --- /dev/null +++ b/commons/phone/phone_magnetic_field.avsc @@ -0,0 +1,13 @@ +{ + "namespace": "org.radarcns.phone", + "type": "record", + "name": "PhoneMagneticField", + "doc": "Data from the 3-axis magnetometer.", + "fields": [ + {"name": "time", "type": "double", "doc": "device timestamp in UTC (s)"}, + {"name": "timeReceived", "type": "double", "doc": "device receiver timestamp in UTC (s)"}, + {"name": "x", "type": "float", "doc": "magnetic field in the x-axis (μT)"}, + {"name": "y", "type": "float", "doc": "magnetic field in the y-axis (μT)"}, + {"name": "z", "type": "float", "doc": "magnetic field in the z-axis (μT)"} + ] +} diff --git a/commons/phone/phone_sms.avsc b/commons/phone/phone_sms.avsc index ac5b7fb6..46bb17c1 100644 --- a/commons/phone/phone_sms.avsc +++ b/commons/phone/phone_sms.avsc @@ -8,6 +8,9 @@ {"name": "timeReceived", "type": "double", "doc": "device receiver timestamp in UTC (s)"}, {"name": "target", "type": ["null", "bytes"], "doc": "HMAC SHA-256 one-way source/target of the SMS. This hash of a given phone number will be the same unless the app is reinstalled. If the number is unknown or anonymous, this contains null.", "default": null}, {"name": "type", "type": {"name": "PhoneSmsType", "type": "enum", "symbols": ["INCOMING", "OUTGOING", "OTHER", "UNKNOWN"]}, "doc": "direction of the SMS", "default": "UNKNOWN"}, - {"name": "length", "type": "int", "doc": "number of characters in the message (-1 if unknown)", "default": -1} + {"name": "length", "type": ["null","int"], "doc": "number of characters in the message (null if unknown)", "default": null}, + {"name": "targetIsContact", "type": ["null","boolean"], "doc": "sms sender is a known contact, null if unknown", "default": null}, + {"name": "targetIsNonNumeric", "type": "boolean", "doc": "sms sender ID is replaced by text, e.g. a company name", "default": false}, + {"name": "targetLength", "type": "int", "doc": "length of the target phone number, -1 if not collected.", "default": -1} ] -} \ No newline at end of file +} diff --git a/commons/phone/phone_sms_unread.avsc b/commons/phone/phone_sms_unread.avsc new file mode 100644 index 00000000..8927dc5a --- /dev/null +++ b/commons/phone/phone_sms_unread.avsc @@ -0,0 +1,11 @@ +{ + "namespace": "org.radarcns.phone", + "type": "record", + "name": "PhoneSmsUnread", + "doc": "Number of SMS messages in the inbox that have an unread status.", + "fields": [ + {"name": "time", "type": "double", "doc": "device timestamp in UTC (s)"}, + {"name": "timeReceived", "type": "double", "doc": "device receiver timestamp in UTC (s)"}, + {"name": "unreadSMS", "type": "int", "doc": "number of unread SMS messages currently in the inbox"} + ] +} diff --git a/commons/phone/phone_step_count.avsc b/commons/phone/phone_step_count.avsc new file mode 100644 index 00000000..1936582f --- /dev/null +++ b/commons/phone/phone_step_count.avsc @@ -0,0 +1,11 @@ +{ + "namespace": "org.radarcns.phone", + "type": "record", + "name": "PhoneStepCount", + "doc": "Data from the step counter.", + "fields": [ + {"name": "time", "type": "double", "doc": "device timestamp in UTC (s)"}, + {"name": "timeReceived", "type": "double", "doc": "device receiver timestamp in UTC (s)"}, + {"name": "steps", "type": "int", "doc": "number of steps taken between this and the previous record"} + ] +} diff --git a/commons/phone/phone_usage_event.avsc b/commons/phone/phone_usage_event.avsc new file mode 100644 index 00000000..ff9a9f34 --- /dev/null +++ b/commons/phone/phone_usage_event.avsc @@ -0,0 +1,16 @@ +{ + "namespace": "org.radarcns.phone", + "type": "record", + "name": "PhoneUsageEvent", + "doc": "Event for closing or opening an app", + "fields": [ + {"name": "time", "type": "double", "doc": "device timestamp in UTC (s)"}, + {"name": "timeReceived", "type": "double", "doc": "device receiver timestamp in UTC (s)"}, + {"name": "packageName", "type": "string", "doc": "package name of the launched app"}, + {"name": "categoryName", "type": ["null", "string"], "doc": "app category as given by the play store, null if a category is not listed or unable to be fetched", "default": null}, + {"name": "categoryNameFetchTime", "type": ["null", "double"], "doc": "timestamp in UTC when the category was attempted to fetch from the play store (s), null if not fetched", "default": null}, + {"name": "eventType", "type": + {"name": "UsageEventType", "type": "enum", "symbols": ["FOREGROUND", "BACKGROUND", "CONFIG", "SHORTCUT", "INTERACTION", "NONE"]}, + "doc": "whether the event brought app to foreground or background or neither", "default": "NONE"} + ] +} diff --git a/commons/phone/phone_user_interaction.avsc b/commons/phone/phone_user_interaction.avsc index 29f8c10d..781f696b 100644 --- a/commons/phone/phone_user_interaction.avsc +++ b/commons/phone/phone_user_interaction.avsc @@ -6,6 +6,6 @@ "fields": [ {"name": "time", "type": "double", "doc": "device timestamp in UTC (s)"}, {"name": "timeReceived", "type": "double", "doc": "device receiver timestamp in UTC (s)"}, - {"name": "lockState", "type": {"name": "PhoneLockState", "type": "enum", "symbols": ["STANDBY", "UNLOCKED"]}, "doc": "what lock state the phone has"} + {"name": "interactionState", "type": {"name": "PhoneInteractionState", "type": "enum", "symbols": ["STANDBY", "UNLOCKED","SHUTDOWN","BOOTED"]}, "doc": "what interaction state the phone has"} ] -} \ No newline at end of file +} diff --git a/commons/questionnaire/questionnaire.avsc b/commons/questionnaire/questionnaire.avsc new file mode 100644 index 00000000..6a36c15d --- /dev/null +++ b/commons/questionnaire/questionnaire.avsc @@ -0,0 +1,28 @@ +{ + "namespace": "org.radarcns.questionnaire", + "type": "record", + "name": "Questionnaire", + "doc": "General schema for questionnaire. Check the specification folder to see how the questionnaire has been defined. For each QuestionnaireType there is a JSON file reporting the questions set and possible answers if available", + "fields": [ + { "name": "time", "type": "double", "doc": "timestamp in UTC (s) when the questionnaire is submitted to the subject" }, + { "name": "timeCompleted", "type": "double", "doc": "timestamp in UTC (s) when subject marks the questionnaire as" }, + { "name": "name", "type": {"name": "QuestionnaireType", "type": "enum", "symbols": ["PHQ8", "ESM", "UNKNOWN"]}, "doc": "Questionnaire names", "default": "UNKNOWN" }, + { "name": "version", "type": "string", "doc": "It reports the questionnaire version stated in the JSON specification" }, + { "name": "answers", + "type": { + "type": "array", + "items": { + "name": "Answer", + "type": "record", + "doc": "Questionnaire answer", + "fields": [ + { "name": "value", "type": ["int", "string", "double"], "doc": "Subject answer" }, + { "name": "startTime", "type": "double", "doc": "timestamp in UTC (s) when the question is shown" }, + { "name": "endTime", "type": "double", "doc": "timestamp in UTC (s) when the question is answered" } + ] + } + }, + "doc": "Answers list. The answers order must follow the questions order" + } + ] +} diff --git a/java-sdk/build.gradle b/java-sdk/build.gradle index 908b7536..bdd72bf2 100644 --- a/java-sdk/build.gradle +++ b/java-sdk/build.gradle @@ -15,7 +15,7 @@ subprojects { apply plugin: 'maven-publish' // Configuration - version = '0.1' + version = '0.2-alpha.1' group = 'org.radarcns' ext.githubRepoName = 'RADAR-CNS/RADAR-Schemas' diff --git a/java-sdk/radar-schemas-restapi/build.gradle b/java-sdk/radar-schemas-restapi/build.gradle index 3f8b9af2..5d300eca 100644 --- a/java-sdk/radar-schemas-restapi/build.gradle +++ b/java-sdk/radar-schemas-restapi/build.gradle @@ -5,12 +5,15 @@ ext.description = 'RADAR Schemas REST API SDK' // AVRO file manipulation // //---------------------------------------------------------------------------// task generateAvro(type: com.commercehub.gradle.plugin.avro.GenerateAvroJavaTask) { + source rootProject.fileTree('../commons') { + include 'questionnaire/questionnaire.avsc' + include 'application/application_server_status.avsc' + } source rootProject.fileTree('../restapi') { include '**/*.avsc' } outputDir avroOutputDir } - compileJava.dependsOn generateAvro //---------------------------------------------------------------------------// diff --git a/questionnaire/specification/DEMO_config.json b/questionnaire/specification/DEMO_config.json new file mode 100644 index 00000000..958d0154 --- /dev/null +++ b/questionnaire/specification/DEMO_config.json @@ -0,0 +1,42 @@ +{ + "name" : "DEMO", + "version": 1, + "estimatedCompletionTime" : 2, + "startText" : "Here you can test some all available input types.", + "endText" : "Thanks for giving it a try.", + "protocol" : { + "reminders" : { + "amount" : 15, + "repeat" : 1, + "unit" : "min" + }, + "repeatProtocol" : { + "amount" : 2, + "unit" : "week" + }, + "repeatQuestionnaire" : { + "unit" : "min", + "unitsFromZero" : [ 450, 600, 1890, 2004 ] + } + }, + "questions" : [ { + "content" : "The slider as fine-grained input.", + "id" : "Test-0", + "lead" : "Some other input types.", + "range" : { + "max" : 100, + "min" : 0, + "step" : 5 + }, + "type" : "slider" + }, { + "content" : "The multiple values for a smaller range.", + "id" : "Test-2", + "lead" : "Some other input types.", + "range" : { + "max" : 7, + "min" : 1 + }, + "type" : "range" + } ] +} diff --git a/questionnaire/specification/PHQ8_config.json b/questionnaire/specification/PHQ8_config.json new file mode 100644 index 00000000..80eed0fa --- /dev/null +++ b/questionnaire/specification/PHQ8_config.json @@ -0,0 +1,149 @@ +{ + "name" : "PHQ8", + "version": 1, + "estimatedCompletionTime" : 7, + "startText" : "This questionnaire is known as the PHQ8. Clinicians use it to assess current depression in patients. Thank you for taking part in this focus group.", + "endText" : "Thank you for participating today.", + "protocol" : { + "reminders" : { + "amount" : 15, + "repeat" : 2, + "unit" : "min" + }, + "repeatProtocol" : { + "amount" : 1, + "unit" : "month" + }, + "repeatQuestionnaire" : { + "unit" : "min", + "unitsFromZero" : [ 600 ] + } + }, + "questions" : [ { + "content" : "Little interest or pleasure in doing things.", + "id" : "PHQ8-0", + "lead" : "Over the past two weeks, how often have you been bothered by any of the following problems?", + "responses" : [ { + "response" : "Not at all", + "score" : 0 + }, { + "response" : "Several days", + "score" : 1 + }, { + "response" : "More than half the days", + "score" : 2 + }, { + "response" : "Nearly every day", + "score" : 3 + } ], + "type" : "radio" + }, { + "content" : "Feeling down, depressed, or hopeless.", + "id" : "PHQ8-1", + "lead" : "Over the past two weeks, how often have you been bothered by any of the following problems?", + "responses" : [ { + "response" : "Not at all", + "score" : 0 + }, { + "response" : "Several days", + "score" : 1 + }, { + "response" : "More than half the days", + "score" : 2 + }, { + "response" : "Nearly every day", + "score" : 3 + } ], + "type" : "radio" + }, { + "content" : "Trouble falling asleep or staying asleep, or sleeping too much.", + "id" : "PHQ8-2", + "lead" : "Over the past two weeks, how often have you been bothered by any of the following problems?", + "responses" : [ { + "response" : "Not at all", + "score" : 0 + }, { + "response" : "Several days", + "score" : 1 + }, { + "response" : "More than half the days", + "score" : 2 + }, { + "response" : "Nearly every day", + "score" : 3 + } ], + "type" : "radio" + }, { + "content" : "Feeling tired or having little energy.", + "id" : "PHQ8-3", + "lead" : "Over the past two weeks, how often have you been bothered by any of the following problems?", + "responses" : [ { + "response" : "Not at all", + "score" : 0 + }, { + "response" : "Several days", + "score" : 1 + }, { + "response" : "More than half the days", + "score" : 2 + }, { + "response" : "Nearly every day", + "score" : 3 + } ], + "type" : "radio" + }, { + "content" : "Feeling bad about yourself – or that you are a failure or have let yourself or your family down.", + "id" : "PHQ8-4", + "lead" : "Over the past two weeks, how often have you been bothered by any of the following problems?", + "responses" : [ { + "response" : "Not at all", + "score" : 0 + }, { + "response" : "Several days", + "score" : 1 + }, { + "response" : "More than half the days", + "score" : 2 + }, { + "response" : "Nearly every day", + "score" : 3 + } ], + "type" : "radio" + }, { + "content" : "Trouble concentrating on things such as reading the newspaper of watching television.", + "id" : "PHQ8-5", + "lead" : "Over the past two weeks, how often have you been bothered by any of the following problems?", + "responses" : [ { + "response" : "Not at all", + "score" : 0 + }, { + "response" : "Several days", + "score" : 1 + }, { + "response" : "More than half the days", + "score" : 2 + }, { + "response" : "Nearly every day", + "score" : 3 + } ], + "type" : "radio" + }, { + "content" : "Moving or speaking so slowly that other people have noticed. Or the opposite – being so fidgety or restless that you have been moving around a lot more than usual.", + "id" : "PHQ8-6", + "lead" : "Over the past two weeks, how often have you been bothered by any of the following problems?", + "responses" : [ { + "response" : "Not at all", + "score" : 0 + }, { + "response" : "Several days", + "score" : 1 + }, { + "response" : "More than half the days", + "score" : 2 + }, { + "response" : "Nearly every day", + "score" : 3 + } ], + "type" : "radio" + } ] +} diff --git a/restapi/app/application.avsc b/restapi/app/application.avsc index 29784b15..434536e6 100644 --- a/restapi/app/application.avsc +++ b/restapi/app/application.avsc @@ -4,9 +4,11 @@ "name": "Application", "doc": "Smartphone application status", "fields": [ - {"name": "ipAddress", "type": ["null", "string"], "doc": "Hardware identifier of client application", "default": null}, + {"name": "ipAddress", "type": [ + "null", + "string" ], "doc": "Hardware identifier of client application", "default": null}, {"name": "uptime", "type": "double", "doc": "Time since last app start (s)"}, - {"name": "serverStatus", "type": "ServerStatus", "doc": "server connection status", "default": "UNKNOWN"}, + {"name": "serverStatus", "type": "org.radarcns.application.ServerStatus", "doc": "server connection status", "default": "UNKNOWN"}, {"name": "recordsCached", "type": "int", "doc": "number of records currently being cached", "default": -1}, {"name": "recordsSent", "type": "int", "doc": "number of records sent since application start"}, {"name": "recordsUnsent", "type": "int", "doc": "number of unsent records", "default": -1} diff --git a/restapi/app/server_status.avsc b/restapi/app/server_status.avsc deleted file mode 100644 index 0a48935a..00000000 --- a/restapi/app/server_status.avsc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "namespace": "org.radarcns.avro.restapi.app", - "type": "enum", - "name": "ServerStatus", - "doc": "Set of device status", - "symbols": [ "CONNECTED" , "DISCONNECTED", "UNKNOWN" ] -} diff --git a/restapi/data/acceleration.avsc b/restapi/data/acceleration.avsc new file mode 100644 index 00000000..6dc1fcf3 --- /dev/null +++ b/restapi/data/acceleration.avsc @@ -0,0 +1,11 @@ +{ + "namespace": "org.radarcns.avro.restapi.data", + "type": "record", + "name": "Acceleration", + "doc": "Acceleration sample with gravitational constant g as unit.", + "fields": [ + {"name": "x", "type": [ "double" , "org.radarcns.avro.restapi.data.Quartiles" ], "doc": "acceleration in the x-axis (g)"}, + {"name": "y", "type": [ "double" , "org.radarcns.avro.restapi.data.Quartiles" ], "doc": "acceleration in the y-axis (g)"}, + {"name": "z", "type": [ "double" , "org.radarcns.avro.restapi.data.Quartiles" ], "doc": "acceleration in the z-axis (g)"} + ] +} diff --git a/restapi/data/double_sample.avsc b/restapi/data/double_sample.avsc new file mode 100644 index 00000000..b8f631e0 --- /dev/null +++ b/restapi/data/double_sample.avsc @@ -0,0 +1,9 @@ +{ + "namespace": "org.radarcns.avro.restapi.data", + "type": "record", + "name": "DoubleSample", + "doc": "Generic sample represented by a double value. A specific schema is provided to represent quartile values.", + "fields": [ + {"name": "value", "type": [ "double" , "org.radarcns.avro.restapi.data.Quartiles" ], "doc": "sample value"} + ] +} diff --git a/restapi/data/quartiles.avsc b/restapi/data/quartiles.avsc new file mode 100644 index 00000000..5690710d --- /dev/null +++ b/restapi/data/quartiles.avsc @@ -0,0 +1,11 @@ +{ + "namespace": "org.radarcns.avro.restapi.data", + "type": "record", + "name": "Quartiles", + "doc": "List of quartiles", + "fields": [ + {"name": "first", "type": "double", "doc": "the middle number between the smallest number and the median of the data set"}, + {"name": "second", "type": "double", "doc": "the median of the data"}, + {"name": "third", "type": "double", "doc": "the middle value between the median and the highest value of the data set"} + ] +} diff --git a/restapi/dataset/dataset.avsc b/restapi/dataset/dataset.avsc index 9d59e87b..05ad8e83 100644 --- a/restapi/dataset/dataset.avsc +++ b/restapi/dataset/dataset.avsc @@ -2,9 +2,9 @@ "namespace": "org.radarcns.avro.restapi.dataset", "type": "record", "name": "Dataset", - "doc": "A generic dataset containing aggregated data. Its body is divide in Header and Dataset: metadata and sensor data.", + "doc": "A generic collection of samples. Its body is divide in Header and Dataset: metadata and sensor data.", "fields": [ - {"name": "header", "type": "org.radarcns.avro.restapi.header.Header" }, - {"name": "dataset", "type": {"type": "array", "items": "Item" } } + {"name": "header", "type": "org.radarcns.avro.restapi.header.Header", "doc": "Information useful to contextualise the data set"}, + {"name": "dataset", "type": {"type": "array", "items": "Item" }, "doc": "Collection of samples"} ] } diff --git a/restapi/dataset/item.avsc b/restapi/dataset/item.avsc index ab3a8fa2..667a6e6c 100644 --- a/restapi/dataset/item.avsc +++ b/restapi/dataset/item.avsc @@ -4,15 +4,11 @@ "name": "Item", "doc": "Dataset item. It contains a value and its related time.", "fields": [ - {"name": "value", "type": [ - "org.radarcns.avro.restapi.sensor.HeartRate" , - "org.radarcns.avro.restapi.sensor.Acceleration" , - "org.radarcns.avro.restapi.sensor.Battery" , - "org.radarcns.avro.restapi.sensor.BloodVolumePulse" , - "org.radarcns.avro.restapi.sensor.ElectroDermalActivity" , - "org.radarcns.avro.restapi.sensor.InterBeatInterval" , - "org.radarcns.avro.restapi.sensor.Temperature" - ] } , - {"name": "effectiveTimeFrame", "type": "org.radarcns.avro.restapi.header.EffectiveTimeFrame"} + {"name": "sample", "type": [ + "org.radarcns.avro.restapi.data.DoubleSample" , + "org.radarcns.avro.restapi.data.Acceleration", + "org.radarcns.questionnaire.Questionnaire" + ], "doc": "Sample value. For more details, check org.radarcns.avro.restapi.data.Acceleration, org.radarcns.avro.restapi.data.DoubleSample and org.radarcns.questionnaire.Questionnaire" } , + {"name": "startDateTime", "type": "string", "doc": "Point in time (ISO8601) with UTC timezone. It represents the timestamp of the first sample contained inside the aggregated data."} ] } diff --git a/restapi/dataset/quartiles.avsc b/restapi/dataset/quartiles.avsc deleted file mode 100644 index 0e0e864e..00000000 --- a/restapi/dataset/quartiles.avsc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "namespace": "org.radarcns.avro.restapi.dataset", - "type": "record", - "name": "Quartiles", - "doc": "List of quartiles", - "fields": [ - {"name": "first", "type": "double"}, - {"name": "second", "type": "double"}, - {"name": "third", "type": "double"} - ] -} diff --git a/restapi/header/descriptive_statistic.avsc b/restapi/header/descriptive_statistic.avsc index b9f1f429..adf716c7 100644 --- a/restapi/header/descriptive_statistic.avsc +++ b/restapi/header/descriptive_statistic.avsc @@ -2,7 +2,7 @@ "namespace": "org.radarcns.avro.restapi.header", "type": "enum", "name": "DescriptiveStatistic", - "doc": "Set of available statical value", + "doc": "Statical values", "symbols": [ "AVERAGE" , "COUNT" , @@ -13,6 +13,7 @@ "INTERQUARTILE_RANGE" , "LOWER_QUARTILE" , "UPPER_QUARTILE", - "QUARTILES" + "QUARTILES", + "RECEIVED_MESSAGES" ] } diff --git a/restapi/header/effective_time_frame.avsc b/restapi/header/effective_time_frame.avsc index 9a23ce8a..ec139cb2 100644 --- a/restapi/header/effective_time_frame.avsc +++ b/restapi/header/effective_time_frame.avsc @@ -2,7 +2,7 @@ "namespace": "org.radarcns.avro.restapi.header", "type": "record", "name": "EffectiveTimeFrame", - "doc": "Time window", + "doc": "Provide the first and the last timestamp contained in the dataset", "fields": [ {"name": "startDateTime", "type": "string", "doc": "It is a point in time (ISO8601) with UTC timezone."}, {"name": "endDateTime", "type": "string", "doc": "It is a point in time (ISO8601) with UTC timezone."} diff --git a/restapi/header/header.avsc b/restapi/header/header.avsc index 4e130905..06bf7908 100644 --- a/restapi/header/header.avsc +++ b/restapi/header/header.avsc @@ -4,8 +4,13 @@ "name": "Header", "doc": "Metadata for Dataset. It is a summary explaining what kind of information are stored in the Dataset.", "fields": [ - {"name": "descriptiveStatistic", "type": "DescriptiveStatistic" }, - {"name": "unit", "type": "org.radarcns.avro.restapi.sensor.Unit"}, - {"name": "effectiveTimeFrame", "type": "EffectiveTimeFrame" } + {"name": "subjectId", "type": "string", "doc": "Subject identifier"}, + {"name": "sourceId", "type": "string", "doc": "Source identifier"}, + {"name": "source", "type": "org.radarcns.avro.restapi.source.SourceType", "doc": "Source type"}, + {"name": "sensor", "type": "org.radarcns.avro.restapi.sensor.SensorType", "doc": "Sensor that has generated data"}, + {"name": "descriptiveStatistic", "type": "DescriptiveStatistic", "doc": "Statical value expressed by samples" }, + {"name": "unit", "type": "org.radarcns.avro.restapi.sensor.Unit", "doc": "Measurement unit with which samples are measured" }, + {"name": "timeFrame", "type": "TimeFrame", "doc": "Time interval between two consecutive samples" }, + {"name": "effectiveTimeFrame", "type": "EffectiveTimeFrame", "doc": "Timestamps of the first and the last samples contained in the dataset" } ] } diff --git a/restapi/header/time_frame.avsc b/restapi/header/time_frame.avsc new file mode 100644 index 00000000..9a5e5feb --- /dev/null +++ b/restapi/header/time_frame.avsc @@ -0,0 +1,15 @@ +{ + "namespace": "org.radarcns.avro.restapi.header", + "type": "enum", + "name": "TimeFrame", + "doc": "Interval between two consecutive samples", + "symbols": [ + "TEN_SECOND" , + "THIRTY_SECOND" , + "ONE_MIN" , + "TEN_MIN" , + "ONE_HOUR" , + "ONE_DAY" , + "ONE_WEEK" + ] +} diff --git a/restapi/message.avsc b/restapi/message.avsc index f0c07ea0..3e48342c 100644 --- a/restapi/message.avsc +++ b/restapi/message.avsc @@ -2,7 +2,7 @@ "namespace": "org.radarcns.avro.restapi.avro", "type": "record", "name": "Message", - "doc": "Message to describe HTTP Response", + "doc": "Message to provide information to the end user in case a function does not provide the expected result", "fields": [ {"name": "message", "type": "string"} ] diff --git a/restapi/sensor/acceleration.avsc b/restapi/sensor/acceleration.avsc deleted file mode 100644 index 1c40294a..00000000 --- a/restapi/sensor/acceleration.avsc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "namespace": "org.radarcns.avro.restapi.sensor", - "type": "record", - "name": "Acceleration", - "doc": "Acceleration item for a dataset with gravitational constant g as unit.", - "fields": [ - {"name": "x", "type": [ "double" , "org.radarcns.avro.restapi.dataset.Quartiles" ]}, - {"name": "y", "type": [ "double" , "org.radarcns.avro.restapi.dataset.Quartiles" ]}, - {"name": "z", "type": [ "double" , "org.radarcns.avro.restapi.dataset.Quartiles" ]} - ] -} diff --git a/restapi/sensor/battery.avsc b/restapi/sensor/battery.avsc deleted file mode 100644 index a4b22359..00000000 --- a/restapi/sensor/battery.avsc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "namespace": "org.radarcns.avro.restapi.sensor", - "type": "record", - "name": "Battery", - "doc": "The battery level resulting from the data aggregation. It is a double value between 0 and 1", - "fields": [ - {"name": "value", "type": [ "double" , "org.radarcns.avro.restapi.dataset.Quartiles" ]} - ] -} diff --git a/restapi/sensor/blood_volume_pulse.avsc b/restapi/sensor/blood_volume_pulse.avsc deleted file mode 100644 index 276617ee..00000000 --- a/restapi/sensor/blood_volume_pulse.avsc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "namespace": "org.radarcns.avro.restapi.sensor", - "type": "record", - "name": "BloodVolumePulse", - "doc": "Data from photoplethysmograph expressed in light absorption (nW)", - "fields": [ - {"name": "value", "type": [ "double" , "org.radarcns.avro.restapi.dataset.Quartiles" ]} - ] -} diff --git a/restapi/sensor/data_type.avsc b/restapi/sensor/data_type.avsc index 67db33b9..d41c74d1 100644 --- a/restapi/sensor/data_type.avsc +++ b/restapi/sensor/data_type.avsc @@ -2,7 +2,7 @@ "namespace": "org.radarcns.avro.restapi.sensor", "type": "enum", "name": "DataType", - "doc": "States if the value is provided directly by a sensor or it is computed. Any value different from RAW states who computes the value.", + "doc": "States if a sample is recorded directly by a sensor or it is computed. Any value different from RAW states who computes the value.", "symbols": [ "RAW" , "VENDOR", diff --git a/restapi/sensor/electrodermal_activity.avsc b/restapi/sensor/electrodermal_activity.avsc deleted file mode 100644 index fb73431b..00000000 --- a/restapi/sensor/electrodermal_activity.avsc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "namespace": "org.radarcns.avro.restapi.sensor", - "type": "record", - "name": "ElectroDermalActivity", - "doc": "Aggregated data representing electrodermal activity expressed as microsiemens (µS)", - "fields": [ - {"name": "value", "type": [ "double" , "org.radarcns.avro.restapi.dataset.Quartiles" ]} - ] -} diff --git a/restapi/sensor/heart_rate.avsc b/restapi/sensor/heart_rate.avsc deleted file mode 100644 index 23ce4821..00000000 --- a/restapi/sensor/heart_rate.avsc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "namespace": "org.radarcns.avro.restapi.sensor", - "type": "record", - "name": "HeartRate", - "doc": "Heart Rate resulting from data aggregation. It is computed as (60 / ibi)", - "fields": [ - {"name": "value", "type": [ "double" , "org.radarcns.avro.restapi.dataset.Quartiles" ]} - ] -} diff --git a/restapi/sensor/inter_beat_interval.avsc b/restapi/sensor/inter_beat_interval.avsc deleted file mode 100644 index fe4fe615..00000000 --- a/restapi/sensor/inter_beat_interval.avsc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "namespace": "org.radarcns.avro.restapi.sensor", - "type": "record", - "name": "InterBeatInterval", - "doc": "Time between individuals heart beats", - "fields": [ - {"name": "value", "type": [ "double" , "org.radarcns.avro.restapi.dataset.Quartiles" ]} - ] -} diff --git a/restapi/sensor/sensor_type.avsc b/restapi/sensor/sensor_type.avsc index 48d6e3df..83945dd0 100644 --- a/restapi/sensor/sensor_type.avsc +++ b/restapi/sensor/sensor_type.avsc @@ -2,7 +2,7 @@ "namespace": "org.radarcns.avro.restapi.sensor", "type": "enum", "name": "SensorType", - "doc": "Set of sensor type", + "doc": "Sensor types", "symbols": [ "ACCELEROMETER" , "BATTERY", diff --git a/restapi/sensor/temperature.avsc b/restapi/sensor/temperature.avsc deleted file mode 100644 index 5852e4bf..00000000 --- a/restapi/sensor/temperature.avsc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "namespace": "org.radarcns.avro.restapi.sensor", - "type": "record", - "name": "Temperature", - "doc": "Temperature value expressed in Celsius (°C) scale", - "fields": [ - {"name": "value", "type": [ "double" , "org.radarcns.avro.restapi.dataset.Quartiles" ]} - ] -} diff --git a/restapi/sensor/unit.avsc b/restapi/sensor/unit.avsc index 239b088e..1f0a7709 100644 --- a/restapi/sensor/unit.avsc +++ b/restapi/sensor/unit.avsc @@ -2,7 +2,7 @@ "namespace": "org.radarcns.avro.restapi.sensor", "type": "enum", "name": "Unit", - "doc": "Set of measurement units", + "doc": "Measurement units", "symbols": [ "BEATS_PER_MIN" , "CELSIUS", diff --git a/restapi/source/source.avsc b/restapi/source/source.avsc index deb2e67b..b1ea6c03 100644 --- a/restapi/source/source.avsc +++ b/restapi/source/source.avsc @@ -4,8 +4,8 @@ "name": "Source", "doc": "Source details", "fields": [ - {"name": "id", "type": "string", "doc": "Source id"}, - {"name": "type", "type": "SourceType", "doc": "Source name"}, - {"name": "summary", "type": ["null", "SourceSummary"], "default": null, "doc": "Source details"} + {"name": "id", "type": "string", "doc": "Source identifier" }, + {"name": "type", "type": "SourceType", "doc": "Source name" }, + {"name": "summary", "type": ["null", "SourceSummary"], "default": null, "doc": "Source details" } ] } diff --git a/restapi/subject/cohort.avsc b/restapi/subject/cohort.avsc new file mode 100644 index 00000000..ee6b39a6 --- /dev/null +++ b/restapi/subject/cohort.avsc @@ -0,0 +1,10 @@ +{ + "namespace": "org.radarcns.avro.restapi.subject", + "type": "record", + "name": "Cohort", + "doc": "Cohort definition", + "fields": [ + {"name": "studyId", "type": "int", "doc": "ID related to the study"}, + {"name": "subjects", "type": {"type": "array", "items": "Subject" }, "doc": "List of Subject involved in the study"} + ] +} diff --git a/restapi/subject/subject.avsc b/restapi/subject/subject.avsc new file mode 100644 index 00000000..6cc7c283 --- /dev/null +++ b/restapi/subject/subject.avsc @@ -0,0 +1,12 @@ +{ + "namespace": "org.radarcns.avro.restapi.subject", + "type": "record", + "name": "Subject", + "doc": "Subject definition", + "fields": [ + {"name": "subjectId", "type": "string", "doc": "Subject identifier"}, + {"name": "active", "type": "boolean", "doc": "True if the subject is engaged, false otherwise. False means the subject is no longer monitored" }, + {"name": "effectiveTimeFrame", "type": "org.radarcns.avro.restapi.header.EffectiveTimeFrame", "doc": "Timestamps of the first and the last samples received by the subject" }, + {"name": "sources", "type": {"type": "array", "items": "org.radarcns.avro.restapi.source.Source" }, "doc": "List of sources used by the subject"} + ] +} diff --git a/restapi/user/cohort.avsc b/restapi/user/cohort.avsc deleted file mode 100644 index 5e44c7fc..00000000 --- a/restapi/user/cohort.avsc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "namespace": "org.radarcns.avro.restapi.user", - "type": "record", - "name": "Cohort", - "doc": "Cohort definition", - "fields": [ - {"name": "studyId", "type": "int", "doc": "ID related to the study"}, - {"name": "patients", "type": {"type": "array", "items": "Patient" }, "doc": "List of patients involved in the study"} - ] -} diff --git a/restapi/user/patient.avsc b/restapi/user/patient.avsc deleted file mode 100644 index c575110a..00000000 --- a/restapi/user/patient.avsc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "namespace": "org.radarcns.avro.restapi.user", - "type": "record", - "name": "Patient", - "doc": "Patient definition", - "fields": [ - {"name": "userId", "type": "string", "doc": "User identifier"}, - {"name": "sources", "type": {"type": "array", "items": "org.radarcns.avro.restapi.source.Source" }, "doc": "List of all sources used by the Patient"} - ] -}