awacke1 commited on
Commit
c2b4ec7
Β·
0 Parent(s):

Duplicate from awacke1/Streamlit-AI-Letter-UI

Browse files
Files changed (4) hide show
  1. .gitattributes +34 -0
  2. README.md +14 -0
  3. app.py +131 -0
  4. license.txt +21 -0
.gitattributes ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tflite filter=lfs diff=lfs merge=lfs -text
29
+ *.tgz filter=lfs diff=lfs merge=lfs -text
30
+ *.wasm filter=lfs diff=lfs merge=lfs -text
31
+ *.xz filter=lfs diff=lfs merge=lfs -text
32
+ *.zip filter=lfs diff=lfs merge=lfs -text
33
+ *.zst filter=lfs diff=lfs merge=lfs -text
34
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Streamlit AI Letter UI
3
+ emoji: πŸ“‰
4
+ colorFrom: pink
5
+ colorTo: pink
6
+ sdk: streamlit
7
+ sdk_version: 1.19.0
8
+ app_file: app.py
9
+ pinned: false
10
+ license: mit
11
+ duplicated_from: awacke1/Streamlit-AI-Letter-UI
12
+ ---
13
+
14
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ # Set the page configuration to use the full width of the screen
4
+ st.set_page_config(layout="wide")
5
+
6
+ GALMIO=("""
7
+ | πŸ₯ **Letter Type** | πŸ“ **Definition** | πŸ“‹ **Data Fields** |
8
+ |-----------------------|-----------------------------------------|-----------------------------|
9
+ | 1️⃣ Referral Letters | 🀝 Letters asking for more help or treatment | πŸ“„ Patient info, Referral details |
10
+ | 2️⃣ Medical Certificate Letters | πŸ’Ό Letters about a patient's health problem or limits | πŸ“„ Patient info, Health problem details |
11
+ | 3️⃣ Prescription Letters | πŸ’Š Letters allowing medicine | πŸ“„ Patient info, Medicine details |
12
+ | 4️⃣ Diagnosis Letters | πŸ”Ž Letters explaining a patient's health problem | πŸ“„ Patient info, Health problem details |
13
+ | 5️⃣ Treatment Plan Letters | πŸš‘ Letters with a plan for getting better | πŸ“„ Patient info, Treatment details |
14
+ | 6️⃣ Surgery Recommendation Letters | πŸ₯ Letters saying a patient needs surgery | πŸ“„ Patient info, Surgery details |
15
+ | 7️⃣ Medical Clearance Letters | πŸƒ Letters saying a patient can do activities | πŸ“„ Patient info, Activity details |
16
+ | 8️⃣ Follow-up Appointment Letters | πŸ“… Letters reminding about appointments | πŸ“„ Patient info, Appointment details |
17
+ | 9️⃣ Disability Support Letters | β™Ώ Letters about a patient's disability | πŸ“„ Patient info, Disability details |
18
+ | πŸ”Ÿ Health Education Letters | 🍎 Letters teaching about health | πŸ“„ Patient info, Education topic |
19
+ """)
20
+
21
+ RL="""
22
+ ### 🀝 Referral Letters
23
+ | **Referral Letter** | πŸ“ **First** | πŸ“ **Middle** | πŸ“ **Last** |
24
+ |---------------------|------------------------------------|---------------------------------------|--------------------------------------|
25
+ | πŸ“¨ State the request for consultation/treatment | - Urgent need for further diagnostic testing for Mrs. Smith, who has persistent stomach issues 🀒 | - The patient has symptoms that suggest a more comprehensive review is required πŸ” | - Patient demographics, Referral details πŸ—‚οΈ |
26
+ | | - Request for an audiological assessment for Mr. Johnson, aged 60 πŸ‘‚ | - The patient's issue requires specialized care beyond the scope of the referring physician πŸ‘©β€βš•οΈ | - Diagnostic test reports, Medication details πŸ’Š |
27
+ """
28
+
29
+ MCL="""
30
+ ### πŸ“œ Medical Certificate Letters
31
+ | **Medical Certificate Letter** | πŸ“ **First** | πŸ“ **Middle** | πŸ“ **Last** |
32
+ |--------------------------------|------------------------------------|---------------------------------------|--------------------------------------|
33
+ | πŸ“¨ State the reason for certification | - To certify Mr. Brown's condition and advise on work restrictions πŸ’Ό | - Mr. Brown has suffered from a heart attack and is under medication πŸ’”πŸ’Š | - No driving should be allowed for 6 months πŸš«πŸš— |
34
+ | | - To certify Ms. Lee's health status for her impending travel ✈️ | - Ms. Lee has a chronic back pain condition that requires special accommodations during her travel πŸšΆβ€β™€οΈ | - Ms. Lee must have an aisle seat and use cushions for lumbar support πŸ›‹οΈ |
35
+ """
36
+
37
+ PL="""
38
+ ### πŸ’Š Prescription Letters
39
+ | **Prescription Letter** | πŸ“ **First** | πŸ“ **Middle** | πŸ“ **Last** |
40
+ |-------------------------|------------------------------------|---------------------------------------|--------------------------------------|
41
+ | πŸ“¨ Introduce prescription request | - Request for prescription for Mr. Clarke πŸ’Š | - Mr. Clarke requires medication for hypertension - Lisinopril 10mg BD with food 🩺 | - Medication details, allergies and any known side effects 🚫 |
42
+ | | - Prescription authorization for Mrs. Davis πŸ’Š | - Mrs. Davis is required to take two 500mg penicillin V tablets every 6 hours 🩺 | - Medication details, allergies and any known side effects 🚫 |
43
+ """
44
+
45
+ DL="""
46
+ ### πŸ”¬ Diagnosis Letters
47
+
48
+ | **Diagnosis Letter** | πŸ“ **First** | πŸ“ **Middle** | πŸ“ **Last** |
49
+ |----------------------|------------------------------------|---------------------------------------|--------------------------------------|
50
+ | πŸ“¨ State the diagnosis | - The results of Mr. Thompson's chest x-ray reveal Pneumonia 😷 | - Mr. Thompson has a bacterial infection that requires antibiotic treatment πŸ’Š | - Recommend follow-up visits for monitoring and periodic testing πŸ“† |
51
+ | | - The blood test results indicate that Mrs. Jones has Type 2 diabetes 🩸 | - Mrs. Jones has a lifelong condition that requires medication, dietary adjustments, and lifestyle changes πŸ½οΈπŸƒβ€β™€οΈ | - Refer patients to the relevant healthcare specialist πŸ‘©β€βš•οΈ |
52
+ """
53
+
54
+ TPL="""
55
+ ### 🩹 Treatment Plan Letters
56
+ | **Treatment Plan Letter** | πŸ“ **First** | πŸ“ **Middle** | πŸ“ **Last** |
57
+ |---------------------------|------------------------------------|---------------------------------------|--------------------------------------|
58
+ | πŸ“¨ Introduce treatment plan | - Outline treatment and testing plan for Mr. Smith πŸ“‹ | - Mr. Smith's treatment will involve IV medication and chest x-ray πŸ’‰πŸ“Έ | - Recommend follow-up visits for monitoring and periodic testing πŸ“† |
59
+ | | - Suggest handling chronic asthma for Mrs. White πŸ“‹ | - Mrs. White's asthma management plan requires frequent use of recommended inhaler and daily monitoring πŸŒ¬οΈπŸ“Š | - Provide contact information in case of any emergencies ☎️ |
60
+ """
61
+
62
+ SRL="""
63
+ ### πŸ₯ Surgery Recommendation Letters
64
+ | **Surgery Recommendation Letter** | πŸ“ **First** | πŸ“ **Middle** | πŸ“ **Last** |
65
+ |-----------------------------------|------------------------------------|---------------------------------------|--------------------------------------|
66
+ | πŸ“¨ Introduce surgical procedure | - Recommend endoscopy procedure for Mr. Baker πŸ”¬ | - Mr. Baker needs endoscopy for the diagnosis of GI tract abnormalities 🫁 | - Suggest to take extra measures regarding allergies or post-procedural appointments πŸš«βš•οΈ |
67
+ | | - Recommend an angiography for Mrs. Taylor πŸ’“ | - Mrs. Taylor needs angiography to locate any arterial blockages 🩺 | - Provide details on necessary pre and post-hospitalization guidance πŸ₯ |
68
+ """
69
+
70
+ MCL2="""
71
+ ### πŸƒβ€β™‚οΈ Medical Clearance Letters
72
+ | **Medical Clearance Letters** | πŸ“ **First** | πŸ“ **Middle** | πŸ“ **Last** |
73
+ |-------------------------------|------------------------------------|---------------------------------------|--------------------------------------|
74
+ | πŸ“¨ State clearance conditions | - Allow Mrs. Anderson to safely participate in a marathon πŸƒβ€β™€οΈ | - The patient has been tested and has no chronic medical conditions or injuries 🚫🩺 | - Encourage gradual progression and cautious approach to intense activity πŸ“ˆ |
75
+ | | - Clear Mr. White to begin strength training πŸ’ͺ | - The patient's prior conditions are monitored, and it is advised to begin any physical activity or routine πŸ‹οΈβ€β™‚οΈ | - List exercises that should be avoided, for instance, weightlifting for an individual with a heart condition 🚫❀️ |
76
+ """
77
+
78
+ FAL="""
79
+ ### πŸ“… Follow-up Appointment Letters
80
+ | **Follow-up Appointment Letters** | πŸ“ **First** | πŸ“ **Middle** | πŸ“ **Last** |
81
+ |-----------------------------------|------------------------------------|---------------------------------------|--------------------------------------|
82
+ | πŸ“¨ Remind of the appointment | - This is a reminder for Mrs. Rodriguez's appointment on Friday, 17th September, at 11:00 am πŸ“† | - Review the date, time, and location of appointment πŸ“ | - Provide contact information and phone numbers in case of schedule change or emergency ☎️ |
83
+ | | - This letter is to confirm Mr. Johnson's appointment on Monday, 20th September, at 1:00 pm πŸ“† | - Detail any necessary preparations for the appointment βš™οΈ | - Encourage to reach out if an appointment must be canceled, or if there are any questions or concerns βœ‰οΈ |
84
+ """
85
+
86
+ DSL="""
87
+ ### β™Ώ Disability Support Letters
88
+ | **Disability Support Letters** | πŸ“ **First** | πŸ“ **Middle** | πŸ“ **Last** |
89
+ |--------------------------------|------------------------------------|---------------------------------------|--------------------------------------|
90
+ | πŸ“¨ State the purpose of the letter | - The purpose of this letter is to validate Mr. Williams' disability so that he can receive disability benefits β™Ώ | - Detail the patient's physical or cognitive condition and how it affects their daily life 🧠 | - Outline the assistive equipment or technology necessary for the patient πŸ› οΈ |
91
+ | | - The purpose of this letter is to document Ms. Radcliff's disability to request special accommodations at work β™Ώ | - Explain the cause of the patient's condition and duration of symptoms ⏳ | - Describe the special consideration or modifications required πŸ“ |
92
+ """
93
+
94
+ HEL="""
95
+ ### 🍎 Health Education Letters
96
+ | **Health Education Letters** | πŸ“ **First** | πŸ“ **Middle** | πŸ“ **Last** |
97
+ |------------------------------|---------------------------------|------------------------------------|-----------------------------------|
98
+ | 🍎 Introduce the health education topic | - This letter is to provide Ms. Prince with information on healthy eating habits πŸ₯— | - Outline the benefits of specific health practices for overall health 🌟 | - Provide handouts, online resources, or any relevant materials to supplement the information πŸ“š |
99
+ | | - This letter offers suggestions for stress management to Mr. Martin 😌 | - Detail steps that can be taken to manage specific health conditions properly πŸšΆβ€β™€οΈ | - Encourage patients to schedule follow-up appointments to discuss any questions or concerns πŸ—“οΈ |
100
+ """
101
+
102
+ def generate_letter_menu_ui():
103
+
104
+ st.markdown("""## Generative AI Letters for Managing Information Overload (GAL-MIO) - πŸ₯ Letter Type Selection""")
105
+
106
+ # Define the letter types and their corresponding markdown sections
107
+ letter_types = {
108
+ "1️⃣ Referral Letters": RL,
109
+ "2️⃣ Medical Certificate Letters": MCL,
110
+ "3️⃣ Prescription Letters": PL,
111
+ "4️⃣ Diagnosis Letters": DL,
112
+ "5️⃣ Treatment Plan Letters": TPL,
113
+ "6️⃣ Surgery Recommendation Letters": SRL,
114
+ "7️⃣ Medical Clearance Letters": MCL2,
115
+ "8️⃣ Follow-up Appointment Letters": FAL,
116
+ "9️⃣ Disability Support Letters": DSL,
117
+ "πŸ”Ÿ Health Education Letters": HEL
118
+ }
119
+
120
+ # Create buttons for each letter type
121
+ for letter_type, section in letter_types.items():
122
+ if st.button(letter_type):
123
+ # Display the selected section of the markdown content
124
+ st.markdown(section, unsafe_allow_html=True)
125
+
126
+ # Run the Streamlit UI function
127
+ generate_letter_menu_ui()
128
+
129
+ st.markdown(GALMIO)
130
+
131
+
license.txt ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) Aaron Wacker.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE