File size: 1,668 Bytes
9e375e4
 
 
 
 
 
 
 
c3415c5
9e375e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e985a0d
 
 
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
import streamlit as st
import fhirclient.models.observation as o
import fhirclient.models.codeableconcept as cc

# LOINC code for the assessment of blood pressure
LOINC_CODE = "85354-9"

# Display the assessment form
st.header("SMART FHIR Assessment of Blood Pressure")
systolic_bp = st.number_input("Systolic Blood Pressure")
diastolic_bp = st.number_input("Diastolic Blood Pressure")

# Create the SMART/FHIR Observation
bp_observation = o.Observation()
bp_observation.code = cc.CodeableConcept()
bp_observation.code.coding = [
    {
        "system": "http://loinc.org",
        "code": LOINC_CODE,
        "display": "Blood pressure panel"
    }
]
bp_observation.component = [
    {
        "code": {
            "coding": [
                {
                    "system": "http://loinc.org",
                    "code": "8480-6",
                    "display": "Systolic blood pressure"
                }
            ]
        },
        "valueQuantity": {
            "value": systolic_bp,
            "unit": "mmHg",
            "system": "http://unitsofmeasure.org",
            "code": "mm[Hg]"
        }
    },
    {
        "code": {
            "coding": [
                {
                    "system": "http://loinc.org",
                    "code": "8462-4",
                    "display": "Diastolic blood pressure"
                }
            ]
        },
        "valueQuantity": {
            "value": diastolic_bp,
            "unit": "mmHg",
            "system": "http://unitsofmeasure.org",
            "code": "mm[Hg]"
        }
    }
]

# Display the observation JSON
#st.write(bp_observation.as_json())

st.write(bp_observation.component)