Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

See

Jira Legacy
serverSystem JIRA
serverIdba6fb084-9827-3160-8067-8ac7470f78b2
keyDHP-1074

Table of Contents

JSON Validation

New Design

JSON Schemas will be used to validate the structure of the JSON data and type correctness. In Java, we can use https://github.com/networknt/json-schema-validator (see also https://mvnrepository.com/artifact/com.networknt/json-schema-validator). This library was chosen because it’s compatible with both Jackson and Schema Draft 7.

JSON Schemas will be loaded from the mapping at https://github.com/BridgeDigitalHealth/mobile-client-json/blob/main/archive-map.json For each file in the uploaded zip file, we will use the filename to grab the correct schema, and then validate the file against that schema.

Previous experience tells us that researchers still want data even if it fails validation. However, we will log a message to the logs if it fails validation. We will use a Log Scan to add this to our dashboards so we can monitor and detect invalid uploads and incorrect schemas and fix app issues and systemic issues.

Open Questions:

  • The mapping looks very sparse. The only file that has a schema is metadata.json. Everything else appears to be specific to the MTB app or assessments. Do we plan to update this mapping?

  • If we need to write a new schemas anyway, does it make more sense to put them into AssessmentResources, so we don’t have to load GitHub URLs and parse JSON files?

  • Are we only going to use the filename mapping? Or are we also going to use assessment and app mapping?

Old Design

JSON Schemas can be added as an Assessment Resource. Pre-req

Jira Legacy
serverSystem JIRA
serverIdba6fb084-9827-3160-8067-8ac7470f78b2
keyDHP-1070

JSON-to-Table-Row (see

Jira Legacy
serverSystem JIRA
serverIdba6fb084-9827-3160-8067-8ac7470f78b2
keyDHP-1072
) will check Assessment Resources for the Assessment ID / Revision for all JSON Schemas. For each file in the zip file, it will look for the JSON Schema with a title that matches the file name. We will then validate each file against the schema.Previous experience tells us that researchers still want data even if it fails validation. However, we will log a message to the logs if it fails validation. We will use a Log Scan to add this to our dashboards so we can monitor and detect invalid uploads and incorrect schemas and fix app issues and systemic issues.

Table Column Validation

A list of table columns will be added as an Assessment Resource. The format will be a simple JSON Array of strings, where the strings are the names of the expected table columns (excluding common metadata columns).

...