Generating and Formatting FHIR Resources
Generating and Formatting FHIR Resources
- Create a series of FHIR resources for the dataset. Exactly how you generate these FHIR Resources matters less than what its final output should look like: an .ndjson file in which each line represents one instance of a FHIR Resource. For example, using FHIR R5 Patient as a reference:
{“resourceType”: “Patient”, “id”: “a”, “name”: “Bob Smith”, “gender”: “male”},
{“resourceType”: “Patient”, “id”: “b”, “name”: “Jane Smith”, “gender”: “female”},
Field requirements
- The required field at present for submission into FHIR-Aggregator is the presence of a ‘part-of-study’ extension field. Even if the resource doesn’t have any fields that are extensions according to the FHIR website, the resource, no matter what it is should have the following at minimum:
“extension”: [“url”: “http://fhir-aggregator.org/fhir/StructureDefinition/part-of-study", "valueReference": {"reference": "ResearchStudy/<research-study-identifier-here. This must map to ResearchStudy’s identifier>"}}]
- Every other field for each resource outside of gimme fields like “resourceType” is up to your discretion. Does your dataset have data that could fit some field in some resource? If so, try to include it for the sake of greater detail.
- The minimum list of Resources we’d like to have for each dataset that is contributed to FHIR-Aggregator is the following:
- Patient
- Specimen
- ResearchStudy
- ResearchSubject
- DocumentReference
-
Group
-
While not required, utilizing the fhir.resources Python library is helpful as it automatically validates each FHIR resource generated by your Python program for correctness with respect to the FHIR Standard’s implementation of x field for y Resource. This validation is helpful in catching errors before attempting to upload to FHIR-Aggregator, and a forthcoming step uses fhir.resources to validate submissions to the uploader.
Uploading FHIR Resources to FHIR-Aggregator
- Upload the FHIRized .ndjsons to FHIR-Aggregator. You’ll do this using the submission GitHub repo. Submission does several validations (and some transformations) of the FHIR Resources inside of your .ndjson input. More instructions are available there.