|
import streamlit as st |
|
import streamlit.components.v1 as components |
|
import networkx as nx |
|
import matplotlib.pyplot as plt |
|
from pyvis.network import Network |
|
import got |
|
import numpy as np |
|
import pandas as pd |
|
import time |
|
import re |
|
import graphviz as graphviz |
|
import pydeck as pdk |
|
|
|
from st_click_detector import click_detector |
|
|
|
st.graphviz_chart(''' |
|
digraph { |
|
PR0001INCOME -> AbleToBuyOnlyNecessities |
|
PR0001INCOME -> DifficultyBuyingNecessities |
|
PR0001INCOME -> DifficultyWithMoneyManagement |
|
PR0001INCOME -> LowNoIncome |
|
PR0001INCOME -> UninsuredMedicalExpenses |
|
} |
|
''') |
|
|
|
st.graphviz_chart(''' |
|
digraph { |
|
PR0001INCOME -> Continuityof -> Care |
|
PR0001INCOME -> Durable -> Medical -> Equipment |
|
PR0001INCOME -> Finances |
|
PR0001INCOME -> LegalSystem |
|
PR0001INCOME -> Medical -> Dental -> Care |
|
PR0001INCOME -> Medication -> Coordination -> Ordering |
|
PR0001INCOME -> Other -> Community -> Resources |
|
PR0001INCOME -> SocialWork -> Counseling -> Care |
|
PR0001INCOME -> Supplies |
|
} |
|
''') |
|
|
|
st.graphviz_chart(''' |
|
digraph { |
|
PR0012MENTALHEALTH -> Apprehension -> Undefined -> Fear -> Anxious |
|
PR0012MENTALHEALTH -> Attempts -> Suicide -> Homicide |
|
PR0012MENTALHEALTH -> Difficulty -> Managing -> Anger |
|
PR0012MENTALHEALTH -> Difficulty -> Managing -> Stress |
|
PR0012MENTALHEALTH -> Expresses -> Suicidal -> Homicidal -> Thoughts |
|
PR0012MENTALHEALTH -> False -> Beliefs -> Delusions |
|
PR0012MENTALHEALTH -> False -> Perceptions -> Hallucinations -> Illusions |
|
PR0012MENTALHEALTH -> FlatAffect -> LackofEmotion |
|
PR0012MENTALHEALTH -> Irritable -> Agitated -> Aggressive |
|
PR0012MENTALHEALTH -> LossofInterest -> Involvementin -> ActivitiesSelfCare |
|
PR0012MENTALHEALTH -> MoodSwings |
|
PR0012MENTALHEALTH -> Narrowedto -> Scattered -> Attention -> Focus |
|
PR0012MENTALHEALTH -> Purposeless -> Compulsive -> RepetitiveActivity |
|
PR0012MENTALHEALTH -> Sadness -> Hopelessness -> Decreased -> SelfEsteem |
|
PR0012MENTALHEALTH -> Somatic -> Complaints -> Fatigue |
|
} |
|
''') |
|
|
|
st.graphviz_chart(''' |
|
digraph { |
|
PR0012MENTALHEALTH -> Anger -> Management |
|
PR0012MENTALHEALTH -> Behavioral -> Health -> Care |
|
PR0012MENTALHEALTH -> Communication |
|
PR0012MENTALHEALTH -> Continuityof -> Care |
|
PR0012MENTALHEALTH -> Coping -> Skills |
|
PR0012MENTALHEALTH -> Dietary -> Management |
|
PR0012MENTALHEALTH -> Discipline |
|
PR0012MENTALHEALTH -> EndofLife -> Care |
|
PR0012MENTALHEALTH -> Interaction |
|
PR0012MENTALHEALTH -> LegalSystem |
|
PR0012MENTALHEALTH -> Medical -> Dental -> Care |
|
PR0012MENTALHEALTH -> Medication -> ActionSideEffects |
|
PR0012MENTALHEALTH -> Medication -> Administration |
|
PR0012MENTALHEALTH -> Medication -> CoordinationOrdering |
|
PR0012MENTALHEALTH -> Nursing -> Care |
|
PR0012MENTALHEALTH -> Nutritionist -> Care |
|
PR0012MENTALHEALTH -> Other -> Community -> Resources |
|
PR0012MENTALHEALTH -> Relaxation -> Breathing -> Techniques |
|
PR0012MENTALHEALTH -> Rest -> Sleep |
|
PR0012MENTALHEALTH -> Safety |
|
PR0012MENTALHEALTH -> Screening -> Procedures |
|
PR0012MENTALHEALTH -> SignsSymptoms -> MentalEmotional |
|
PR0012MENTALHEALTH -> SignsSymptoms -> Physical |
|
PR0012MENTALHEALTH -> SocialWork -> Counseling -> Care |
|
PR0012MENTALHEALTH -> Stress -> Management |
|
PR0012MENTALHEALTH -> Support -> Group |
|
PR0012MENTALHEALTH -> Support -> System |
|
PR0012MENTALHEALTH -> Wellness |
|
} |
|
''') |
|
|
|
|
|
st.graphviz_chart(''' |
|
digraph { |
|
PR0028RESPIRATION -> Abnormal -> BreathSoundsCrackles |
|
PR0028RESPIRATION -> Abnormal -> IrregularBreathPatterns |
|
PR0028RESPIRATION -> Abnormal -> RespiratoryLaboratoryResults |
|
PR0028RESPIRATION -> Abnormal -> Sputum |
|
PR0028RESPIRATION -> Cough |
|
PR0028RESPIRATION -> Noisy -> RespirationswheezingRalesRhonchi |
|
PR0028RESPIRATION -> Rhinorrhea -> NasalCongestion |
|
PR0028RESPIRATION -> UnabletoBreathe -> Independently |
|
} |
|
''') |
|
|
|
st.graphviz_chart(''' |
|
digraph { |
|
PR0028RESPIRATION -> Anatomy -> Physiology |
|
PR0028RESPIRATION -> Continuityof -> Care |
|
PR0028RESPIRATION -> Coping -> Skills |
|
PR0028RESPIRATION -> Dietary -> Management |
|
PR0028RESPIRATION -> Durable -> Medical -> Equipment |
|
PR0028RESPIRATION -> Education |
|
PR0028RESPIRATION -> EndofLife -> Care |
|
PR0028RESPIRATION -> Environment |
|
PR0028RESPIRATION -> Exercises |
|
PR0028RESPIRATION -> Infection -> Precautions |
|
PR0028RESPIRATION -> Laboratory -> Findings |
|
PR0028RESPIRATION -> Medical -> Dental -> Care |
|
PR0028RESPIRATION -> Medication -> Action -> SideEffects |
|
PR0028RESPIRATION -> Medication -> Administration |
|
PR0028RESPIRATION -> Medication -> Prescription |
|
PR0028RESPIRATION -> Medication -> SetUp |
|
PR0028RESPIRATION -> Mobility -> Transfers |
|
PR0028RESPIRATION -> Nursing -> Care |
|
PR0028RESPIRATION -> Positioning |
|
PR0028RESPIRATION -> Relaxation -> Breathing -> Techniques |
|
PR0028RESPIRATION -> Respiratory -> Care |
|
PR0028RESPIRATION -> Respiratory -> Therapy -> Care |
|
PR0028RESPIRATION -> Safety |
|
PR0028RESPIRATION -> Screening -> Procedures |
|
PR0028RESPIRATION -> SignsSymptoms -> MentalEmotional |
|
PR0028RESPIRATION -> SignsSymptoms -> Physical |
|
PR0028RESPIRATION -> Specimen -> Collection |
|
PR0028RESPIRATION -> Supplies |
|
PR0028RESPIRATION -> Support -> Group |
|
PR0028RESPIRATION -> Support -> System |
|
PR0028RESPIRATION -> Wellness |
|
} |
|
''') |
|
|
|
|
|
st.graphviz_chart(''' |
|
digraph { |
|
PR0029CIRCULATION -> Abnormal -> BloodPressureReading |
|
PR0029CIRCULATION -> Abnormal -> CardiacLaboratoryResults |
|
PR0029CIRCULATION -> Abnormal -> Clotting |
|
PR0029CIRCULATION -> Abnormal -> HeartSoundsMurmurs |
|
PR0029CIRCULATION -> Anginal -> Pain |
|
PR0029CIRCULATION -> Cramping -> Pain -> ofExtremities |
|
PR0029CIRCULATION -> Decreased -> Pulses |
|
PR0029CIRCULATION -> Discoloration -> ofSkinCyanosis |
|
PR0029CIRCULATION -> EdemaSwelling -> inlegsarmsfeet |
|
PR0029CIRCULATION -> ExcessivelyRapid -> HeartRate |
|
PR0029CIRCULATION -> IrregularHeartRate |
|
PR0029CIRCULATION -> SyncopalEpisodes -> Fainting -> Dizziness |
|
PR0029CIRCULATION -> TemperatureChange -> inAffectedArea |
|
PR0029CIRCULATION -> Varicosities |
|
} |
|
''') |
|
|
|
st.graphviz_chart(''' |
|
digraph { |
|
PR0029CIRCULATION -> Anatomy -> Physiology |
|
PR0029CIRCULATION -> Cardiac -> Care |
|
PR0029CIRCULATION -> Continuityof -> Care |
|
PR0029CIRCULATION -> Coping -> Skills |
|
PR0029CIRCULATION -> Dietary -> Management |
|
PR0029CIRCULATION -> Durable -> Medical -> Equipment |
|
PR0029CIRCULATION -> Exercises |
|
PR0029CIRCULATION -> Finances |
|
PR0029CIRCULATION -> Infection -> Precautions |
|
PR0029CIRCULATION -> Laboratory -> Findings |
|
PR0029CIRCULATION -> Medical -> Dental -> Care |
|
PR0029CIRCULATION -> Medication -> Action -> SideEffects |
|
PR0029CIRCULATION -> Medication -> Administration |
|
PR0029CIRCULATION -> Medication -> SetUp |
|
PR0029CIRCULATION -> Mobility -> Transfers |
|
PR0029CIRCULATION -> Nursing -> Care |
|
PR0029CIRCULATION -> Personal -> Hygiene |
|
PR0029CIRCULATION -> Relaxation -> Breathing -> Techniques |
|
PR0029CIRCULATION -> Safety |
|
PR0029CIRCULATION -> Screening -> Procedures |
|
PR0029CIRCULATION -> SignsSymptoms -> MentalEmotional |
|
PR0029CIRCULATION -> SignsSymptoms -> Physical |
|
PR0029CIRCULATION -> Support -> Group |
|
PR0029CIRCULATION -> Support -> System |
|
PR0029CIRCULATION -> Wellness |
|
} |
|
''') |
|
|
|
df = pd.read_csv("testfile.csv") |
|
@st.cache |
|
def convert_df(df): |
|
return df.to_csv().encode('utf-8') |
|
csv = convert_df(df) |
|
st.download_button( |
|
"Press to Download", |
|
csv, |
|
"testfile.csv", |
|
"text/csv", |
|
key='download-csv' |
|
) |
|
|
|
|
|
st.title('Streamlit Visualization') |
|
dataframe = pd.DataFrame(np.random.randn(10, 20), |
|
columns = ('col %d' % i |
|
for i in range(20))) |
|
st.write(dataframe) |
|
|
|
dataframe = pd.DataFrame(np.random.randn(10, 5), |
|
columns = ('col %d' % i |
|
for i in range(5))) |
|
dataframe |
|
st.write('This is a line_chart.') |
|
st.line_chart(dataframe) |
|
|
|
st.write('This is a area_chart.') |
|
st.area_chart(dataframe) |
|
|
|
st.write('This is a bar_chart.') |
|
st.bar_chart(dataframe) |
|
|
|
st.write('Map data') |
|
data_of_map = pd.DataFrame( |
|
np.random.randn(1000, 2) / [60, 60] + [36.66, -121.6], |
|
columns = ['latitude', 'longitude']) |
|
st.map(data_of_map) |
|
|
|
|
|
st.title('Pyvis VisJS DOTlang Legend') |
|
|
|
Network(notebook=True) |
|
|
|
|
|
def net_repr_html(self): |
|
nodes, edges, height, width, options = self.get_network_data() |
|
html = self.template.render(height=height, width=width, nodes=nodes, edges=edges, options=options) |
|
return html |
|
|
|
Network._repr_html_ = net_repr_html |
|
|
|
st.sidebar.title('Choose your favorite Graph') |
|
option=st.sidebar.selectbox('select graph',('Simple','Karate', 'GOT')) |
|
physics=st.sidebar.checkbox('add physics interactivity?') |
|
got.simple_func(physics) |
|
|
|
if option=='Simple': |
|
HtmlFile = open("test.html", 'r', encoding='utf-8') |
|
source_code = HtmlFile.read() |
|
components.html(source_code, height = 900,width=900) |
|
|
|
got.got_func(physics) |
|
|
|
if option=='GOT': |
|
HtmlFile = open("gameofthrones.html", 'r', encoding='utf-8') |
|
source_code = HtmlFile.read() |
|
components.html(source_code, height = 1200,width=1000) |
|
|
|
got.karate_func(physics) |
|
|
|
if option=='Karate': |
|
HtmlFile = open("karate.html", 'r', encoding='utf-8') |
|
source_code = HtmlFile.read() |
|
components.html(source_code, height = 1200,width=1000) |