-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
407 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
import streamlit as st | ||
|
||
|
||
|
||
def main(): | ||
|
||
st.write("Die Informationen auf diesem Flyer sind nicht als Konsumempfehlung gedacht. Sie wurden sorgfältig zusammengestellt, können aber nur einen ersten Anhaltspunkt für eigene Nachforschungen bilden. Konsumerfahrungen und Risiken sind individuell. Sie können von den genannten Informationen abweichen.") | ||
|
||
|
||
_,footcol, _ = st.columns(3) | ||
with footcol: | ||
foot = f' [<img src="https://vivid-hamburg.de/wp-content/uploads/2020/05/logo_lang.jpg" alt="drawing" width="400"/>](https://vivid-hamburg.de/)' | ||
st.markdown(foot, unsafe_allow_html=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
import pandas as pd | ||
import streamlit as st | ||
import os | ||
import json | ||
|
||
|
||
def local_css(file_name): | ||
with open(file_name) as f: | ||
st.markdown('<style>{}</style>'.format(f.read()), unsafe_allow_html=True) | ||
|
||
local_css("style.css") | ||
|
||
def load_data(): | ||
path_ = "./data" | ||
|
||
with open(os.path.join(path_, "substances.json"), 'r') as fp: | ||
substance_dic = json.load(fp) | ||
|
||
subs_dict = substance_dic.copy() | ||
|
||
for subs in list(subs_dict.keys()): | ||
subs_dict[subs]["comment"]=subs_dict[subs]["Dosierung"]["comment"] | ||
subs_dict[subs]["Dosierung"].pop('comment', None) | ||
subs_dict[subs]["dose_df"] = pd.DataFrame.from_dict(subs_dict[subs]["Dosierung"]) | ||
subs_dict[subs]["wirkdauer_df"] = pd.DataFrame.from_dict(subs_dict[subs]["Wirkdauer"]) | ||
return subs_dict | ||
|
||
subs_dict = load_data() | ||
def main(): | ||
drug_list = tuple(subs_dict.keys()) | ||
|
||
st.write("##") | ||
|
||
|
||
col1, _, col2 = st.columns(3) | ||
|
||
|
||
|
||
with col1: | ||
substance = st.selectbox("Wählt ein Substanz aus", drug_list) | ||
with col2: | ||
st.markdown(f"# {subs_dict[substance]['Substanz']}") | ||
|
||
|
||
st.info(f"### {subs_dict[substance]['Beschreibung']}") | ||
|
||
col3, col4 = st.columns(2) | ||
|
||
with col3: | ||
|
||
st.markdown(f"### {'Dosierung'}") | ||
st.dataframe(subs_dict[substance]["dose_df"]) | ||
|
||
with col4: | ||
|
||
st.markdown(f"### {'Wirkdauer'}") | ||
st.dataframe(subs_dict[substance]["wirkdauer_df"]) | ||
|
||
st.markdown(f"#### {subs_dict[substance]['comment']}") | ||
|
||
st.markdown("---") | ||
col5, col6 = st.columns(2) | ||
|
||
|
||
var_text = subs_dict[substance]["Konsumform"] | ||
|
||
with col5: | ||
st.markdown(f"### **Konsumform:**") | ||
st.markdown(f"#### {var_text.capitalize()}") | ||
var_text = subs_dict[substance]["Erscheinungsform"] | ||
with col6: | ||
st.markdown(f"### **Erscheinungsform:**") | ||
st.markdown(f"#### {var_text.capitalize()}") | ||
# st.info(f"##### {var_text}") | ||
|
||
|
||
|
||
st.markdown("---") | ||
st.markdown("#### Wirkung") | ||
col_pos, col_neut, col_neg, = st.columns(3) | ||
|
||
with col_pos: | ||
st.markdown(f'#### {subs_dict[substance]["Wirkung"].split(";")[0]}') | ||
with col_neut: | ||
st.markdown(f'#### {subs_dict[substance]["Wirkung"].split(";")[1]}') | ||
with col_neg: | ||
st.markdown(f'#### {subs_dict[substance]["Wirkung"].split(";")[2]}') | ||
|
||
st.markdown("---") | ||
st.markdown("#### Kombinationen:") | ||
st.text("") | ||
col_pos_, col_neut_, col_neg_, = st.columns(3) | ||
|
||
with col_pos_: | ||
st.markdown(f'#### {subs_dict[substance]["Kombinationen"].split(";")[0]}') | ||
with col_neut_: | ||
st.markdown(f'#### {subs_dict[substance]["Kombinationen"].split(";")[1]}') | ||
with col_neg_: | ||
st.markdown(f'#### {subs_dict[substance]["Kombinationen"].split(";")[2]}') | ||
|
||
st.markdown("---") | ||
for var in list(subs_dict[substance].keys()): | ||
if var in ["Toleranz","VIVID Safer-Use Tipps",]: | ||
var_text = subs_dict[substance][var] | ||
|
||
st.markdown(f"#### {var}:") | ||
st.markdown(f"##### {var_text}") | ||
|
||
|
||
_,footcol, _ = st.columns(3) | ||
with footcol: | ||
foot = f' [<img src="https://vivid-hamburg.de/wp-content/uploads/2020/05/logo_lang.jpg" alt="drawing" width="400"/>](https://vivid-hamburg.de/)' | ||
st.markdown(foot, unsafe_allow_html=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ six==1.16.0 | |
tenacity==8.0.1 | ||
openpyxl | ||
matplotlib | ||
streamlit_option_menu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,46 @@ | ||
|
||
import streamlit as st | ||
from streamlit_option_menu import option_menu | ||
|
||
|
||
st.set_page_config( | ||
page_title="Drug Risks / Riesgos de las Drogas", | ||
page_title="Vivid Substanzen", | ||
page_icon="https://pbs.twimg.com/profile_images/1396102254487384065/ZjD8GvMw_400x400.png", | ||
layout="wide", #centered wide | ||
initial_sidebar_state="expanded", | ||
menu_items={ | ||
'Get Help': 'https://github.com/franasal/MCDA-drug-harms', | ||
'Report a bug': "https://github.com/franasal/MCDA-drug-harms", | ||
'About': "**App Author: [Francisco Arcila](https://twitter.com/franarsal/)** \n\nConcept design: Philine Edbauer, Francisco Arcila. \n\nTranslations: Philine Edbauer, Lukas Basedow." | ||
'About': "**App Author: [Francisco Arcila](https://twitter.com/franarsal/)** \n\nConcept design: Francisco Arcila." | ||
} | ||
) | ||
|
||
#app.py | ||
import en_app, es_app, de_app | ||
import en_app, es_app, de_app, de_substances, de_disclaimer | ||
|
||
PAGES = { | ||
"English": en_app, | ||
"Español": es_app, | ||
"Deutsch": de_app, | ||
"Substanzen": de_substances, | ||
"MCDA Drugs": en_app, | ||
"Disclaimer": de_disclaimer, | ||
} | ||
vod_icon=' <img src="https://pbs.twimg.com/profile_images/1396102254487384065/ZjD8GvMw_400x400.png" alt="drawing" width="50"/> -Know your Drugs- <img src="https://pbs.twimg.com/media/E1_0586WQAYCNym?format=png&name=small" alt="drawing" width="50"/>' | ||
|
||
|
||
|
||
vod_icon='[<img src="https://vivid-hamburg.de/wp-content/uploads/2020/05/logo_lang.jpg" alt="centered image" class="center" width="300"/>](https://vivid-hamburg.de/)' | ||
st.sidebar.markdown(vod_icon, unsafe_allow_html=True) | ||
selection = st.sidebar.radio("",list(PAGES.keys())) | ||
# | ||
title_alignment= ' <div style="text-align: center"> -Know your Drugs- </div> ' | ||
# | ||
st.sidebar.markdown(title_alignment, unsafe_allow_html=True) | ||
|
||
with st.sidebar: | ||
selection = option_menu("", list(PAGES.keys()), | ||
icons=['file-earmark-text','bar-chart-line', 'info-circle'], menu_icon="cast", default_index=0, | ||
styles={ | ||
"nav-link": {"font-size": "16px", "text-align": "left", "margin":"0px"}, | ||
"nav-link-selected": {"background-color": "ffffff"}, | ||
}) | ||
|
||
# selection = st.sidebar.radio("",list(PAGES.keys())) | ||
page = PAGES[selection] | ||
page.main() |