Skip to main content

Resource without Referential Integrity

Start with the minimum definition, referencing your FHIR Profiles.

Instance: DisabilityConditionSummary
InstanceOf: PatientConditionSummary
Usage: #example
Description: "Example of an Disability assistance summary as a FHIR DocumentReference with HTML narrative content only"
* meta.profile = Canonical(PatientConditionSummary)
* meta.versionId = "0.0.1"

Run Sushi to establish the mandatory attributes, derived from the profile.

See also the Health API Mock to generate examples, these can be reverse engineered back into your example FSH.

To create the patient from my example

curl -X POST -H "Content-Type: application/fhir+json" -d "$(curl -s https://ig.opennz.org/Patient-ZHI0010.json)" http://localhost:8080/fhir/Patient

Subject

The next step is add a subject, i.e. the Patient, this will enforce referential integrity

* subject = Reference(Patient/1198)

Once you apply a subject reference, if you do not have a corresponding example for your reference, the example will generate, but your QA report will register an error, e.g. Unable to resolve resource with reference 'Patient/1198'. To overcome this, you can create a minimum instance of the reference.

Instance: 1198
InstanceOf: Patient
Description: "Example Patient with Disability Assistance Needs"
Usage: #example
* meta.profile = Canonical(Patient)
* id = "1198"

to create a resource without referential integrity, i.e. the subject is in another system, simple exclude the Reference.

// form a Patient reference to both a logical (NHI) resource and and a local literal resource
* subject.type = "Patient"
* subject.identifier.use = #official
* subject.identifier.system = "https://standards.digital.health.nz/ns/nhi-id"
* subject.identifier.value = "SCF12345678"
* subject.display = "Marieke Christabel"