saurav384 commited on
Commit
1fbfeb6
·
verified ·
1 Parent(s): e3226af

Upload 14 files

Browse files
.streamlit/secrets.toml ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ EMAIL = "sauravkhengar07@gmail.com"
2
+ APP_PASSWORD = "hayrjkxcetxoxber"
Medical_Inventory_Model/.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
Medical_Inventory_Model/README.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Medical Inventory Model
3
+ emoji: 🏃
4
+ colorFrom: yellow
5
+ colorTo: green
6
+ sdk: gradio
7
+ sdk_version: 6.2.0
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
Medical_Inventory_Software/.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
Medical_Inventory_Software/README.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Medical Inventory Software
3
+ emoji: 🌖
4
+ colorFrom: indigo
5
+ colorTo: red
6
+ sdk: gradio
7
+ sdk_version: 6.2.0
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
csvclean.ipynb ADDED
@@ -0,0 +1,667 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 47,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "import numpy as np\n",
10
+ "import pandas as pd\n",
11
+ "import matplotlib.pyplot as plt\n",
12
+ "import seaborn as sns\n",
13
+ "import json\n",
14
+ "\n",
15
+ "import warnings\n",
16
+ "warnings.filterwarnings('ignore')"
17
+ ]
18
+ },
19
+ {
20
+ "cell_type": "markdown",
21
+ "metadata": {},
22
+ "source": [
23
+ "need = Medicine_Name\n",
24
+ "Category\n",
25
+ "Batch_No\n",
26
+ "Stock_Quantity\n",
27
+ "Monthly_Sales\n",
28
+ "Expiry_Date\n",
29
+ "Purchase_Date\n",
30
+ "Supplier"
31
+ ]
32
+ },
33
+ {
34
+ "cell_type": "code",
35
+ "execution_count": 48,
36
+ "metadata": {},
37
+ "outputs": [],
38
+ "source": [
39
+ "#I generate data using faker library "
40
+ ]
41
+ },
42
+ {
43
+ "cell_type": "code",
44
+ "execution_count": 49,
45
+ "metadata": {},
46
+ "outputs": [],
47
+ "source": [
48
+ "data = pd.read_csv(\"data/data.csv\")"
49
+ ]
50
+ },
51
+ {
52
+ "cell_type": "code",
53
+ "execution_count": 50,
54
+ "metadata": {},
55
+ "outputs": [
56
+ {
57
+ "data": {
58
+ "text/plain": [
59
+ "Medicine_Name 12\n",
60
+ "Category 7\n",
61
+ "Batch_No 9576\n",
62
+ "Stock_Quantity 491\n",
63
+ "Monthly_Sales 196\n",
64
+ "Expiry_Date 1347\n",
65
+ "Purchase_Date 731\n",
66
+ "Supplier 6\n",
67
+ "dtype: int64"
68
+ ]
69
+ },
70
+ "execution_count": 50,
71
+ "metadata": {},
72
+ "output_type": "execute_result"
73
+ }
74
+ ],
75
+ "source": [
76
+ "data.nunique()"
77
+ ]
78
+ },
79
+ {
80
+ "cell_type": "code",
81
+ "execution_count": 51,
82
+ "metadata": {},
83
+ "outputs": [
84
+ {
85
+ "data": {
86
+ "text/plain": [
87
+ "(10000, 8)"
88
+ ]
89
+ },
90
+ "execution_count": 51,
91
+ "metadata": {},
92
+ "output_type": "execute_result"
93
+ }
94
+ ],
95
+ "source": [
96
+ "data.shape"
97
+ ]
98
+ },
99
+ {
100
+ "cell_type": "code",
101
+ "execution_count": 52,
102
+ "metadata": {},
103
+ "outputs": [
104
+ {
105
+ "name": "stdout",
106
+ "output_type": "stream",
107
+ "text": [
108
+ "<class 'pandas.core.frame.DataFrame'>\n",
109
+ "RangeIndex: 10000 entries, 0 to 9999\n",
110
+ "Data columns (total 8 columns):\n",
111
+ " # Column Non-Null Count Dtype \n",
112
+ "--- ------ -------------- ----- \n",
113
+ " 0 Medicine_Name 10000 non-null object\n",
114
+ " 1 Category 10000 non-null object\n",
115
+ " 2 Batch_No 10000 non-null object\n",
116
+ " 3 Stock_Quantity 10000 non-null int64 \n",
117
+ " 4 Monthly_Sales 10000 non-null int64 \n",
118
+ " 5 Expiry_Date 10000 non-null object\n",
119
+ " 6 Purchase_Date 10000 non-null object\n",
120
+ " 7 Supplier 10000 non-null object\n",
121
+ "dtypes: int64(2), object(6)\n",
122
+ "memory usage: 625.1+ KB\n"
123
+ ]
124
+ }
125
+ ],
126
+ "source": [
127
+ "data.info()"
128
+ ]
129
+ },
130
+ {
131
+ "cell_type": "code",
132
+ "execution_count": 53,
133
+ "metadata": {},
134
+ "outputs": [],
135
+ "source": [
136
+ "import datetime\n",
137
+ "data[\"Expiry_Date\"] = pd.to_datetime(data[\"Expiry_Date\"])\n",
138
+ "data[\"Purchase_Date\"] = pd.to_datetime(data[\"Purchase_Date\"])"
139
+ ]
140
+ },
141
+ {
142
+ "cell_type": "code",
143
+ "execution_count": 54,
144
+ "metadata": {},
145
+ "outputs": [
146
+ {
147
+ "name": "stdout",
148
+ "output_type": "stream",
149
+ "text": [
150
+ "<class 'pandas.core.frame.DataFrame'>\n",
151
+ "RangeIndex: 10000 entries, 0 to 9999\n",
152
+ "Data columns (total 8 columns):\n",
153
+ " # Column Non-Null Count Dtype \n",
154
+ "--- ------ -------------- ----- \n",
155
+ " 0 Medicine_Name 10000 non-null object \n",
156
+ " 1 Category 10000 non-null object \n",
157
+ " 2 Batch_No 10000 non-null object \n",
158
+ " 3 Stock_Quantity 10000 non-null int64 \n",
159
+ " 4 Monthly_Sales 10000 non-null int64 \n",
160
+ " 5 Expiry_Date 10000 non-null datetime64[ns]\n",
161
+ " 6 Purchase_Date 10000 non-null datetime64[ns]\n",
162
+ " 7 Supplier 10000 non-null object \n",
163
+ "dtypes: datetime64[ns](2), int64(2), object(4)\n",
164
+ "memory usage: 625.1+ KB\n"
165
+ ]
166
+ }
167
+ ],
168
+ "source": [
169
+ "data.info()"
170
+ ]
171
+ },
172
+ {
173
+ "cell_type": "code",
174
+ "execution_count": 55,
175
+ "metadata": {},
176
+ "outputs": [],
177
+ "source": [
178
+ "cat_col = [col for col in data.columns if data[col].dtype ==\"object\"]\n",
179
+ "num_col = [col for col in data.columns if data[col].dtype !=\"object\"]"
180
+ ]
181
+ },
182
+ {
183
+ "cell_type": "code",
184
+ "execution_count": 56,
185
+ "metadata": {},
186
+ "outputs": [
187
+ {
188
+ "data": {
189
+ "text/plain": [
190
+ "['Medicine_Name', 'Category', 'Batch_No', 'Supplier']"
191
+ ]
192
+ },
193
+ "execution_count": 56,
194
+ "metadata": {},
195
+ "output_type": "execute_result"
196
+ }
197
+ ],
198
+ "source": [
199
+ "cat_col"
200
+ ]
201
+ },
202
+ {
203
+ "cell_type": "code",
204
+ "execution_count": 57,
205
+ "metadata": {},
206
+ "outputs": [
207
+ {
208
+ "data": {
209
+ "text/plain": [
210
+ "['Stock_Quantity', 'Monthly_Sales', 'Expiry_Date', 'Purchase_Date']"
211
+ ]
212
+ },
213
+ "execution_count": 57,
214
+ "metadata": {},
215
+ "output_type": "execute_result"
216
+ }
217
+ ],
218
+ "source": [
219
+ "num_col"
220
+ ]
221
+ },
222
+ {
223
+ "cell_type": "code",
224
+ "execution_count": 58,
225
+ "metadata": {},
226
+ "outputs": [
227
+ {
228
+ "name": "stdout",
229
+ "output_type": "stream",
230
+ "text": [
231
+ "<class 'pandas.core.frame.DataFrame'>\n",
232
+ "RangeIndex: 10000 entries, 0 to 9999\n",
233
+ "Data columns (total 8 columns):\n",
234
+ " # Column Non-Null Count Dtype \n",
235
+ "--- ------ -------------- ----- \n",
236
+ " 0 Medicine_Name 10000 non-null object \n",
237
+ " 1 Category 10000 non-null object \n",
238
+ " 2 Batch_No 10000 non-null object \n",
239
+ " 3 Stock_Quantity 10000 non-null int64 \n",
240
+ " 4 Monthly_Sales 10000 non-null int64 \n",
241
+ " 5 Expiry_Date 10000 non-null datetime64[ns]\n",
242
+ " 6 Purchase_Date 10000 non-null datetime64[ns]\n",
243
+ " 7 Supplier 10000 non-null object \n",
244
+ "dtypes: datetime64[ns](2), int64(2), object(4)\n",
245
+ "memory usage: 625.1+ KB\n"
246
+ ]
247
+ }
248
+ ],
249
+ "source": [
250
+ "data.info()"
251
+ ]
252
+ },
253
+ {
254
+ "cell_type": "code",
255
+ "execution_count": 59,
256
+ "metadata": {},
257
+ "outputs": [
258
+ {
259
+ "data": {
260
+ "text/plain": [
261
+ "Medicine_Name 0\n",
262
+ "Category 0\n",
263
+ "Batch_No 0\n",
264
+ "Stock_Quantity 0\n",
265
+ "Monthly_Sales 0\n",
266
+ "Expiry_Date 0\n",
267
+ "Purchase_Date 0\n",
268
+ "Supplier 0\n",
269
+ "dtype: int64"
270
+ ]
271
+ },
272
+ "execution_count": 59,
273
+ "metadata": {},
274
+ "output_type": "execute_result"
275
+ }
276
+ ],
277
+ "source": [
278
+ "data.isna().sum()"
279
+ ]
280
+ },
281
+ {
282
+ "cell_type": "code",
283
+ "execution_count": 60,
284
+ "metadata": {},
285
+ "outputs": [
286
+ {
287
+ "data": {
288
+ "text/plain": [
289
+ "(Timestamp('2024-06-22 00:00:00'), Timestamp('2028-06-02 00:00:00'))"
290
+ ]
291
+ },
292
+ "execution_count": 60,
293
+ "metadata": {},
294
+ "output_type": "execute_result"
295
+ }
296
+ ],
297
+ "source": [
298
+ "data[\"Expiry_Date\"].min(), data[\"Expiry_Date\"].max()"
299
+ ]
300
+ },
301
+ {
302
+ "cell_type": "code",
303
+ "execution_count": 61,
304
+ "metadata": {},
305
+ "outputs": [],
306
+ "source": [
307
+ "today = pd.Timestamp.today()\n",
308
+ "\n",
309
+ "expired = data[data[\"Expiry_Date\"] < today]\n"
310
+ ]
311
+ },
312
+ {
313
+ "cell_type": "code",
314
+ "execution_count": 62,
315
+ "metadata": {},
316
+ "outputs": [],
317
+ "source": [
318
+ "soon_expiring = data[\n",
319
+ " (data[\"Expiry_Date\"] >= today) &\n",
320
+ " (data[\"Expiry_Date\"] <= today + pd.Timedelta(days=30))\n",
321
+ "]"
322
+ ]
323
+ },
324
+ {
325
+ "cell_type": "code",
326
+ "execution_count": 63,
327
+ "metadata": {},
328
+ "outputs": [
329
+ {
330
+ "data": {
331
+ "text/html": [
332
+ "<div>\n",
333
+ "<style scoped>\n",
334
+ " .dataframe tbody tr th:only-of-type {\n",
335
+ " vertical-align: middle;\n",
336
+ " }\n",
337
+ "\n",
338
+ " .dataframe tbody tr th {\n",
339
+ " vertical-align: top;\n",
340
+ " }\n",
341
+ "\n",
342
+ " .dataframe thead th {\n",
343
+ " text-align: right;\n",
344
+ " }\n",
345
+ "</style>\n",
346
+ "<table border=\"1\" class=\"dataframe\">\n",
347
+ " <thead>\n",
348
+ " <tr style=\"text-align: right;\">\n",
349
+ " <th></th>\n",
350
+ " <th>Medicine_Name</th>\n",
351
+ " <th>Category</th>\n",
352
+ " <th>Batch_No</th>\n",
353
+ " <th>Stock_Quantity</th>\n",
354
+ " <th>Monthly_Sales</th>\n",
355
+ " <th>Expiry_Date</th>\n",
356
+ " <th>Purchase_Date</th>\n",
357
+ " <th>Supplier</th>\n",
358
+ " </tr>\n",
359
+ " </thead>\n",
360
+ " <tbody>\n",
361
+ " <tr>\n",
362
+ " <th>54</th>\n",
363
+ " <td>Cough Syrup</td>\n",
364
+ " <td>Cardiac</td>\n",
365
+ " <td>COU-8314</td>\n",
366
+ " <td>499</td>\n",
367
+ " <td>18</td>\n",
368
+ " <td>2026-01-12</td>\n",
369
+ " <td>2024-07-24</td>\n",
370
+ " <td>Pfizer Inc.</td>\n",
371
+ " </tr>\n",
372
+ " <tr>\n",
373
+ " <th>92</th>\n",
374
+ " <td>Metformin</td>\n",
375
+ " <td>Gastro</td>\n",
376
+ " <td>MET-6823</td>\n",
377
+ " <td>162</td>\n",
378
+ " <td>36</td>\n",
379
+ " <td>2026-01-22</td>\n",
380
+ " <td>2024-08-29</td>\n",
381
+ " <td>Dr. Reddy's</td>\n",
382
+ " </tr>\n",
383
+ " <tr>\n",
384
+ " <th>105</th>\n",
385
+ " <td>Paracetamol</td>\n",
386
+ " <td>Diabetes</td>\n",
387
+ " <td>PAR-5265</td>\n",
388
+ " <td>296</td>\n",
389
+ " <td>175</td>\n",
390
+ " <td>2026-01-24</td>\n",
391
+ " <td>2024-12-18</td>\n",
392
+ " <td>Abbott India</td>\n",
393
+ " </tr>\n",
394
+ " <tr>\n",
395
+ " <th>159</th>\n",
396
+ " <td>Insulin</td>\n",
397
+ " <td>Cardiac</td>\n",
398
+ " <td>INS-6815</td>\n",
399
+ " <td>159</td>\n",
400
+ " <td>51</td>\n",
401
+ " <td>2026-01-15</td>\n",
402
+ " <td>2024-10-05</td>\n",
403
+ " <td>Pfizer Inc.</td>\n",
404
+ " </tr>\n",
405
+ " <tr>\n",
406
+ " <th>183</th>\n",
407
+ " <td>Cetirizine</td>\n",
408
+ " <td>Gastro</td>\n",
409
+ " <td>CET-5797</td>\n",
410
+ " <td>433</td>\n",
411
+ " <td>110</td>\n",
412
+ " <td>2026-01-07</td>\n",
413
+ " <td>2024-06-02</td>\n",
414
+ " <td>Dr. Reddy's</td>\n",
415
+ " </tr>\n",
416
+ " <tr>\n",
417
+ " <th>...</th>\n",
418
+ " <td>...</td>\n",
419
+ " <td>...</td>\n",
420
+ " <td>...</td>\n",
421
+ " <td>...</td>\n",
422
+ " <td>...</td>\n",
423
+ " <td>...</td>\n",
424
+ " <td>...</td>\n",
425
+ " <td>...</td>\n",
426
+ " </tr>\n",
427
+ " <tr>\n",
428
+ " <th>9909</th>\n",
429
+ " <td>Ibuprofen</td>\n",
430
+ " <td>Analgesic</td>\n",
431
+ " <td>IBU-8010</td>\n",
432
+ " <td>495</td>\n",
433
+ " <td>151</td>\n",
434
+ " <td>2026-01-19</td>\n",
435
+ " <td>2024-11-05</td>\n",
436
+ " <td>Abbott India</td>\n",
437
+ " </tr>\n",
438
+ " <tr>\n",
439
+ " <th>9917</th>\n",
440
+ " <td>Atorvastatin</td>\n",
441
+ " <td>Antibiotic</td>\n",
442
+ " <td>ATO-6197</td>\n",
443
+ " <td>377</td>\n",
444
+ " <td>90</td>\n",
445
+ " <td>2026-01-14</td>\n",
446
+ " <td>2025-02-01</td>\n",
447
+ " <td>Abbott India</td>\n",
448
+ " </tr>\n",
449
+ " <tr>\n",
450
+ " <th>9946</th>\n",
451
+ " <td>Vitamin C</td>\n",
452
+ " <td>Supplement</td>\n",
453
+ " <td>VIT-9050</td>\n",
454
+ " <td>352</td>\n",
455
+ " <td>126</td>\n",
456
+ " <td>2026-01-24</td>\n",
457
+ " <td>2024-09-22</td>\n",
458
+ " <td>Dr. Reddy's</td>\n",
459
+ " </tr>\n",
460
+ " <tr>\n",
461
+ " <th>9952</th>\n",
462
+ " <td>Amoxicillin</td>\n",
463
+ " <td>Analgesic</td>\n",
464
+ " <td>AMO-8366</td>\n",
465
+ " <td>280</td>\n",
466
+ " <td>14</td>\n",
467
+ " <td>2026-01-23</td>\n",
468
+ " <td>2024-10-31</td>\n",
469
+ " <td>Lupin Ltd.</td>\n",
470
+ " </tr>\n",
471
+ " <tr>\n",
472
+ " <th>9994</th>\n",
473
+ " <td>Vitamin C</td>\n",
474
+ " <td>Antihistamine</td>\n",
475
+ " <td>VIT-5227</td>\n",
476
+ " <td>354</td>\n",
477
+ " <td>193</td>\n",
478
+ " <td>2026-01-08</td>\n",
479
+ " <td>2024-03-24</td>\n",
480
+ " <td>Cipla Ltd.</td>\n",
481
+ " </tr>\n",
482
+ " </tbody>\n",
483
+ "</table>\n",
484
+ "<p>325 rows × 8 columns</p>\n",
485
+ "</div>"
486
+ ],
487
+ "text/plain": [
488
+ " Medicine_Name Category Batch_No Stock_Quantity Monthly_Sales \\\n",
489
+ "54 Cough Syrup Cardiac COU-8314 499 18 \n",
490
+ "92 Metformin Gastro MET-6823 162 36 \n",
491
+ "105 Paracetamol Diabetes PAR-5265 296 175 \n",
492
+ "159 Insulin Cardiac INS-6815 159 51 \n",
493
+ "183 Cetirizine Gastro CET-5797 433 110 \n",
494
+ "... ... ... ... ... ... \n",
495
+ "9909 Ibuprofen Analgesic IBU-8010 495 151 \n",
496
+ "9917 Atorvastatin Antibiotic ATO-6197 377 90 \n",
497
+ "9946 Vitamin C Supplement VIT-9050 352 126 \n",
498
+ "9952 Amoxicillin Analgesic AMO-8366 280 14 \n",
499
+ "9994 Vitamin C Antihistamine VIT-5227 354 193 \n",
500
+ "\n",
501
+ " Expiry_Date Purchase_Date Supplier \n",
502
+ "54 2026-01-12 2024-07-24 Pfizer Inc. \n",
503
+ "92 2026-01-22 2024-08-29 Dr. Reddy's \n",
504
+ "105 2026-01-24 2024-12-18 Abbott India \n",
505
+ "159 2026-01-15 2024-10-05 Pfizer Inc. \n",
506
+ "183 2026-01-07 2024-06-02 Dr. Reddy's \n",
507
+ "... ... ... ... \n",
508
+ "9909 2026-01-19 2024-11-05 Abbott India \n",
509
+ "9917 2026-01-14 2025-02-01 Abbott India \n",
510
+ "9946 2026-01-24 2024-09-22 Dr. Reddy's \n",
511
+ "9952 2026-01-23 2024-10-31 Lupin Ltd. \n",
512
+ "9994 2026-01-08 2024-03-24 Cipla Ltd. \n",
513
+ "\n",
514
+ "[325 rows x 8 columns]"
515
+ ]
516
+ },
517
+ "execution_count": 63,
518
+ "metadata": {},
519
+ "output_type": "execute_result"
520
+ }
521
+ ],
522
+ "source": [
523
+ "soon_expiring"
524
+ ]
525
+ },
526
+ {
527
+ "cell_type": "code",
528
+ "execution_count": 64,
529
+ "metadata": {},
530
+ "outputs": [
531
+ {
532
+ "data": {
533
+ "text/plain": [
534
+ "Index(['Medicine_Name', 'Category', 'Batch_No', 'Stock_Quantity',\n",
535
+ " 'Monthly_Sales', 'Expiry_Date', 'Purchase_Date', 'Supplier'],\n",
536
+ " dtype='object')"
537
+ ]
538
+ },
539
+ "execution_count": 64,
540
+ "metadata": {},
541
+ "output_type": "execute_result"
542
+ }
543
+ ],
544
+ "source": [
545
+ "data.columns"
546
+ ]
547
+ },
548
+ {
549
+ "cell_type": "code",
550
+ "execution_count": 65,
551
+ "metadata": {},
552
+ "outputs": [
553
+ {
554
+ "data": {
555
+ "text/plain": [
556
+ "0 2024-11-25\n",
557
+ "1 2023-12-27\n",
558
+ "2 2025-09-02\n",
559
+ "3 2025-06-22\n",
560
+ "4 2025-02-01\n",
561
+ "Name: Purchase_Date, dtype: datetime64[ns]"
562
+ ]
563
+ },
564
+ "execution_count": 65,
565
+ "metadata": {},
566
+ "output_type": "execute_result"
567
+ }
568
+ ],
569
+ "source": [
570
+ "data.Purchase_Date.head()"
571
+ ]
572
+ },
573
+ {
574
+ "cell_type": "code",
575
+ "execution_count": 66,
576
+ "metadata": {},
577
+ "outputs": [],
578
+ "source": [
579
+ "data['purchase_year'] = data.Purchase_Date.dt.year\n",
580
+ "data['purchase_month'] = data.Purchase_Date.dt.month\n",
581
+ "data['purchase_date'] = data.Purchase_Date.dt.day"
582
+ ]
583
+ },
584
+ {
585
+ "cell_type": "code",
586
+ "execution_count": 74,
587
+ "metadata": {},
588
+ "outputs": [],
589
+ "source": [
590
+ "data['formated_purchase_date'] = data[\"Purchase_Date\"]"
591
+ ]
592
+ },
593
+ {
594
+ "cell_type": "code",
595
+ "execution_count": 90,
596
+ "metadata": {},
597
+ "outputs": [],
598
+ "source": [
599
+ "data.drop(['formated_purchase_date'],axis=1,inplace=True)"
600
+ ]
601
+ },
602
+ {
603
+ "cell_type": "code",
604
+ "execution_count": 98,
605
+ "metadata": {},
606
+ "outputs": [],
607
+ "source": [
608
+ "data.rename(columns={\"Purchase_Date\":\"formated_purchase_date\"},inplace=True)"
609
+ ]
610
+ },
611
+ {
612
+ "cell_type": "code",
613
+ "execution_count": 99,
614
+ "metadata": {},
615
+ "outputs": [
616
+ {
617
+ "name": "stdout",
618
+ "output_type": "stream",
619
+ "text": [
620
+ "<class 'pandas.core.frame.DataFrame'>\n",
621
+ "RangeIndex: 10000 entries, 0 to 9999\n",
622
+ "Data columns (total 11 columns):\n",
623
+ " # Column Non-Null Count Dtype \n",
624
+ "--- ------ -------------- ----- \n",
625
+ " 0 Medicine_Name 10000 non-null object \n",
626
+ " 1 Category 10000 non-null object \n",
627
+ " 2 Batch_No 10000 non-null object \n",
628
+ " 3 Stock_Quantity 10000 non-null int64 \n",
629
+ " 4 Monthly_Sales 10000 non-null int64 \n",
630
+ " 5 Expiry_Date 10000 non-null datetime64[ns]\n",
631
+ " 6 formated_purchase_date 10000 non-null datetime64[ns]\n",
632
+ " 7 Supplier 10000 non-null object \n",
633
+ " 8 purchase_year 10000 non-null int32 \n",
634
+ " 9 purchase_month 10000 non-null int32 \n",
635
+ " 10 purchase_date 10000 non-null int32 \n",
636
+ "dtypes: datetime64[ns](2), int32(3), int64(2), object(4)\n",
637
+ "memory usage: 742.3+ KB\n"
638
+ ]
639
+ }
640
+ ],
641
+ "source": [
642
+ "data.info()"
643
+ ]
644
+ }
645
+ ],
646
+ "metadata": {
647
+ "kernelspec": {
648
+ "display_name": "Python 3",
649
+ "language": "python",
650
+ "name": "python3"
651
+ },
652
+ "language_info": {
653
+ "codemirror_mode": {
654
+ "name": "ipython",
655
+ "version": 3
656
+ },
657
+ "file_extension": ".py",
658
+ "mimetype": "text/x-python",
659
+ "name": "python",
660
+ "nbconvert_exporter": "python",
661
+ "pygments_lexer": "ipython3",
662
+ "version": "3.11.4"
663
+ }
664
+ },
665
+ "nbformat": 4,
666
+ "nbformat_minor": 2
667
+ }
dashboard.py ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import urllib.parse
4
+
5
+ # ---------------- Page Config ----------------
6
+ st.set_page_config(
7
+ page_title="Pharma Expiry Dashboard",
8
+ page_icon="💊",
9
+ layout="wide"
10
+ )
11
+
12
+ st.title("💊 Pharma Inventory Expiry Alert System")
13
+
14
+ # ---------------- File Upload ----------------
15
+ uploaded_file = st.file_uploader(
16
+ "📂 Choose your Datafile",
17
+ type=["csv", "xlsx", "json"]
18
+ )
19
+
20
+ if uploaded_file is None:
21
+ st.info("⬆ Upload CSV / Excel / JSON file to continue")
22
+ st.stop()
23
+
24
+ # ---------------- Load Data ----------------
25
+ if uploaded_file.name.endswith(".csv"):
26
+ data = pd.read_csv(uploaded_file)
27
+ elif uploaded_file.name.endswith(".xlsx"):
28
+ data = pd.read_excel(uploaded_file)
29
+ else:
30
+ data = pd.read_json(uploaded_file)
31
+
32
+ # ---------------- Safe Date Conversion ----------------
33
+ data["Expiry_Date"] = pd.to_datetime(data["Expiry_Date"], errors="coerce")
34
+ data["Purchase_Date"] = pd.to_datetime(data["Purchase_Date"], errors="coerce")
35
+
36
+ today = pd.Timestamp.today()
37
+
38
+ # ---------------- Sidebar Filters ----------------
39
+ st.sidebar.header("🔎 Filters")
40
+
41
+ category_filter = st.sidebar.multiselect(
42
+ "Category",
43
+ options=sorted(data["Category"].dropna().unique())
44
+ )
45
+
46
+ supplier_filter = st.sidebar.multiselect(
47
+ "Supplier",
48
+ options=sorted(data["Supplier"].dropna().unique())
49
+ )
50
+
51
+ expiry_filter = st.sidebar.selectbox(
52
+ "Expiry Status",
53
+ ["All", "Expired", "Expiring in 30 Days", "Safe"]
54
+ )
55
+
56
+
57
+ # ---------------- Apply Filters ----------------
58
+ filtered_data = data.copy()
59
+
60
+ if category_filter:
61
+ filtered_data = filtered_data[filtered_data["Category"].isin(category_filter)]
62
+
63
+ if supplier_filter:
64
+ filtered_data = filtered_data[filtered_data["Supplier"].isin(supplier_filter)]
65
+
66
+ if expiry_filter == "Expired":
67
+ filtered_data = filtered_data[filtered_data["Expiry_Date"] < today]
68
+
69
+ elif expiry_filter == "Expiring in 30 Days":
70
+ filtered_data = filtered_data[
71
+ (filtered_data["Expiry_Date"] >= today) &
72
+ (filtered_data["Expiry_Date"] <= today + pd.Timedelta(days=30))
73
+ ]
74
+
75
+ elif expiry_filter == "Safe":
76
+ filtered_data = filtered_data[filtered_data["Expiry_Date"] > today + pd.Timedelta(days=30)]
77
+
78
+ # ---------------- KPI Metrics ----------------
79
+ expired_count = data[data["Expiry_Date"] < today].shape[0]
80
+ expiring_count = data[
81
+ (data["Expiry_Date"] >= today) &
82
+ (data["Expiry_Date"] <= today + pd.Timedelta(days=30))
83
+ ].shape[0]
84
+
85
+ col1, col2, col3, col4 = st.columns(4)
86
+
87
+ col1.metric("🧾 Total Medicines", data["Medicine_Name"].nunique())
88
+ col2.metric("📦 Total Stock", data["Stock_Quantity"].sum())
89
+ col3.metric("🚨 Expired", expired_count)
90
+ col4.metric("⚠ Expiring (30 Days)", expiring_count)
91
+
92
+ st.write(filtered_data)
93
+ st.write(filtered_data['Category'].value_counts())
94
+ st.write(filtered_data['Supplier'].value_counts())
95
+ st.markdown(f"Resultant Medicine are {filtered_data['Category'].count()}")
96
+
97
+ st.divider()
98
+ st.subheader("📢 Notify Supplier")
99
+
100
+ # Supplier selection
101
+ selected_supplier = st.selectbox(
102
+ "Select Supplier",
103
+ sorted(filtered_data["Supplier"].dropna().unique())
104
+ )
105
+
106
+ # Contact inputs
107
+ supplier_mobile = st.text_input("📱 Supplier Mobile (with country code)", placeholder="91XXXXXXXXXX")
108
+
109
+ # Data to send (expired + expiring)
110
+ alert_data = filtered_data[
111
+ filtered_data["Expiry_Date"] <= today + pd.Timedelta(days=30)
112
+ ]
113
+
114
+ def generate_message(df, supplier):
115
+ message = f"Expiry Alert for Supplier: {supplier}\n\n"
116
+
117
+ # Details of each medicine
118
+ for _, row in df.iterrows():
119
+ message += (
120
+ f"Medicine: {row['Medicine_Name']}\n"
121
+ f"Batch: {row['Batch_No']}\n"
122
+ f"Expiry: {row['Expiry_Date'].date()}\n"
123
+ f"Stock: {row['Stock_Quantity']}\n"
124
+ "----------------------\n"
125
+ )
126
+
127
+ # 🔢 Totals
128
+ total_expiry_medicines = len(df)
129
+ unique_medicine_count = df['Medicine_Name'].unique()
130
+ category_count = df['Category'].unique()
131
+
132
+ message += (
133
+ "\n===== SUMMARY =====\n"
134
+ f"Total Expiry Medicines: {total_expiry_medicines}\n"
135
+ f"Total Unique Medicine Names: {unique_medicine_count}\n"
136
+ f"Total Categories Affected: {category_count}\n"
137
+ )
138
+
139
+ return message
140
+
141
+
142
+ if st.button("📲 Submit Number"):
143
+ if supplier_mobile and not alert_data.empty:
144
+ message = generate_message(alert_data, selected_supplier)
145
+ encoded_msg = urllib.parse.quote(message)
146
+ whatsapp_url = f"https://wa.me/{supplier_mobile}?text={encoded_msg}"
147
+
148
+ # st.button(whatsapp_url)
149
+ st.link_button("Send Order WhatsApp", whatsapp_url)
150
+ else:
151
+ st.error("❌ Please provide mobile number & ensure data exists")
data/data.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/final_inventory.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/pharmacy_inventory_25.csv ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Medicine_Name,Category,Batch_No,Stock_Quantity,Monthly_Sales,Expiry_Date,Purchase_Date,Supplier
2
+ Atorvastatin,Gastro,ATO-3028,333,57,2026-10-06,2025-04-30,Pfizer Inc.
3
+ Paracetamol,Antihistamine,PAR-1696,173,141,2026-06-16,2024-12-11,Sun Pharma
4
+ Atorvastatin,Analgesic,ATO-7955,467,21,2027-05-31,2025-04-24,Sun Pharma
5
+ Cough Syrup,Cardiac,COU-3875,217,158,2028-01-05,2025-08-02,Cipla Ltd.
6
+ Aspirin,Analgesic,ASP-8028,454,163,2026-05-07,2024-07-11,Pfizer Inc.
7
+ Cetirizine,Analgesic,CET-8808,316,136,2025-12-25,2025-06-24,Sun Pharma
8
+ Pantoprazole,Supplement,PAN-8731,42,188,2027-02-18,2025-04-25,Pfizer Inc.
9
+ Metformin,Cardiac,MET-3112,129,152,2026-02-01,2024-01-07,Lupin Ltd.
10
+ Paracetamol,Gastro,PAR-3249,10,178,2026-07-02,2025-09-28,Cipla Ltd.
11
+ Paracetamol,Antihistamine,PAR-1313,151,122,2025-12-13,2024-01-30,Dr. Reddy's
12
+ Atorvastatin,Gastro,ATO-3383,369,186,2026-04-05,2025-04-20,Pfizer Inc.
13
+ Metformin,Antibiotic,MET-1481,189,73,2027-01-27,2025-11-03,Sun Pharma
14
+ Aspirin,Antibiotic,ASP-8411,287,120,2026-02-27,2024-08-08,Cipla Ltd.
15
+ Pantoprazole,Analgesic,PAN-5943,157,199,2025-10-03,2024-08-31,Dr. Reddy's
16
+ Metformin,Analgesic,MET-9980,385,18,2026-04-08,2024-04-28,Sun Pharma
17
+ Ibuprofen,Supplement,IBU-4706,265,81,2024-12-20,2024-01-19,Lupin Ltd.
18
+ Pantoprazole,Antihistamine,PAN-6321,321,27,2027-09-14,2025-10-19,Cipla Ltd.
19
+ Vitamin C,Analgesic,VIT-4816,241,128,2025-06-26,2024-09-29,Abbott India
20
+ Metformin,Cardiac,MET-2270,350,12,2025-10-21,2024-08-25,Cipla Ltd.
21
+ Pantoprazole,Gastro,PAN-9420,235,186,2025-11-02,2024-05-07,Pfizer Inc.
22
+ Cetirizine,Analgesic,CET-7232,325,147,2025-02-18,2024-07-03,Dr. Reddy's
23
+ Aspirin,Cardiac,ASP-6418,275,113,2025-11-27,2024-01-08,Pfizer Inc.
24
+ Aspirin,Antihistamine,ASP-8208,354,200,2025-09-24,2024-08-29,Dr. Reddy's
25
+ Cough Syrup,Supplement,COU-2116,338,102,2025-12-28,2024-12-13,Pfizer Inc.
26
+ Ibuprofen,Antihistamine,IBU-3657,188,87,2027-05-16,2025-02-18,Abbott India
pyfile_data_gen.py ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import random
3
+ from faker import Faker
4
+ from datetime import timedelta
5
+
6
+ fake = Faker()
7
+
8
+ # -----------------------------
9
+ # CONFIG
10
+ # -----------------------------
11
+ NUM_RECORDS = 25
12
+
13
+ medicine_names = [
14
+ "Paracetamol", "Amoxicillin", "Azithromycin", "Atorvastatin",
15
+ "Ibuprofen", "Metformin", "Cetirizine", "Pantoprazole",
16
+ "Aspirin", "Cough Syrup", "Vitamin C", "Insulin"
17
+ ]
18
+
19
+ categories = [
20
+ "Analgesic", "Antibiotic", "Antihistamine",
21
+ "Cardiac", "Diabetes", "Gastro", "Supplement"
22
+ ]
23
+
24
+ suppliers = [
25
+ "Sun Pharma", "Cipla Ltd.", "Dr. Reddy's",
26
+ "Pfizer Inc.", "Abbott India", "Lupin Ltd."
27
+ ]
28
+
29
+ # -----------------------------
30
+ # DATA GENERATION
31
+ # -----------------------------
32
+ data = []
33
+
34
+ for _ in range(NUM_RECORDS):
35
+ medicine = random.choice(medicine_names)
36
+ category = random.choice(categories)
37
+ supplier = random.choice(suppliers)
38
+
39
+ purchase_date = fake.date_between(start_date="-2y", end_date="today")
40
+ expiry_date = purchase_date + timedelta(days=random.randint(180, 900))
41
+
42
+ record = {
43
+ "Medicine_Name": medicine,
44
+ "Category": category,
45
+ "Batch_No": f"{medicine[:3].upper()}-{random.randint(1000,9999)}",
46
+ "Stock_Quantity": random.randint(10, 500),
47
+ "Monthly_Sales": random.randint(5, 200),
48
+ "Expiry_Date": expiry_date,
49
+ "Purchase_Date": purchase_date,
50
+ "Supplier": supplier
51
+ }
52
+
53
+ data.append(record)
54
+
55
+ # -----------------------------
56
+ # CREATE DATAFRAME
57
+ # -----------------------------
58
+ df = pd.DataFrame(data)
59
+
60
+ # -----------------------------
61
+ # SAVE TO CSV
62
+ # -----------------------------
63
+ df.to_csv("pharmacy_inventory_25.csv", index=False)
64
+
65
+ print("✅ 10,000 pharmacy inventory records generated successfully!")
66
+ print(df.head())
requirements.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ streamlit==1.32.0
2
+ pandas==2.2.2
3
+ numpy==1.26.4
4
+ matplotlib==3.8.4
5
+ statsmodels==0.14.2
6
+ python-dateutil==2.9.0.post0
7
+ faker==25.2.0
utils/data_utils.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+
3
+ def load_data(file):
4
+ if file.name.endswith(".csv"):
5
+ df = pd.read_csv(file)
6
+ elif file.name.endswith(".xlsx"):
7
+ df = pd.read_excel(file)
8
+ else:
9
+ df = pd.read_json(file)
10
+
11
+ df["Expiry_Date"] = pd.to_datetime(df["Expiry_Date"], errors="coerce")
12
+ df["Purchase_Date"] = pd.to_datetime(df["Purchase_Date"], errors="coerce")
13
+
14
+ return df
utils/message_utils.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def generate_message(df, supplier):
2
+ message = f"Expiry Alert for Supplier: {supplier}\n\n"
3
+ for _, row in df.iterrows():
4
+ message += (
5
+ f"Medicine: {row['Medicine_Name']}\n"
6
+ f"Batch: {row['Batch_No']}\n"
7
+ f"Expiry: {row['Expiry_Date'].date()}\n"
8
+ f"Stock: {row['Stock_Quantity']}\n"
9
+ f"Total Expiry Medicine: {row['Medicine_Name']}.value_counts()\n"
10
+ f"Total Expiry Category: {row['Category']}.value_counts()\n"
11
+ "----------------------\n"
12
+ )
13
+ return message