awacke1 commited on
Commit
9e375e4
·
1 Parent(s): 3387b55

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +61 -0
app.py ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import fhirclient.models.observation as o
3
+ import fhirclient.models.codeableconcept as cc
4
+
5
+ # LOINC code for the assessment of blood pressure
6
+ LOINC_CODE = "85354-9"
7
+
8
+ # Display the assessment form
9
+ st.header("Assessment of Blood Pressure")
10
+ systolic_bp = st.number_input("Systolic Blood Pressure")
11
+ diastolic_bp = st.number_input("Diastolic Blood Pressure")
12
+
13
+ # Create the SMART/FHIR Observation
14
+ bp_observation = o.Observation()
15
+ bp_observation.code = cc.CodeableConcept()
16
+ bp_observation.code.coding = [
17
+ {
18
+ "system": "http://loinc.org",
19
+ "code": LOINC_CODE,
20
+ "display": "Blood pressure panel"
21
+ }
22
+ ]
23
+ bp_observation.component = [
24
+ {
25
+ "code": {
26
+ "coding": [
27
+ {
28
+ "system": "http://loinc.org",
29
+ "code": "8480-6",
30
+ "display": "Systolic blood pressure"
31
+ }
32
+ ]
33
+ },
34
+ "valueQuantity": {
35
+ "value": systolic_bp,
36
+ "unit": "mmHg",
37
+ "system": "http://unitsofmeasure.org",
38
+ "code": "mm[Hg]"
39
+ }
40
+ },
41
+ {
42
+ "code": {
43
+ "coding": [
44
+ {
45
+ "system": "http://loinc.org",
46
+ "code": "8462-4",
47
+ "display": "Diastolic blood pressure"
48
+ }
49
+ ]
50
+ },
51
+ "valueQuantity": {
52
+ "value": diastolic_bp,
53
+ "unit": "mmHg",
54
+ "system": "http://unitsofmeasure.org",
55
+ "code": "mm[Hg]"
56
+ }
57
+ }
58
+ ]
59
+
60
+ # Display the observation JSON
61
+ st.write(bp_observation.as_json())