diff --git a/commons/active/banking/BankingEvent.avsc b/commons/active/banking/BankingEvent.avsc new file mode 100644 index 00000000..0dc5a978 --- /dev/null +++ b/commons/active/banking/BankingEvent.avsc @@ -0,0 +1,23 @@ +{ + "namespace": "org.radarcns.active.banking", + "type": "record", + "name": "BankingEvent", + "doc": "A Banking App Event, which is either a correct or wrong submission of a PIN number, an amount to withdraw, a cancelled or confirmed transaction. Notably, this allows us to distinguish between a wrong confirmed transaction or a correct cancelled transaction etc.", + "fields": [ + { "name": "time", "type": "double", "doc": "Time since the Unix Epoch (seconds), time stores the time an event has started." }, + { "name": "timeCompleted", "type": "double", "doc": "Time since the Unix Epoch (seconds), time stores the time an event has been completed." }, + { "name": "duration", "type": "double", "doc": "Duration of the event (seconds), duration is essentially timeCompleted - time."}, + { "name": "transactionId", "type":"string", "doc": "The uid of Transaction record that the event is related to." }, + { "name": "isCorrect", "type": ["null","boolean"], "doc": "Describes if the input Pin or Amount is correct. Null if this event is a confirmation or cancellation.", "default": null }, + { "name": "eventType", + "type": { + "name": "EventType", + "type": "enum", + "symbols": ["PIN", "AMOUNT", "TRANSACTION_CANCELLED", "TRANSACTION_CONFIRMED", "UNKNOWN"], + "doc": "PIN: PIN input, AMOUNT: Amount input, TRANSACTION_CANCELLED: the Transaction is canceled, TRANSACTION_CONFIRMED: the Transaction is confirmed, UNKNOWN: for any other input type." + }, + "doc": "The type of submitted input: PIN or Amount.", + "default": "UNKNOWN" + } + ] +} diff --git a/commons/active/banking/BankingTransaction.avsc b/commons/active/banking/BankingTransaction.avsc new file mode 100644 index 00000000..5eb230dc --- /dev/null +++ b/commons/active/banking/BankingTransaction.avsc @@ -0,0 +1,38 @@ +{ + "namespace": "org.radarcns.active.banking", + "type": "record", + "name": "BankingTransaction", + "doc": "Transaction in Banking App. This captures a full transaction: inputting a PIN number, then an amount and then a confirmation or cancellation. A transaction may also time out or end prematurely.", + "fields": [ { + "name": "transactionId", + "type": "string", + "doc": "Unique ID for an Transaction." + }, { + "name": "time", + "type": "double", + "doc": "Time since the Unix Epoch (seconds), time stores the time a transaction has started." + }, { + "name": "timeCompleted", + "type": "double", + "doc": "Time stores the time a transaction has been completed." + }, { + "name": "duration", + "type": "double", + "doc": "Duration of the transaction (seconds), duration is essentially timeCompleted - time." + }, { + "name": "isComplete", + "type": [ "null", "boolean" ], + "doc": "True if the result is CORRECT_CONFIRMED, WRONG_CONFIRMED, CORRECT_CANCELLED or WRONG_CANCELLED. False if TIME_OUT or EXIT.", + "default": null + }, { + "name": "transactionResult", + "type": { + "type": "enum", + "name": "TransactionResult", + "doc": "CORRECT_CONFIRMED: both inputs Correct- Confirmed Transaction, CORRECT_CANCELLED: Correct inputs - Cancelled Transaction, WRONG_CONFIRMED: (at least one of two inputs Wrong) - Confirmed Transaction, WRONG_CANCELLED: Wrong input Cancelled Transaction, TIME_OUT: Transaction timed Out, EXIT: Transaction Ended prematurely.", + "symbols" : [ "CORRECT_CONFIRMED", "CORRECT_CANCELLED", "WRONG_CONFIRMED", "WRONG_CANCELLED", "TIME_OUT", "EXIT", "UNKNOWN"] + }, + "doc": "Shows the result of the Transaction which can be Correct Cancelled, Correct Cancelled, Wrong Confirmed, Wrong Cancelled, Timed Out, Ended.", + "default": "UNKNOWN" + } ] +} \ No newline at end of file diff --git a/commons/connector/upload/axivity/axivity_battery.avsc b/commons/connector/upload/axivity/axivity_battery_level.avsc similarity index 93% rename from commons/connector/upload/axivity/axivity_battery.avsc rename to commons/connector/upload/axivity/axivity_battery_level.avsc index 35af9153..90878ac1 100644 --- a/commons/connector/upload/axivity/axivity_battery.avsc +++ b/commons/connector/upload/axivity/axivity_battery_level.avsc @@ -1,7 +1,7 @@ { "namespace": "org.radarcns.connector.upload.axivity", "type": "record", - "name": "AxivityBattery", + "name": "AxivityBatteryLevel", "doc": "Battery level data from Axivity device.", "fields": [ {"name": "time", "type": "double", "doc": "Timestamp in unix time acquired locally from the device."}, diff --git a/commons/connector/upload/axivity/axivity_event.avsc b/commons/connector/upload/axivity/axivity_event.avsc new file mode 100644 index 00000000..d4837138 --- /dev/null +++ b/commons/connector/upload/axivity/axivity_event.avsc @@ -0,0 +1,15 @@ +{ + "namespace": "org.radarcns.connector.upload.axivity", + "type": "record", + "name": "AxivityEvent", + "doc": "Event data available in a CWA block.", + "fields": [ + {"name": "time", "type": "double", "doc": "Timestamp in unix time acquired locally from the device."}, + {"name": "timeReceived", "type": "double", "doc": "Timestamp in unix time received from upload."}, + {"name": "event", "type": { + "name": "AxivityEventType", + "type": "enum", + "doc": "Event types recorded from the axivity device.", + "symbols": ["RESUME", "SINGLE_TAP", "DOUBLE_TAP", "FIFO_OVERFLOW", "BUFFER_OVERFLOW", "UNHANDLED_INTERRUPT", "UNKNOWN"]}, "doc": "Event of the block.", "default": "UNKNOWN"} + ] +} diff --git a/commons/connector/upload/axivity/axivity_metadata.avsc b/commons/connector/upload/axivity/axivity_metadata.avsc index b12a895a..4c929609 100644 --- a/commons/connector/upload/axivity/axivity_metadata.avsc +++ b/commons/connector/upload/axivity/axivity_metadata.avsc @@ -6,9 +6,7 @@ "fields": [ {"name": "time", "type": "double", "doc": "Timestamp in unix time acquired locally from the device."}, {"name": "timeReceived", "type": "double", "doc": "Timestamp in unix time received from upload."}, - {"name": "deviceId", "type": "string", "doc": "Version number."}, - {"name": "exerciseCode", "type": "string", "doc": "Exercise code from axivity."}, - {"name": "bodyLocation", "type": "int", "doc": "Body location recorded on the axivity device."}, - {"name": "studyCode", "type": "string", "doc": "Study code recorded on the axivity device."} + {"name": "annotationName", "type": "string", "doc": "Name of the annotation from cwa metadata."}, + {"name": "annotationData", "type": "string", "doc": "Value available for this annotation in the cwa metadata."} ] } diff --git a/commons/monitor/questionnaire/questionnaire_application_interaction_event.avsc b/commons/monitor/questionnaire/questionnaire_application_interaction_event.avsc index bcab70e9..fa7088a3 100644 --- a/commons/monitor/questionnaire/questionnaire_application_interaction_event.avsc +++ b/commons/monitor/questionnaire/questionnaire_application_interaction_event.avsc @@ -9,7 +9,7 @@ "name": "InteractionEventType", "doc": "NOTIFICATION_OPEN = When a user presses the notification to open the app, APP_OPEN = When a user opens the app directly, QUESTIONNAIRE_STARTED = When a user starts a questionnaire, QUESTIONNAIRE_FINISHED = When a user completes a questionnaire, QUESTIONNAIRE_CANCELLED = When a user closes a questionnaire without completing it.", "type": "enum", - "symbols": ["NOTIFICATION_OPEN", "APP_OPEN", "QUESTIONNAIRE_STARTED", "QUESTIONNAIRE_FINISHED", "QUESTIONNAIRE_CANCELLED", "OTHER", "UNKNOWN"] + "symbols": ["NOTIFICATION_OPEN", "APP_OPEN", "QUESTIONNAIRE_STARTED", "QUESTIONNAIRE_FINISHED", "QUESTIONNAIRE_CANCELLED", "OTHER", "UNKNOWN", "RECORDING_STARTED", "RECORDING_STOPPED"] }, "doc": "Questionnaire app activity usage event type.", "default": "UNKNOWN" diff --git a/java-sdk/README.md b/java-sdk/README.md index 748487be..123750cd 100644 --- a/java-sdk/README.md +++ b/java-sdk/README.md @@ -9,10 +9,10 @@ repositories { dependencies { // Commons schemas (backend, passive remote monitoring app) - compile 'org.radarcns:radar-schemas-commons:0.5.5' + compile 'org.radarcns:radar-schemas-commons:0.5.6' // Questionnaire schemas (active remote monitoring app) - compile 'org.radarcns:radar-schemas-tools:0.5.5' + compile 'org.radarcns:radar-schemas-tools:0.5.6' } ``` Usually, you only need to include the schemas you actually need in your dependencies. diff --git a/java-sdk/build.gradle b/java-sdk/build.gradle index 245fe70c..a83d499d 100644 --- a/java-sdk/build.gradle +++ b/java-sdk/build.gradle @@ -17,7 +17,7 @@ subprojects { apply plugin: 'idea' // Configuration - version = '0.5.5' + version = '0.5.6' group = 'org.radarcns' ext.githubRepoName = 'RADAR-base/RADAR-Schemas' diff --git a/java-sdk/radar-schemas-tools/build.gradle b/java-sdk/radar-schemas-tools/build.gradle index 68c07e40..da6c0bc2 100644 --- a/java-sdk/radar-schemas-tools/build.gradle +++ b/java-sdk/radar-schemas-tools/build.gradle @@ -31,14 +31,14 @@ ext { description = 'RADAR Schemas specification and validation tools.' argparseVersion = '0.8.1' - jacksonVersion = '2.9.9.1' - jacksonYamlVersion = '2.9.9' - jerseyVersion = '2.28' - jettyVersion = '9.4.17.v20190418' + jacksonVersion = '2.10.1' + jacksonYamlVersion = '2.10.1' + jerseyVersion = '2.29.1' + jettyVersion = '9.4.24.v20191120' junitVersion = '4.12' - confluentVersion = '5.3.0' + confluentVersion = '5.3.1' kafkaVersion = '2.3.0' - okHttpVersion = '4.0.0' + okHttpVersion = '4.2.2' radarCommonsVersion = '0.12.1' slf4jVersion = '1.7.26' } diff --git a/java-sdk/radar-schemas-tools/src/main/java/org/radarcns/schema/registration/SchemaRegistry.java b/java-sdk/radar-schemas-tools/src/main/java/org/radarcns/schema/registration/SchemaRegistry.java index e3f42de6..9a786ff7 100644 --- a/java-sdk/radar-schemas-tools/src/main/java/org/radarcns/schema/registration/SchemaRegistry.java +++ b/java-sdk/radar-schemas-tools/src/main/java/org/radarcns/schema/registration/SchemaRegistry.java @@ -171,8 +171,8 @@ public int execute(Namespace options, CommandLineApp app) { try { SchemaRegistry registration = new SchemaRegistry(url); boolean forced = options.getBoolean("force"); - if (forced) { - forced = registration.putCompatibility(Compatibility.NONE); + if (forced && !registration.putCompatibility(Compatibility.NONE)) { + return 1; } boolean result; Pattern pattern = matchTopic( diff --git a/java-sdk/radar-schemas-tools/src/main/java/org/radarcns/schema/validation/rules/RadarSchemaRules.java b/java-sdk/radar-schemas-tools/src/main/java/org/radarcns/schema/validation/rules/RadarSchemaRules.java index c37f1e2b..75a94fa0 100644 --- a/java-sdk/radar-schemas-tools/src/main/java/org/radarcns/schema/validation/rules/RadarSchemaRules.java +++ b/java-sdk/radar-schemas-tools/src/main/java/org/radarcns/schema/validation/rules/RadarSchemaRules.java @@ -222,7 +222,10 @@ public Validator validateAvroData() { org.apache.kafka.connect.data.Schema connectSchema = encoder .toConnectSchema(schema); Schema originalSchema = decoder.fromConnectSchema(connectSchema); - return check(schema.equals(originalSchema), "Schema changed by validation"); + return check(schema.equals(originalSchema), + () -> "Schema changed by validation: " + + schema.toString(true) + " is not equal to " + + originalSchema.toString(true)); } catch (Exception ex) { return raise("Failed to convert schema back to itself"); } diff --git a/java-sdk/radar-schemas-tools/src/main/java/org/radarcns/schema/validation/rules/Validator.java b/java-sdk/radar-schemas-tools/src/main/java/org/radarcns/schema/validation/rules/Validator.java index 8c57da85..ab94075e 100644 --- a/java-sdk/radar-schemas-tools/src/main/java/org/radarcns/schema/validation/rules/Validator.java +++ b/java-sdk/radar-schemas-tools/src/main/java/org/radarcns/schema/validation/rules/Validator.java @@ -20,6 +20,7 @@ import java.util.Collection; import java.util.function.Function; import java.util.function.Predicate; +import java.util.function.Supplier; import java.util.regex.Pattern; import java.util.stream.Stream; import org.radarcns.schema.validation.ValidationException; @@ -32,6 +33,10 @@ static Stream check(boolean test, String message) { return test ? valid() : raise(message); } + static Stream check(boolean test, Supplier message) { + return test ? valid() : raise(message.get()); + } + /** * TODO. * @param predicate TODO diff --git a/specifications/active/aRMT-1.5.1.yml b/specifications/active/aRMT-1.5.1.yml new file mode 100644 index 00000000..e85a9b1d --- /dev/null +++ b/specifications/active/aRMT-1.5.1.yml @@ -0,0 +1,118 @@ +name: aRMT +vendor: RADAR +model: aRMT-App +version: 1.5.1 +assessment_type: QUESTIONNAIRE +doc: aRMT Questionnaires definition. Includes Personal Health Questionnaire Depression Scale (PHQ-8), Experience sampling method (ESM) and RSES and other data. +data: + - type: THINC_IT + topic: notification_thinc_it + value_schema: .active.questionnaire.Questionnaire + questionnaire_definition_url: https://github.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/blob/master/questionnaires/thinc_it/thinc_it_armt.json + - type: ROMBERG_TEST + doc: The value of the task is in milliseconds (ms). + topic: task_romberg_test + value_schema: .active.task.Task + questionnaire_definition_url: https://github.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/blob/master/questionnaires/romberg_test/romberg_test_armt.json + - type: 2MW_TEST + doc: The value of the task is in milliseconds (ms). + topic: task_2MW_test + value_schema: .active.task.Task + questionnaire_definition_url: https://github.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/blob/master/questionnaires/2MW_test/2MW_test_armt.json + - type: TANDEM_WALKING_TEST + doc: The value of the task is in milliseconds (ms). + topic: task_tandem_walking_test + value_schema: .active.task.Task + questionnaire_definition_url: https://github.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/blob/master/questionnaires/tandem_walking_test/tandem_walking_test_armt.json + - type: PHQ8 + topic: questionnaire_phq8 + value_schema: .active.questionnaire.Questionnaire + questionnaire_definition_url: https://raw.githubusercontent.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/master/questionnaires/phq8/phq8_armt.json + - type: ESM + topic: questionnaire_esm + value_schema: .active.questionnaire.Questionnaire + questionnaire_definition_url: https://raw.githubusercontent.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/master/questionnaires/esm/esm_armt.json + - type: AUDIO + topic: questionnaire_audio + value_schema: .active.questionnaire.Questionnaire + questionnaire_definition_url: https://raw.githubusercontent.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/master/questionnaires/audio/audio_armt.json + - type: AUDIO_2 + topic: questionnaire_audio + value_schema: .active.questionnaire.Questionnaire + questionnaire_definition_url: https://raw.githubusercontent.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/master/questionnaires/audio_2/audio_2_armt.json + - type: AUDIO_3 + topic: questionnaire_audio + value_schema: .active.questionnaire.Questionnaire + questionnaire_definition_url: https://raw.githubusercontent.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/master/questionnaires/audio_3/audio_3_armt.json + - type: AUDIO_4 + topic: questionnaire_audio + value_schema: .active.questionnaire.Questionnaire + questionnaire_definition_url: https://raw.githubusercontent.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/master/questionnaires/audio_4/audio_4_armt.json + - type: RSES + topic: questionnaire_rses + value_schema: .active.questionnaire.Questionnaire + questionnaire_definition_url: https://raw.githubusercontent.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/master/questionnaires/rses/rses_armt.json + - type: PERCEIVED_DEFICITS_QUESTIONNAIRE + topic: questionnaire_perceived_deficits_questionnaire + value_schema: .active.questionnaire.Questionnaire + questionnaire_definition_url: https://raw.githubusercontent.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/master/questionnaires/perceived_deficits_questionnaire/perceived_deficits_questionnaire_armt.json + - type: PATIENT_DETERMINED_DISEASE_STEP + topic: questionnaire_patient_determined_disease_step + value_schema: .active.questionnaire.Questionnaire + questionnaire_definition_url: https://raw.githubusercontent.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/master/questionnaires/patient_determined_disease_step/patient_determined_disease_step_armt.json + - type: ESM28Q + topic: questionnaire_esm28q + value_schema: .active.questionnaire.Questionnaire + questionnaire_definition_url: https://raw.githubusercontent.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/master/questionnaires/esm28q/esm28q_armt.json + - type: BIPQ + topic: questionnaire_bipq + value_schema: .active.questionnaire.Questionnaire + questionnaire_definition_url: https://raw.githubusercontent.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/master/questionnaires/bipq/bipq_armt.json + - type: ESM_EPI_MOD_1 + topic: questionnaire_esm_epi_mod_1 + value_schema: .active.questionnaire.Questionnaire + questionnaire_definition_url: https://raw.githubusercontent.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/master/questionnaires/esm_epi_mod_1/esm_epi_mod_1_armt.json + - type: EVENING_ASSESSMENT + topic: questionnaire_evening_assessment + value_schema: .active.questionnaire.Questionnaire + questionnaire_definition_url: https://raw.githubusercontent.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/master/questionnaires/evening_assessment/evening_assessment_armt.json + - type: MORNING_ASSESSMENT + topic: questionnaire_morning_assessment + value_schema: .active.questionnaire.Questionnaire + questionnaire_definition_url: https://raw.githubusercontent.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/master/questionnaires/morning_assessment/morning_assessment_armt.json + - type: TAM + topic: questionnaire_tam + value_schema: .active.questionnaire.Questionnaire + questionnaire_definition_url: https://raw.githubusercontent.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/master/questionnaires/tam/tam_armt.json + - type: BAARS_IV + topic: questionnaire_baars_iv + value_schema: .active.questionnaire.Questionnaire + questionnaire_definition_url: https://raw.githubusercontent.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/master/questionnaires/baars_iv/baars_iv_armt.json + - type: ARI_SELF + topic: questionnaire_ari_self + value_schema: .active.questionnaire.Questionnaire + questionnaire_definition_url: https://raw.githubusercontent.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/master/questionnaires/ari_self/ari_self_armt.json + - type: GAD7 + topic: questionnaire_gad7 + value_schema: .active.questionnaire.Questionnaire + questionnaire_definition_url: https://raw.githubusercontent.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/master/questionnaires/gad7/gad7_armt.json + - type: RPQ + topic: questionnaire_rpq + value_schema: .active.questionnaire.Questionnaire + questionnaire_definition_url: https://raw.githubusercontent.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/master/questionnaires/rpq/rpq_armt.json + - type: ART_COGNITIVE_TEST + topic: questionnaire_art_cognitive_test + value_schema: .active.questionnaire.Questionnaire + questionnaire_definition_url: https://raw.githubusercontent.com/RADAR-base/RADAR-REDCap-aRMT-Definitions/master/questionnaires/art_cognitive_test/art_cognitive_test_armt.json + - type: COMPLETION_LOG + doc: Information about the completeness of each questionnaire. + topic: questionnaire_completion_log + value_schema: .monitor.questionnaire.QuestionnaireCompletionLog + - type: TIMEZONE + doc: Timezone information sent along with each questionnaire. + topic: questionnaire_timezone + value_schema: .monitor.application.ApplicationTimeZone + - type: APP_EVENT + doc: Questionnaire application interaction event. + topic: questionnaire_app_event + value_schema: .monitor.questionnaire.QuestionnaireApplicationInteractionEvent diff --git a/specifications/active/banking-app-1.0.0.yml b/specifications/active/banking-app-1.0.0.yml new file mode 100644 index 00000000..8ef7e787 --- /dev/null +++ b/specifications/active/banking-app-1.0.0.yml @@ -0,0 +1,17 @@ +#==================== BankingApp Specification ======================# +name: BankingApp +vendor: CERTH +model: BankingApp +version: 1.0.0 +assessment_type: APP +doc: Banking App schemas and topics +data: + - type: APP_EVENT + doc: A Banking App Event, which is either a correct or wrong submission of a PIN number, an amount to withdraw, a cancelled or confirmed transaction. Notably, this allows us to distinguish between a wrong confirmed transaction or a correct cancelled transaction etc. + topic: certh_banking_app_event + value_schema: .active.banking.BankingEvent + - type: TRANSACTION + doc: Transaction in Banking App. This captures a full transaction inputting a PIN number, then an amount and then a confirmation or cancellation. + topic: certh_banking_app_transaction + value_schema: .active.banking.BankingTransaction + diff --git a/specifications/connector/radar-axivity-connector.yml b/specifications/connector/radar-axivity-connector.yml index 5a4a18b6..b3906924 100644 --- a/specifications/connector/radar-axivity-connector.yml +++ b/specifications/connector/radar-axivity-connector.yml @@ -3,12 +3,28 @@ name: RADAR-AXIVITY-CONNECTOR vendor: Axivity model: Axivity.device version: 1.0.0 -doc: Spec for RADAR-base Axivity data upload connector. Schemas should be registered in the connector. +doc: Spec for RADAR-base Axivity data upload connector. Schemas should be registered in the connector. Information on the raw data can be found at https://github.com/digitalinteraction/openmovement/tree/master/Docs/ax3. data: - doc: Data from 3-axis accelerometer sensor with gravitational constant g as unit. Data extracted from CWA binary file. topic: connect_upload_axivity_acceleration value_schema: .connector.upload.axivity.AxivityAcceleration + - doc: Battery level information of axivity device extracted from CWA Block. + topic: connect_upload_axivity_battery_level + value_schema: .connector.upload.axivity.AxivityBatteryLevel + + - doc: Ambient light data extracted from a CWA Block. + topic: connect_upload_axivity_light + value_schema: .connector.upload.axivity.AxivityLight + + - doc: Temperature data extracted from CWA Block. + topic: connect_upload_axivity_temperature + value_schema: .connector.upload.axivity.AxivityLight + + - doc: Event data extracted from from a CWA Block. + topic: connect_upload_axivity_event + value_schema: .connector.upload.axivity.AxivityEvent + # meta-data - doc: Data that contains additional meta-data of the recording. Data extracted from the header of CWA binary file. topic: connect_upload_axivity_metadata