-
Notifications
You must be signed in to change notification settings - Fork 3
/
test_fhir_observation_v1.py
80 lines (78 loc) · 1.99 KB
/
test_fhir_observation_v1.py
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import json
from src.medprompt import *
def test_fhir_observation_v1(f):
fhir_obs = '''
{
"resourceType": "Observation",
"id": "f001",
"identifier": [
{
"use": "official",
"system": "http://www.bmc.nl/zorgportal/identifiers/observations",
"value": "6323"
}
],
"status": "final",
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "15074-8",
"display": "Glucose [Moles/volume] in Blood"
}
]
},
"subject": {
"reference": "Patient/f001",
"display": "P. van de Heuvel"
},
"effectiveDateTime": "2013-04-02T09:30:10+01:00",
"issued": "2013-04-03T15:30:10+01:00",
"performer": [
{
"reference": "Practitioner/f005",
"display": "A. Langeveld"
}
],
"valueQuantity": {
"value": 6.3,
"unit": "mmol/l",
"system": "http://unitsofmeasure.org",
"code": "mmol/L"
},
"interpretation": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation",
"code": "H",
"display": "High"
}
]
}
],
"referenceRange": [
{
"low": {
"value": 3.1,
"unit": "mmol/l",
"system": "http://unitsofmeasure.org",
"code": "mmol/L"
},
"high": {
"value": 6.2,
"unit": "mmol/l",
"system": "http://unitsofmeasure.org",
"code": "mmol/L"
}
}
]
}
'''
f.set_template(
template_name="observation_v1.jinja")
input_object = json.loads(fhir_obs)
input_object["time_diff"] = get_time_diff_from_today
prompt = f.generate_prompt(input_object)
print (prompt)
assert prompt is not None