Automated tool for analyzing medicine cost changes across patient treatments.
- Medicine name normalization (handles spacing, units, variants)
- Patient-wise medicine tracking
- Cost difference calculation
- Automated Excel report generation with merged cells
- Clean data structure for price lookups
pip install -r requirements.txtPlace your raw Excel file in data/raw/Task_-_DC.xlsx
# Extract unique medicine names
python scripts/01_extract_medicines.py
# Basic normalization (spacing, units)
python scripts/02_normalize_basic.py
# Advanced normalization (add missing units)
python scripts/03_normalize_advanced.py
# Generate final analysis sheet
python scripts/04_final_analysis.pyFind your results in data/output/medicines_final.xlsx
medicines_final.xlsx
├── medicines_expanded # One row per medicine per client
│ ├── clientid
│ ├── start_medicine
│ ├── start_medicine_price (fill from medicine_prices)
│ ├── latest_medicine
│ ├── latest_medicine_price (fill from medicine_prices)
│ ├── price_difference (merged per client - add formula)
│ └── expense_difference (merged per client - shows Increase/Decrease)
│
└── medicine_prices # Master price lookup table
├── #
├── medicine_name (647 unique normalized names)
└── medicine_price (₹) (fill from Tata 1mg)
- Extract → Get all unique medicine names
- Normalize → Clean spacing, standardize units, collapse duplicates
- Expand → One row per medicine per patient
- Fill Prices → Update
medicine_pricessheet from Tata 1mg - Auto-Calculate → Use VLOOKUP to populate prices, add formulas for differences
- Lowercase all names
- Remove extra spaces, backticks, trailing dots
- Standardize units:
1 mg→1mg - Smart unit addition:
amaryl 1→amaryl 1mg(only ifamaryl 1mgexists) - Preserve dosage formats:
50/500,10/1000etc.
MIT
Yashwanth