fhir-schemas
FHIR Resources implemented with json-schemas
and some backwards support for simpl-schema
. The purpose of this package is to a) make the HL7 FHIR json-schemas available on NPM, and b) start migrating Meteor apps off of meteor-simple-schema
. Roughly speaking, the SimpleSchemas correspond to either v1.6.0
of DST2, and the JsonSchemas correspond to v3.0.1
or STU3
.
Installation
# the core schema libraries npm install -save fhir-schemas # if you're running a Meteor app, you'll also want to install the following conversion utility meteor npm install -save fhir-schemasmeteor add bshamblen:json-simple-schema
JsonSchema Usage
Going forward, we recommend the Json Schama format, which is the official schema published by the HL7 FHIR working groups, has low-level Mongo support, and has cross-platform support across a wide rage of Node/NPM apps.
Client
//-------------------------------------------------------------// Schema Validation ;; var ajv = ; var validate = ajv; var newPatient = "resourceType": "Patient" "name": "family": 'Doe' "given": 'Jane' "identifier": "value": '123' ; var isValid = ; //-------------------------------------------------------------// Server ; // this is a legacy API; based on the FHIR schemas shipping in different files// will probably be deprecated in the future; // Connection URLconst url = 'mongodb://localhost:27017'; // Database Nameconst dbName = 'myproject'; // Use connect method to connect to the serverMongoClient; //-------------------------------------------------------------// Auto Forms // This is still experimental, and may not work. ;; ; ; const log = consolelog; ; var simpleSchema = jsonSchema;
Server - Meteor
The following is an example for Meteor apps.
; // JSONSchema is provided as a global, since it's loaded from Atmosphere package repositoryvar jsonSchema = PatientSchema; // convert to simple schemavar simpleSchema = jsonSchema; // create our server side cursorCurrentPatients = 'CurrentPatients'; // and attach the cursorCurrentPatients; // for debuggingvar props = jsonSchema;console
Json Schemas
We provide Json Schemas for all of the following resources.
FHIR Resource Index
Notes & References
https://github.com/bshamblen/meteor-json-simple-schema
https://docs.mongodb.com/manual/core/schema-validation/#json-schema
https://docs.mongodb.com/manual/reference/command/collMod/#dbcmd.collMod
https://github.com/mozilla-services/react-jsonschema-form
https://tools.ietf.org/html/draft-zyp-json-schema-04