Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/deploy-to-cloud-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy Streamlit App to GCP

on:
push:
paths:
- 'UI/**'
branches:
- feature/UI-deploy
- dev
- main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Check out the code
uses: actions/checkout@v2

- name: Set up Google Cloud authentication
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}

- name: Docker auth
run: |
gcloud auth configure-docker us-docker.pkg.dev --quiet

- name: Build Docker image
run: |
docker buildx build --platform linux/amd64 -f UI/Dockerfile -t us-docker.pkg.dev/medscript-437117/gcr.io/streamlit-app:latest UI

- name: Push Docker image to Google Artifact Registry
run: |
docker push us-docker.pkg.dev/medscript-437117/gcr.io/streamlit-app:latest

- name: Deploy to Cloud Run
run: |
gcloud run deploy streamlit-app \
--image us-docker.pkg.dev/medscript-437117/gcr.io/streamlit-app:latest \
--platform managed \
--region us-central1 \
--allow-unauthenticated
17 changes: 17 additions & 0 deletions UI/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Use a lightweight Python image
FROM python:3.9-slim

# Set the working directory
WORKDIR /app

# Copy the project files
COPY . /app

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Expose the default Streamlit port
EXPOSE 8080

# Run Streamlit
CMD ["streamlit", "run", "patient_form.py", "--server.port=8080", "--server.address=0.0.0.0", "--server.enableCORS=false"]
67 changes: 67 additions & 0 deletions UI/patient_form.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import streamlit as st

st.title("Welcome to MedScript")
# Streamlit application

st.markdown("<h1 style='font-size: 29px;'>Patient Information Submission Form</h1>", unsafe_allow_html=True)

st.markdown("""
Please fill out the form below with your details. Fields marked with an asterisk (*) are required.
""")

# Streamlit form
with st.form(key='patient_form'):
# Basic Information
st.header("Basic Information")
gender = st.selectbox("Gender*", ["Select", "Male", "Female", "Other"])
age = st.number_input("Age*", min_value=0, max_value=120, step=1)
height = st.number_input("Height (cm)*", min_value=0.0, step=0.1, format="%.1f")
weight = st.number_input("Weight (kg)*", min_value=0.0, step=0.1, format="%.1f")
blood_type = st.selectbox("Blood Type*", ["Select", "A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-"])

# Medical Details
st.header("Medical Details")
symptoms = st.text_area("Detailed Symptoms*", placeholder="Describe your symptoms in detail...")
severity = st.slider("Severity*", min_value=1, max_value=10, step=1, help="Rate the severity of your symptoms on a scale of 1 to 10.")
existing_conditions = st.text_area("Existing Medical Conditions", placeholder="List any pre-existing medical conditions...")
allergies = st.text_area("Allergies", placeholder="List any allergies...")
current_medications = st.text_area("Current Medications", placeholder="List any current medications...")

# Previous Visits
previous_visits = st.number_input("Number of Previous Visits*", min_value=0, step=1)

# Form Submission
submitted = st.form_submit_button("Submit")

# Confirmation on submission
if submitted:
if gender == "Select" or blood_type == "Select":
st.error("Please fill out all required fields correctly")
else:
st.success("Form submitted successfully!")
st.write("Here are the details you submitted:")
st.json({
"Gender": gender,
"Age": age,
"Height (cm)": height,
"Weight (kg)": weight,
"Blood Type": blood_type,
"Symptoms": symptoms,
"Severity": severity,
"Existing Medical Conditions": existing_conditions,
"Allergies": allergies,
"Current Medications": current_medications,
"Number of Previous Visits": previous_visits,
})


st.markdown("---")
st.header("Diagnostic Report")

# Button to view diagnostic report
if st.button("View Diagnostic Report"):
st.write("Diagnostic report is not yet available. Please contact your healthcare provider.")

st.subheader("Diagnosis")
primary_diagnosis = st.text_area("Primary Diagnosis", placeholder="Enter the primary diagnosis...", height=150)
differential_diagnosis = st.text_area("Differential Diagnosis", placeholder="Enter the differential diagnosis...", height=150)
1 change: 1 addition & 0 deletions UI/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
streamlit==1.24.0