File size: 1,248 Bytes
13492c4
 
 
975946e
13492c4
975946e
 
13492c4
 
975946e
13492c4
 
975946e
 
 
 
 
 
 
 
13492c4
 
975946e
13492c4
975946e
 
 
13492c4
975946e
 
13492c4
975946e
 
13492c4
975946e
 
 
13492c4
975946e
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import streamlit as st
import pandas as pd

# Function to parse the uploaded roster file
def parse_roster(file):
    df = pd.read_excel(file, engine='openpyxl')
    st.write("File read successfully. Columns in the file:", df.columns)
    return df

# Function to generate the yearly roster
def generate_yearly_roster(df):
    nurses = df['NAMES'].unique()
    roles = df['RANK'].unique()
    
    # Your logic to generate the yearly roster goes here
    yearly_roster = df.copy()  # Placeholder for demonstration
    
    return yearly_roster

# Streamlit app setup
st.title("Nurse Duty Roster Generator")

uploaded_file = st.file_uploader("Upload the current roster file", type=["xlsx"])

if uploaded_file is not None:
    try:
        current_roster = parse_roster(uploaded_file)
        one_year_roster = generate_yearly_roster(current_roster)
        
        st.write("Generated Yearly Roster:")
        st.dataframe(one_year_roster)
        
        # Allow download of the generated roster
        st.download_button(
            label="Download Yearly Roster",
            data=one_year_roster.to_excel(index=False),
            file_name="yearly_roster.xlsx"
        )
    except Exception as e:
        st.error(f"An error occurred: {e}")