Skip to content

Commit

Permalink
Vivid Substanzen
Browse files Browse the repository at this point in the history
  • Loading branch information
franasal committed Apr 28, 2022
1 parent 26f5c19 commit c06eb33
Show file tree
Hide file tree
Showing 11 changed files with 407 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .streamlit/config.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[theme]
base="dark"
primaryColor="#FF4BBD"
backgroundColor="#283243"
secondaryBackgroundColor="#5b5e73"
primaryColor="#1D95D4" # selection color of highlighted
backgroundColor="#131313" #main background 2C3845
secondaryBackgroundColor="#D70E55" # sidebar and highliths 1D95D4 blue 1D95D4
# base="dark"
# primaryColor="#2d5fa2"
# backgroundColor="#22304e"
Expand Down
Binary file added data/logo_lang.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
247 changes: 247 additions & 0 deletions data/substances.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion de_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def main():
chart_placeholder.pyplot(plt, use_container_width=True)


foot = f'#### {lab_names["__foot"]} [<img src="https://pbs.twimg.com/media/FGE5sFPX0AY6TtV?format=png&name=small" alt="drawing" width="50"/>](https://mybrainmychoice.de/) [<img src="https://pbs.twimg.com/media/FGGjxH-XIAc101E?format=jpg&name=small" alt="drawing" width="50"/>](https://youthrise.org/) & [<img src="https://pbs.twimg.com/profile_images/1396102254487384065/ZjD8GvMw_400x400.png" alt="drawing" width="50"/> ViewsOnDrugs](https://twitter.com/ViewsOnDrugsBot/)'
foot = f'#### {lab_names["__foot"]} [<img src="https://pbs.twimg.com/media/FGE5sFPX0AY6TtV?format=png&name=small" alt="drawing" width="50"/>](https://mybrainmychoice.de/) [<img src="https://vivid-hamburg.de/wp-content/uploads/2020/05/logo_lang.jpg" alt="drawing" width="200"/>](https://vivid-hamburg.de/) [<img src="https://pbs.twimg.com/profile_images/1396102254487384065/ZjD8GvMw_400x400.png" alt="drawing" width="50"/>](https://twitter.com/ViewsOnDrugsBot/)'
st.markdown(foot, unsafe_allow_html=True)

if __name__ == "__main__":
Expand Down
14 changes: 14 additions & 0 deletions de_disclaimer.py
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)
113 changes: 113 additions & 0 deletions de_substances.py
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)
2 changes: 1 addition & 1 deletion en_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def main():
chart_placeholder.pyplot(plt, use_container_width=True)


foot = f'#### {lab_names["__foot"]} [<img src="https://pbs.twimg.com/media/FGE5sFPX0AY6TtV?format=png&name=small" alt="drawing" width="50"/>](https://mybrainmychoice.de/) [<img src="https://pbs.twimg.com/media/FGGjxH-XIAc101E?format=jpg&name=small" alt="drawing" width="50"/>](https://youthrise.org/) & [<img src="https://pbs.twimg.com/profile_images/1396102254487384065/ZjD8GvMw_400x400.png" alt="drawing" width="50"/> ViewsOnDrugs](https://twitter.com/ViewsOnDrugsBot/)'
foot = f'#### {lab_names["__foot"]} [<img src="https://pbs.twimg.com/media/FGE5sFPX0AY6TtV?format=png&name=small" alt="drawing" width="50"/>](https://mybrainmychoice.de/) [<img src="https://vivid-hamburg.de/wp-content/uploads/2020/05/logo_lang.jpg" alt="drawing" width="200"/>](https://vivid-hamburg.de/) & [<img src="https://pbs.twimg.com/profile_images/1396102254487384065/ZjD8GvMw_400x400.png" alt="drawing" width="50"/>](https://twitter.com/ViewsOnDrugsBot/)'
st.markdown(foot, unsafe_allow_html=True)

if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion es_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def main():
chart_placeholder.pyplot(plt, use_container_width=True)


foot = f'#### {lab_names["__foot"]} [<img src="https://pbs.twimg.com/media/FGE5sFPX0AY6TtV?format=png&name=small" alt="drawing" width="50"/>](https://mybrainmychoice.de/) [<img src="https://pbs.twimg.com/media/FGGjxH-XIAc101E?format=jpg&name=small" alt="drawing" width="50"/>](https://youthrise.org/) & [<img src="https://pbs.twimg.com/profile_images/1396102254487384065/ZjD8GvMw_400x400.png" alt="drawing" width="50"/> ViewsOnDrugs](https://twitter.com/ViewsOnDrugsBot/)'
foot = f'#### {lab_names["__foot"]} [<img src="https://pbs.twimg.com/media/FGE5sFPX0AY6TtV?format=png&name=small" alt="drawing" width="50"/>](https://mybrainmychoice.de/) [<img src="https://vivid-hamburg.de/wp-content/uploads/2020/05/logo_lang.jpg" alt="drawing" width="200"/>](https://vivid-hamburg.de/) & [<img src="https://pbs.twimg.com/profile_images/1396102254487384065/ZjD8GvMw_400x400.png" alt="drawing" width="50"/>](https://twitter.com/ViewsOnDrugsBot/)'
st.markdown(foot, unsafe_allow_html=True)

if __name__ == "__main__":
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ six==1.16.0
tenacity==8.0.1
openpyxl
matplotlib
streamlit_option_menu
34 changes: 26 additions & 8 deletions streamlit_app.py
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()
Empty file added style.css
Empty file.

0 comments on commit c06eb33

Please sign in to comment.