From cc23d830bf8880e75be8306b2ec8fadc78e92fda Mon Sep 17 00:00:00 2001 From: Lasse Studion Date: Tue, 28 Mar 2023 21:10:34 +0200 Subject: [PATCH] Minor fix --- app.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app.py b/app.py index 8271a5a..7bb3bf2 100644 --- a/app.py +++ b/app.py @@ -1,5 +1,4 @@ import requests -import json import tabula import re import streamlit as st @@ -10,8 +9,7 @@ def get_substance(x): s = re.search(r'\w+', l[-1]).group() return s.lower() -# Get the pdf with prescriptions from the user. - +# Title and explainer. st.title('Medicinkollen đŸ•”ïž') st.markdown(''' đŸ§‘â€âš•ïž *LĂ€kare ska ha koll pĂ„ dina recept sĂ„ att inga mediciner "krockar" men @@ -26,20 +24,23 @@ lĂ€kemedel du har.* varningar.* 😌 *Ingen information sparas i den hĂ€r tjĂ€nsten.* ''') + +# Get the pdf with prescriptions from the user. pdf = st.file_uploader(label='Ladda upp din lĂ€kemedelslista', type='pdf') if pdf: # Extract table from prescription pdf. - area = [111, 20, 528, 822] + area = [111, 20, 528, 822] # Coordinates for the corners (up, left, down, right). df = tabula.read_pdf(pdf, pages='all', area=area, lattice=True)[0] df.columns = ['UthĂ€mtat datum', 'UthĂ€mtat lĂ€kemedel', 'AnvĂ€ndning', 'Förskrivet av', 'UthĂ€mtad mĂ€ngd', 'LĂ€kemedelsgrupp'] df.dropna(axis=0, inplace=True) df['substance'] = df['UthĂ€mtat lĂ€kemedel'].apply(lambda x: get_substance(x)) - # Make list of precripted substances. + # Create list of precripted substances. substances = df.substance.tolist() + # Create list of substance ids. substances_id_list = [] for substance in substances: # Get data for the substance. @@ -54,13 +55,12 @@ if pdf: substances_id_url_list = '&nslIds='.join(substances_id_list) url = 'https://janusmed.se/interaktioner?nplIds=' + substances_id_url_list - # Show text with URL to janusmed. + # Show text with URL to janusmed.se. st.markdown(f''' :grey[*Följ [den hĂ€r lĂ€nken]({url}) för att se om dina lĂ€kemedel gĂ„r bra ihop eller om det kan finnas nĂ„got du skulle kunna prata med din lĂ€kare om. Nedan kan du se en förhandsvisning.*] ''') - # View janusmed.se in an iframe. - st.components.v1.iframe(url, height=600, scrolling=True) - + # Preview janusmed.se in an iframe. + st.components.v1.iframe(url, height=600, scrolling=True) \ No newline at end of file