RFID / app.py
yougandar's picture
Update app.py
e507469 verified
import streamlit as st
import pandas as pd
# Sample data for RFID information
data = {
"Tag ID": [1, 2, 3, 4, 5],
"Breed": ["Gir", "Hf", "Jersey", "Sahiwal", "Rati"],
"Age": [3, 4, 2, 5, 3],
"Health History": [
["Surgery", "2 Reproduction Cycles", "Healthy"],
["Surgery", "3 Reproduction Cycles", "Injured"],
["No Surgery", "1 Reproduction Cycle", "Healthy"],
["Surgery", "5 Reproduction Cycles", "Healthy"],
["No Surgery", "2 Reproduction Cycles", "Injured"]
]
}
# Convert the data to a pandas DataFrame
df = pd.DataFrame(data)
# Function to display the RFID details when selected
def display_rfid_info(tag_id):
# Filter the data by the selected RFID tag ID
cow_info = df[df['Tag ID'] == tag_id].iloc[0]
# Display the RFID details in the Streamlit dashboard
st.subheader(f"Details for RFID Tag ID: {tag_id}")
st.write(f"**Breed**: {cow_info['Breed']}")
st.write(f"**Age**: {cow_info['Age']} years")
# Health History display
st.write("**Health History**:")
for history in cow_info['Health History']:
st.checkbox(history, value=True)
# Streamlit Dashboard Layout
def app():
st.title("RFID Cattle Health Dashboard")
# Create a selection dropdown for RFID Tag ID
tag_id = st.selectbox("Select RFID Tag ID", df['Tag ID'].tolist())
# Display the information of the selected RFID tag ID
display_rfid_info(tag_id)
if __name__ == '__main__':
app()