Skip to content

Instantly share code, notes, and snippets.

@glow-mdsol
Created February 7, 2024 17:00
Show Gist options
  • Save glow-mdsol/79db960130bd69ef383f5ba17a029280 to your computer and use it in GitHub Desktop.
Save glow-mdsol/79db960130bd69ef383f5ba17a029280 to your computer and use it in GitHub Desktop.
Introduction to FSH
/*
Mary Doe is a 40 year female, who lives at 123 Main St, Anytown, 12345, US.
Her main contact phone number is 555-555-5555 and she has an email mary@sue.com
(she prefers to be contacted by email)
*/
Instance: MaryDoe
InstanceOf: Patient
* name
* given[+] = "Mary"
* family = "Doe"
* birthDate = "1982-02-12"
* gender = #female
* telecom[+]
* system = #phone
* value = "555-555-5555"
* use = #home
* rank = 2
* telecom[+]
* system = #email
* value = "mary@sue.com"
* use = #home
* rank = 1
* address[+]
* use = #home
* line[+] = "2222 Home Street"
* city = "Ann Arbor"
* state = "MI"
* postalCode = "48105"
* country = "USA"
/*
Create a Observation for Mary, who had a Sitting (SNOMED 33586001) BP (LOINC 85354-9)
measurement on Jan 4, 2024;
her SYSBP (LOINC 8480-6) was 135 mmHg and
her DIABP (LOINC 8462-4) was 67 mmHg
*/
Alias: $LOINC = http://loinc.org
Alias: $SCT = http://snomed.info/sct
Instance: BPMeasurement
InstanceOf: Observation
Usage: #example
* status = #final
* subject = Reference(Patient/MaryDoe)
* code = $LOINC#85354-9 "Blood pressure panel with all children optional"
* extension[+]
* url = "http://hl7.org/fhir/StructureDefinition/observation-bodyPosition"
* valueCodeableConcept = $SCT#33586001 "Sitting position"
* component[+]
* code = $LOINC#8480-6
* valueQuantity = 135 'mm[Hg]' "mmHg"
* component[+]
* code = $LOINC#8462-4
* valueQuantity = 67 'mm[Hg]' "mmHg"
/*
Create a Profile for the Patient Resource that supports a safe
Research Study usage; the following attributes should be removed
from the parent resource:
address
marital status
contact
*/
Profile: ResearchPatient
Parent: Patient
* address 0..0 MS
* maritalStatus 0..0 MS
* contact 0..0 MS
Instance: BadResearchPatient
InstanceOf: ResearchPatient
Description: "A non-conforming Research Patient"
Usage: #example
* name[+]
* given[+] = "Too"
* given[+] = "Much"
* family = "Information"
* birthDate = "1984-12-12"
* address[+]
* use = #home
* line[+] = "2222 Home Street"
* city = "Ann Arbor"
* state = "MI"
* postalCode = "48105"
* country = "USA"
* maritalStatus = #married
Instance: GoodResearchPatient
InstanceOf: ResearchPatient
Description: "A non-conforming Research Patient"
Usage: #example
* name[+]
* given[+] = "Just"
* given[+] = "Enough"
* family = "Information"
* birthDate = "1987-04-12"
Alias: $NCIT = http://purl.obolibrary.org/obo/ncit.owl
Alias: $ich-m11-trial-intervention-model-example-vs = http://ich-m11.example.org/fhir/CodeSystem/ich-m11-trial-intervention-model-example-vs
/*
Create a ValueSet for Intervention Model (ICH-M11):
Codes:
Single group = C2826346
Parallel group = C2826345
Cross-over = C0150097
Factorial = C2826344
Sequential = CL540470
Other
*/
ValueSet: M11TrialInterventionModelExample
Id: ich-m11-trial-intervention-model-example-vs
Title: "ICH M11 Trial Intervention Model"
Description: "The trial intervention model values."
* ^url = $ich-m11-trial-intervention-model-example-vs
* $NCIT#C2826346 "Single Group"
* $NCIT#C2826345 "Parallel Group"
* $NCIT#C0150097 "Cross-over"
* $NCIT#C2826344 "Factorial"
* $NCIT#CL540470 "Sequential"
* $NCIT#C17649 "Other"
/*
Create an extension for the ResearchStudy Resource to add the Trial Intervention Model using the name 'interventionModel'.
It should support 0 or 1 values and systems implementing the model must support this extension.
*/
Profile: M11ResearchStudy
Parent: ResearchStudy
Title: "ICH M11 Aligned Research Study"
Description: "Example showing extension for M11 Terms"
* extension contains
TrialInterventionModel named m11TrialInterventionModel 0..1 MS
Extension: TrialInterventionModel
Title: "ICH M11 Aligned Trial Intervention Model"
Description: "Annotate the ResearchStudy with the Trial Intervention Model."
* ^context[+].type = #element
* ^context[=].expression = "ResearchStudy"
* value[x] 1..1
* value[x] only code
* value[x] from M11TrialInterventionModelExample
Instance: SampleM11ResearchStudy
InstanceOf: M11ResearchStudy
Usage: #example
* status = #final
* extension[+][m11TrialInterventionModel].valueCode = #C2826346
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment