Skip to content

Commit

Permalink
Merge pull request #260 from bashir2/examples
Browse files Browse the repository at this point in the history
Added EncounterFlat and ConditionFlat examples
  • Loading branch information
johngrimes authored Oct 11, 2024
2 parents 84b3b25 + 9af8ec3 commit ecffb3d
Showing 1 changed file with 100 additions and 0 deletions.
100 changes: 100 additions & 0 deletions input/fsh/examples.fsh
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,103 @@ Usage: #example
* path = "value.ofType(Quantity).value"
* where[+]
* path = "code.coding.exists(system='http://loinc.org' and code=%bp_code)"

Instance: ConditionFlat
InstanceOf: ViewDefinition
Description: """A simple view for flattening a Condition resource. Some of the
more commonly used fields are included in this flat view. A notable point
is flattening of `category.coding` fields with one `forEach` construct as
FHIRPath will take care of handling of nested arrays."""
Usage: #example
* name = "condition_flat"
* status = #draft
* resource = #Condition
* select[+]
* column[+]
* path = "getResourceKey()"
* name = "id"
* column[+]
* path = "subject.getReferenceKey(Patient)"
* name = "patient_id"
* column[+]
* path = "encounter.getReferenceKey(Encounter)"
* name = "encounter_id"
* column[+]
* path = "onset.ofType(dateTime)"
* name = "onset_datetime"
* type = "dateTime"
* select[+]
* forEachOrNull = "code.coding"
* column[+]
* name = "system"
* path = "system"
* type = "uri"
* column[+]
* path = "code"
* name = "code"
* select[+]
* forEachOrNull = "category.coding"
* column[+]
* path = "code"
* name = "category"
* select[+]
* forEachOrNull = "clinicalStatus.coding"
* column[+]
* path = "code"
* name = "clinical_status"
* select[+]
* forEachOrNull = "verificationStatus.coding"
* column[+]
* path = "code"
* name = "verification_status"

Instance: EncounterFlat
InstanceOf: ViewDefinition
Description: """A simple view for flattening an Encounter resource. Some of the
more commonly used fields are included in this flat view. Note this is valid
for an R4 Encounter resource but not R5 (hence the `fhirVersion`)."""
Usage: #example
* name = "encounter_flat"
* status = #draft
* resource = #Encounter
* fhirVersion[+] = #4.0
* select[+]
* column[+]
* path = "getResourceKey()"
* name = "id"
* column[+]
* path = "status"
* name = "status"
* column[+]
* path = "subject.getReferenceKey(Patient)"
* name = "patient_id"
* column[+]
* path = "serviceProvider.getReferenceKey(Organization)"
* name = "service_org_id"
* column[+]
* path = "period.start"
* name = "period_start"
* column[+]
* path = "period.end"
* name = "period_end"
* column[+]
* path = "episodeOfCare.getReferenceKey(EpisodeOfCare)"
* name = "EpisodeOfCareId"
* select[+]
* forEachOrNull = "type.coding"
* column[+]
* path = "system"
* name = "type_sys"
* column[+]
* path = "code"
* name = "type_code"
* select[+]
* forEachOrNull = "participant"
* column[+]
* path = "individual.getReferenceKey(Practitioner)"
* name = "practitioner_id"
* select[+]
* forEachOrNull = "location"
* column[+]
* path = "location.getReferenceKey(Location)"
* name = "location_id"

0 comments on commit ecffb3d

Please sign in to comment.