-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtempCodeRunnerFile.python
More file actions
65 lines (62 loc) · 1.83 KB
/
tempCodeRunnerFile.python
File metadata and controls
65 lines (62 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
r = {
"resourceType": "Procedure",
"id": "rehab",
"meta": {
"profile": [
"http://hl7.org/fhir/us/core/StructureDefinition/us-core-procedure"
],
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/instance-name",
"valueString": "Rehab Example"
},
{
"url": "http://hl7.org/fhir/StructureDefinition/instance-description",
"valueMarkdown": "This is a rehab example for the *US Core Procedure Profile*."
}
]
},
"basedOn": [
{
"reference": "ServiceRequest/rehab"
# "display": "Office Visit"
}
],
"status": "completed",
"code": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "24165007",
"display": "Alcoholism counseling",
"version": "http://snomed.info/sct/731000124108"
},
{
"system": "http://www.cms.gov/Medicare/Coding/ICD10",
"code": "HZ30ZZZ",
"display": "Individual Counseling for Substance Abuse Treatment, Cognitive"
}
],
"text": "Alcohol rehabilitation"
},
"subject": {
"reference": "Patient/example",
"display": "Amy Shaw"
},
"encounter": {
"reference": "Encounter/example-1",
"display": "Office Visit"
},
"occurrenceDateTime": "2002-05-23"
}
if r["resourceType"] == 'Procedure':
try:
my_display = r['basedOn'][0].pop('reference') # assumes display is present
except KeyError as e:
pass
else:
try:
r['basedOn'][0]['display']
except KeyError as e:
r['basedOn'][0]['display'] = my_display
print(r['basedOn'])