Collections - mcode/medmorph-backend GitHub Wiki

Overview

This wiki page shows all the collections in the server and their schema. Collections for FHIR resources are named "{resourceType.toLowerCase()}s" and the data is simply the resource.

Collection

Servers

The servers collection stores all the known servers the backend client may connect to.

{
   name: String // human readable name
   endpoint: String // FHIR base url
   type: 'KA' | 'EHR' | 'PHA' // type of server the endpoint is
   clientId: String // the client id returned when the backend app registered with this server
   token: String | null // access token if one exists
   tokenExp: number | null // the time the token expires (seconds from epoch)
}

In the schema above KA stands for Knowledge Artifact Repository, EHR stands for Electronic Health Record, and PHA stands for Public Health Authority.

If the value does not explicitly include null or undefined then it is required.

Reporting

The reporting collection contains the working context object stored from the reporting workflow. To help ensure consistency, the schema is not duplicated here. See: https://github.com/mcode/medmorph-backend/wiki/Reporting-Workflow#data-model

Completed Reports

The completed reports collection contains reporting bundles that have been submitted, which follows the following profile: https://build.fhir.org/ig/HL7/fhir-medmorph/StructureDefinition-us-ph-reporting-bundle.html

Examples

This implementation requires an EHR and KA server loaded with data. Here is an example of the server to add

// KA Server Example
{
    "name": "MITRE Knowledge Artifact",
    "endpoint": "https://pathways.mitre.org:8550/fhir",
    "type": "KA",
    "clientId": "medmorph_backend"
}

// EHR Server Example
{
    "name": "MITRE EHR",
    "endpoint": "https://pathways.mitre.org:8440/fhir",
    "type": "EHR",
    "clientId": "medmorph_backend"
}

// PHA Server Example
{
    "name": "MITRE PHA",
    "endpoint": "https://pathways.mitre.org:8660/fhir",
    "type": "PHA",
    "clientId": "medmorph_backend"
}