Skip to content

Instantly share code, notes, and snippets.

@jmandel
Last active March 25, 2020 19:36
Show Gist options
  • Save jmandel/41f47088085cf4633506b43438925389 to your computer and use it in GitHub Desktop.
Save jmandel/41f47088085cf4633506b43438925389 to your computer and use it in GitHub Desktop.
Example Locations, Groups for tracking beds (work in progress)
example.pypf
Example measure report (pseudo-yaml-pseydo-FHIR)(TM)
----
resourceType: MeasureReport
status: complete
type: summary (??)
measure: https://audaciousinquiry.github.io/saner-ig/Measure/bed-availability-measure
date: today
period: start/end can be "yesterday" (e.g., `2020-03-24`)
reporter: Organization by FHIR id
group[0 -- I think we only ever need one, even though this repeats]
// unclear if we really need this code: display: "Bed Report"
description: "Report of bed status for Hospita A, for 2020-03-24
measureScore: total bed capacity (# of bed-type Locations in Hospital A), say 250
stratifier:
stratum[0]
measureScore: 27
component[0] ==
code {
"system": "http://hl7.org/fhir/R4/StructureDefinition/Location",
"code": "Location.status"
}
value {
"system": "http://hl7.org/fhir/ValueSet/location-status",
"code": "active",
"display": "The location is operational."
}
component[1] ==
code {
"system": "http://hl7.org/fhir/R4/StructureDefinition/Location",
"code": "Location.operationalStatus"
}
value {
"system": "http://terminology.hl7.org/CodeSystem/v2-0116",
"code": "U",
"display": "Unoccupied"
}
component[2] ==
code {
"system": "http://hl7.org/fhir/R4/StructureDefinition/Location",
"code": "Location.type"
}
value {
"system": "http://terminology.hl7.org/CodeSystem/v3-RoleCode",
"code": "ICU",
"display": "Intensive care unit"
}
component[3] ==
code {
"system": "http://hl7.org/fhir/R4/StructureDefinition/Location",
"code": "Location.Feature"
}
value {
"system": "http://ainq.com/fhir/us/saner/CodeSystem/SanerBedType",
"code": "NONISO",
"display": "Non-isolating unit"
}
component[4] ==
code {
"system": "http://hl7.org/fhir/R4/StructureDefinition/Location",
"code": "Location.partOf"
}
valueCodeableConcept {
(!!! warning, this is a hack. Might use an extension.valueReference intead)
"system": https://audaciousinquiry.github.io/saner-ig/bed-location
"code": "Location/hospital-a-ward-1"
}
stratum[1] just like stratum[0] but operationalStatus = Occupied
stratum[2] just like stratum[0] but type=ED
stratum[3] just like stratum[0] but type=Hospital
stratum[4] just like stratum[0] but operationalStatus = Occupied, type=ED
stratum[5] just like stratum[0] but operationalStatus = Occupied, type=Hospital
stratum[6] just like stratum[0] but Feature = Isolating
stratum[7] just like stratum[1] but Feature = Isolating
stratum[8] just like stratum[2] but Feature = Isolating
stratum[9] just like stratum[3] but Feature = Isolating
stratum[10] just like stratum[4] but Feature = Isolating
stratum[11] just like stratum[5] but Feature = Isolating
## Notes
* Can report "leaf-level" strata (pinning down all variables as components) when available, and can roll up values into coarser-grained strata if the detailed sub-counts aren't known
* Keeps semantics of an entire report together, and handles reporting periods cleanly
* No good way to convey a stratifier component for valueReferences; the whole mechanism is focused on CodeableConcepts, but we can "hack it" (As proposed here) or use an extension.valueReference, or we use distinction top-level MeasureReport.groups per-ward.
{
"resourceType": "Bundle",
"type": "batch",
"entry": [
{
"fullUrl": "urn:example:org-hospital-a",
"resource": {
"resourceType": "Organization",
"active": true,
"name": "Sample Hospital A Organization",
"identifier": [
{
"system": "http://hl7.org/fhir/sid/us-npi",
"value": "123456789"
}
],
"address": {
"postalCode": "53706"
}
}
},
{
"fullUrl": "urn:example:hospital-a-ward-1",
"resource": {
"resourceType": "Location",
"name": "Sample Hospital A, Ward 1",
"managingOrganization": {
"reference": "urn:example:org-hospital-a"
},
"position": {
"longitude": 43.1096496,
"latitude": -89.4906477
},
"address": {
"postalCode": "53706"
}
}
},
{
"fullUrl": "urn:example:beds-in-hospital-a",
"resource": {
"resourceType": "Group",
"type": "device",
"actual": true,
"name": "Active, Unoccupied, Non-isolating ICU Beds in Hospital A Ward 1",
"quantity": 20,
"code": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "bd"
}
]
},
"managingEntity": {
"identifier": {
"system": "http://hl7.org/fhir/sid/us-npi",
"value": "123456789"
},
"reference": "urn:example:org-hospital-a",
"_comment_jcm": "https://github.com/AudaciousInquiry/saner-ig/issues/14"
},
"characteristic": [
{
"exclude": false,
"_comment_jcm": "https://github.com/AudaciousInquiry/saner-ig/issues/13",
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/R4/StructureDefinition/Location",
"code": "Location.status"
}
]
},
"valueCodeableConcept": {
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/ValueSet/location-status",
"code": "active",
"display": "The location is operational."
}
]
}
}
},
{
"exclude": false,
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/R4/StructureDefinition/Location",
"code": "Location.operationalStatus"
}
]
},
"valueCodeableConcept": {
"code": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0116",
"code": "U",
"display": "Unoccupied"
}
]
}
}
},
{
"exclude": false,
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/R4/StructureDefinition/Location",
"code": "Location.type"
}
]
},
"valueCodeableConcept": {
"code": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-RoleCode",
"code": "ICU",
"display": "Intensive care unit"
}
]
}
}
},
{
"exclude": false,
"_comment_jcm": "https://github.com/AudaciousInquiry/saner-ig/issues/15",
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/R4/StructureDefinition/Location",
"code": "Location.Feature"
}
]
},
"valueCodeableConcept": {
"code": {
"coding": [
{
"system": "http://ainq.com/fhir/us/saner/CodeSystem/SanerBedType",
"code": "NONISO",
"display": "Non-isolating unit"
}
]
}
}
},
{
"exclude": false,
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/R4/StructureDefinition/Location",
"code": "Location.partOf"
}
]
},
"valueReference": {
"reference": "urn:example:hospital-a"
}
}
]
}
}
]
}
{
"resourceType": "Bundle",
"type": "batch",
"entry": [
{
"fullUrl": "urn:example:hospital-a",
"resource": {
"resourceType": "Location",
"name": "Sample Hospital A",
"position": {
"longitude": 43.1096496,
"latitude": -89.4906477
},
"address": {
"postalCode": "53706"
}
}
},
{
"fullUrl": "urn:example:hospital-a-ward-1",
"resource": {
"resourceType": "Location",
"name": "Sample Hospital A, Ward 1",
"partOf": {
"reference": "urn:example:hospital-a"
},
"location": {
"longitude": 43.1096496,
"latitude": -89.4906477
},
"address": {
"postalCode": "53706"
}
}
},
{
"fullUrl": "urn:example:beds-in-hospital-a",
"resource": {
"resourceType": "Group",
"type": "device",
"actual": true,
"quantity": 20,
"characteristic": [
{
"code": {
"coding": [
{
"system": "http://example.terminology",
"code": "available-bed-type"
}
]
},
"valueCodeableConcept": {
"code": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-RoleCode",
"code": "ICU",
"display": "Intensive care unit"
}
]
}
}
},
{
"code": {
"coding": [
{
"system": "http://example.terminology",
"code": "available-bed-location"
}
]
},
"valueReference": {
"reference": "urn:example:hospital-a"
}
}
]
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment