| import streamlit as st |
| import pandas as pd |
| import numpy as np |
| import matplotlib.pyplot as plt |
| import seaborn as sns |
|
|
| |
| cow_breeds = ['Girolando', 'Jersey', 'Holstein Friesian (HF)', 'Sahiwal', 'Kankrej', 'Gir / Gyr', 'Red Sindhi'] |
|
|
| |
| tag_ids = [i for i in range(1, 8)] |
|
|
| |
| days = pd.date_range(start='2025-04-01', periods=4, freq='D') |
|
|
| |
| data = { |
| 'Tag ID': [tag_ids[i % 7] for i in range(28)], |
| 'Cow Breed': [cow_breeds[i % 7] for i in range(28)], |
| 'Date': np.tile(days, 7), |
| 'Milk Yield (L)': [round(np.random.uniform(10, 22), 2) for _ in range(28)], |
| 'Fat %': [round(np.random.uniform(3, 6), 2) for _ in range(28)], |
| 'SNF': [round(np.random.uniform(8, 12), 2) for _ in range(28)], |
| 'Conductivity (mS/cm)': [round(np.random.uniform(4, 7), 2) for _ in range(28)], |
| } |
|
|
| df = pd.DataFrame(data) |
|
|
| |
| pivot_df = df.pivot(index='Date', columns='Cow Breed', values=['Milk Yield (L)', 'Fat %', 'SNF', 'Conductivity (mS/cm)']) |
|
|
| |
| st.title('Milk Unit Simulator Dashboard') |
|
|
| |
| st.subheader('Master Data Link') |
| st.markdown('[Click here to view the Master Data](https://yougandar-mastersheetcows.hf.space/?embed=true&embed_options=show_toolbar#92ef4034)') |
|
|
| |
| st.subheader('Cow Milk Data (Day-wise for 7 Cows)') |
| st.dataframe(pivot_df) |
|
|
| |
| st.subheader('Day-wise Milk Yield Trend for Each Cow') |
| plt.figure(figsize=(10, 6)) |
| sns.lineplot(data=df, x='Date', y='Milk Yield (L)', hue='Cow Breed', marker='o') |
| plt.title('Milk Yield Trend (Day-wise for Each Cow)') |
| plt.xlabel('Date') |
| plt.ylabel('Milk Yield (L)') |
| plt.xticks(rotation=45) |
| st.pyplot() |
|
|
| st.subheader('Day-wise Fat % Trend for Each Cow') |
| plt.figure(figsize=(10, 6)) |
| sns.lineplot(data=df, x='Date', y='Fat %', hue='Cow Breed', marker='o') |
| plt.title('Fat % Trend (Day-wise for Each Cow)') |
| plt.xlabel('Date') |
| plt.ylabel('Fat %') |
| plt.xticks(rotation=45) |
| st.pyplot() |
|
|
| st.subheader('Day-wise SNF Trend for Each Cow') |
| plt.figure(figsize=(10, 6)) |
| sns.lineplot(data=df, x='Date', y='SNF', hue='Cow Breed', marker='o') |
| plt.title('SNF Trend (Day-wise for Each Cow)') |
| plt.xlabel('Date') |
| plt.ylabel('SNF') |
| plt.xticks(rotation=45) |
| st.pyplot() |
|
|
| st.subheader('Day-wise Conductivity Trend for Each Cow') |
| plt.figure(figsize=(10, 6)) |
| sns.lineplot(data=df, x='Date', y='Conductivity (mS/cm)', hue='Cow Breed', marker='o') |
| plt.title('Conductivity Trend (Day-wise for Each Cow)') |
| plt.xlabel('Date') |
| plt.ylabel('Conductivity (mS/cm)') |
| plt.xticks(rotation=45) |
| st.pyplot() |
|
|