File size: 2,704 Bytes
957da96
585de43
d37ee95
671e0d4
957da96
0f96a44
 
 
 
 
 
 
 
 
 
 
 
 
 
585de43
8dbd7f7
 
 
 
 
 
 
 
585de43
671e0d4
 
 
 
585de43
957da96
 
8dbd7f7
 
 
 
 
 
 
 
 
 
 
957da96
8dbd7f7
585de43
671e0d4
 
8dbd7f7
 
 
671e0d4
 
8dbd7f7
 
 
 
 
 
 
671e0d4
8dbd7f7
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
import pandas as pd
import plotly.express as px
import streamlit as st
import jsonlines

st.markdown("""
| πŸ“ #Definition | πŸ“‹ Data Fields |
| --- | --- |
| 🀝 asking for more help or #treatment | πŸ“„ Patient info, Referral details |
| πŸ’Ό about a patient's health #problem or #limits | πŸ“„ Patient info, Health #problem details |
| πŸ’Š allowing medicine | πŸ“„ Patient info, #Medicine #details |
| πŸ”Ž explaining a #patient's health #problem | πŸ“„ Patient info, Health #problem details |
| πŸš‘ plan for getting better | πŸ“„ Patient info, #Treatment details |
| πŸ₯ patient needs surgery | πŸ“„ Patient info, #Surgery details |
| πŸƒ patient can do activities | πŸ“„ Patient info, #Activity details |
| πŸ“… reminding about appointments | πŸ“„ Patient info, #Appointment details |
| β™Ώ patient's disability | πŸ“„ Patient info, #Disability details |
| 🍎 teaching about health | πŸ“„ Patient info, #Education topic |
""")
# Create a DataFrame with CPT codes, procedures, and expected costs
import pandas as pd
import plotly.graph_objects as go
import streamlit as st
import jsonlines
import base64
from datetime import datetime

# Create a DataFrame with Code types, values, descriptions, and expected costs
data = {
    'Code Type': ['CPT', 'SNOMED', 'RXNORM', 'DEA', 'LOINC', 'ORI', 'ORU', 'CCD'],
    'Code Value': ['99201', 'A-12345', 'R-12345', 'D-12345', 'L-12345', 'O-12345', 'U-12345', 'C-12345'],
    'Code Description': ['Office/Outpatient Visit', 'Inpatient Consultation', 'Initial Hospital Care', 'Subsequent Hospital Care', 'Critical Care Services', 'Procedure 6', 'Procedure 7', 'Procedure 8'],
    'Expected Cost': [100, 200, 150, 250, 300, 350, 400, 450]
}
df = pd.DataFrame(data)

# Create a sunburst plot with Plotly
fig = go.Figure(go.Sunburst(
    labels=df['Code Type'],
    parents=['']*len(df),
    values=df['Expected Cost'],
    text=df['Code Description'],
    hoverinfo="label+value+text",
    branchvalues="total",
))

fig.update_layout(margin=dict(t=0, l=0, r=0, b=0))

# Display the sunburst plot in Streamlit
st.plotly_chart(fig)

# Save DataFrame to JSONL file
timestamp = datetime.now().strftime("%Y%m%d%H%M%S")
filename = f"output_{timestamp}.jsonl"
with jsonlines.open(filename, mode='w') as writer:
    writer.write(df.to_dict(orient='records'))

# Function to create a download link
def create_download_link(filename):
    with open(filename, 'r') as file:
        data = file.read()
    b64 = base64.b64encode(data.encode()).decode()
    return f'<a href="data:file/txt;base64,{b64}" download="{filename}">Download data as JSONL</a>'

# Display a link to download the JSONL file
st.markdown(create_download_link(filename), unsafe_allow_html=True)