JSON Schema draft-04 for Atlas Cohort definition, Concept set and others.
Here you find a JSON Schema that validates JSON output exported by Atlas Cohort Definitions interface, as seen on the EXPORT/JSON tab.
The motivation is to enable others tools, beyond OHDSI, to be able to import/export JSON cohort definitions having a way to validate it's contents.
Atlas JSON Schemas are written agstain JSON Schema draft-04 specification because its large parser support on major languages and with the hope to be easy portable to more recent JSON Schema versions.
There are two kinds of the schemas:
- multi: Several small files referenced by "$ref" to each ohter's. You need to enable support to AJAX schema loading to use.
- single: One big file without JSON Editor options and descriptions suitable for just validation.
The multi kind of schemas have options to support JSON Editor project, which generates a form for data entry.
As far as possible, it mimics the Atlas interface. This helped a lot to write and validate the schema, because it's easy to copy and paste the JSON definition output of a cohort from one tool to the other.
Schemas are organized on branches by the version of the Atlas interface. Currently this means support for the Atlas Version 2.7.4.
So, to find the files of these release, you need to access:
- https://raw.githubusercontent.com/OHDSIBr/ATLAS-JSON-Schema/2.7.4/multi/atlas_cohort_definition.json
or:
To access from a Schema tool, use as schema:
{
"$ref": "https://raw.githubusercontent.com/OHDSIBr/ATLAS-JSON-Schema/2.7.4/multi/atlas_cohort_definition.json"
}
and eable Ajax loading of schemas.
Or, if you want to browse the files, go to the 2.7.4 branch of this repository.
- Load a Cohort Definition in the Atlas UI, go to the Export tab and select the JSON view. Click on the "Copy to Clipboard" button.
- Use the JSON-Editor Interactive Playground
- Go to Output tab and paste the JSON data definition
- Click on Form tab, navigate to Concept Sets or Cohort Entry Events tabs, for example and modify anything you want
- Go to Output tab, select all (ctrl-a) and copy to clipboard (ctrl-c)
- Go back to Atlas UI, to the Export/JSon tab, select all and paste the new content from clipboard
- Click Reload on bottom rigth corner. This reloads the new JSon data on Atlas.
- Got to Definition tab, the modifications made must appear now.
Alternatively, you can use the JSON-Editor interactive demo with similar results.
A cohort example of ACE inhibitor, can be seen:
To test validation can be used an online validator like:
On the JSON Schema side, paste:
{
"$ref":"https://raw.githubusercontent.com/OHDSIBr/ATLAS-JSON-Schema/2.7.4/single/atlas_cohort_definition.json"
}
On the JSON Instance side, paste a JSON Output exported from ATLAS and click on Validate button.