awacke1's picture
Update app.py
c3415c5
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)