awacke1 commited on
Commit
084eda8
·
1 Parent(s): d8b595c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -44
app.py CHANGED
@@ -1,49 +1,11 @@
1
- import streamlit as st
2
- from fhirclient import client
3
- from fhirclient.models import *
4
  from fhiry.fhirsearch import Fhirsearch
5
 
6
- # Define the FHIR client
7
- settings = {
8
- 'app_id': 'my_web_app',
9
- 'api_base': 'http://hapi.fhir.org/baseR4'
10
- }
11
- smart = client.FHIRClient(settings=settings)
12
-
13
- # Define the FHIR search
14
- fs = Fhirsearch(fhir_base_url='http://hapi.fhir.org/baseR4')
15
-
16
- # Define the Streamlit app
17
- def app():
18
- # Create a text area for the HL7 message input
19
- hl7_input = st.text_area('Enter HL7 message', height=200)
20
 
21
- if st.button('Convert'):
22
- # Parse the HL7 message
23
- # Here you would need to implement your own parsing logic depending on your use case
24
- # For example, you could use the hl7apy library for parsing HL7 messages
25
- # and mapping the data elements to FHIR elements
26
- # This step is highly dependent on the structure and content of your HL7 messages
27
- # and requires careful consideration and testing
28
- # Here we assume that the HL7 message has already been parsed and mapped to FHIR elements
29
- patient = Patient()
30
- patient.name = [HumanName({'given': ['John'], 'family': 'Doe'})]
31
- patient.gender = 'male'
32
- patient.birthDate = '1990-01-01'
33
-
34
- # Save the FHIR resource to the server
35
- response = smart.create(patient)
36
-
37
- # Display the response
38
- st.write(response)
39
 
40
- # Search for a FHIR resource
41
- my_fhir_search_parameters = {
42
- "code": "http://snomed.info/sct|39065001",
43
- }
44
- df = fs.search(resource_type="Condition", search_parameters=my_fhir_search_parameters)
45
- st.write(df)
46
 
47
- # Run the Streamlit app
48
- if __name__ == '__main__':
49
- app()
 
 
 
 
1
  from fhiry.fhirsearch import Fhirsearch
2
 
3
+ fs = Fhirsearch(fhir_base_url = "http://fhir-server:8080/fhir")
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
+ my_fhir_search_parameters = {
6
+ "code": "http://snomed.info/sct|39065001",
7
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
+ df = fs.search(resource_type = "Condition", search_parameters = my_fhir_search_parameters)
 
 
 
 
 
10
 
11
+ print(df.info())