Team Members:
- Anvit Gupta (anvit_g@cs.iitr.ac.in)
- Raman Sharma (raman_s@cs.iitr.ac.in)
- Tamakuwala Vraj Shailesh (tamakuwala_vs@cs.iitr.ac.in)
Repository: https://github.com/vraj-tvs/Roster-Email-Parser
This project automates the extraction, normalization, and tabulation of provider roster information from .eml email files. The pipeline processes emails, extracts structured data, normalizes it, and generates Excel outputs for downstream use.
This project is part of HiLabs Hackathon 2025: Free-Text Roster Emails.
Roster-Email-Parser/
├── data/
│ ├── input/ # Place .eml files here
│ ├── output/ # Excel output files
│ └── logs/ # Pipeline logs
├── src/
│ ├── parser.py
│ ├── preprocessor.py
│ ├── extractor.py
│ ├── normalizer.py
│ └── excel_generator.py
├── utils/
│ └── logger.py
├── runner.py
├── requirements.txt
└── README.md
The solution is modular, with each stage encapsulated in a dedicated Python module:
-
Parsing: Extracts the plain text body from
.emlfiles using robust email parsing. -
Preprocessing: Cleans and standardizes the extracted text, removing artifacts and normalizing whitespace.
-
Extraction: Uses regex and spaCy NLP to extract provider details (NPI, name, specialty, address, etc.) and business attributes.
-
Normalization: Applies rules to standardize formats (dates, names, IDs) and ensures consistent output.
-
Excel Generation: Outputs the normalized data to
.xlsxfiles, matching a predefined template. -
Logging: Logs pipeline progress and errors to
data/logs/pipeline.log.
This project leverages the spaCy transformer-based pretrained model, en_core_web_trf, for advanced Natural Language Processing (NLP) tasks. This model is built on top of transformer architectures (such as BERT or RoBERTa), providing state-of-the-art accuracy for Named Entity Recognition (NER) and other language understanding tasks.
-
Purpose: The
en_core_web_trfmodel is used to extract structured information from unstructured email text, specifically when rule-based or regex extraction is insufficient or ambiguous. -
How It Works: After initial regex-based extraction, the model is applied to the email text to identify entities such as:
- PERSON (for provider names)
- ORG (for organization names, e.g., "Mercian Medical Group")
-
Why Use It: Emails often contain provider and organization names in varied formats. The transformer model can robustly identify these entities even when the text is noisy or inconsistent, improving extraction accuracy and reducing manual intervention.
-
Integration: The model is loaded once at the start of the pipeline (
spacy.load("en_core_web_trf")inextractor.py).
It is used as a fallback in the extraction logic to ensure that critical fields like provider and organization names are reliably captured.
- High Accuracy: Transformer models outperform traditional rule-based approaches for NER.
- Robustness: Handles diverse and messy email formats.
- Scalability: Enables automated extraction across large volumes of emails with minimal errors.
Note: To use this model, ensure you have run:
python -m spacy download en_core_web_trf
or installed via requirements.txt.
-
Create and Initialize virtual environment (Optional)
# On Windows python -m venv myenv myenv\Scripts\activate # On Linux/macOS python3 -m venv myenv source myenv/bin/activate -
Install Dependencies
# On Windows pip install -r requirements.txt # On Linux/macOS python3 -m pip install -r requirements.txtThis will install all required packages, including:
spacy,en-core-web-trf(NLP)openpyxl,pandas,numpy,tqdm,python-dateutilbeautifulsoup4andlxml(for email and HTML parsing)
NOTE: If you have multiple Python versions installed, use:
# On Windows python -m pip install -r requirements.txt # On Linux/macOS python3 -m pip install -r requirements.txtIf you see errors about missing
en_core_web_trf, run:# On Windows python -m spacy download en_core_web_trf # On Linux/macOS python3 -m spacy download en_core_web_trf -
Prepare Input
- Place the
.emlfiles indata/input/folder.
- Place the
-
Run the pipeline
- For single file:
# On Windows python runner.py --input_file=data/input/Sample-1.eml # On Linux/macOS python3 runner.py --input_file=data/input/Sample-1.eml- For a folder of
.emlfiles:
# On Windows python runner.py --input_folder=data/input/ # On Linux/macOS python3 runner.py --input_folder=data/input/ -
Output
- Excel files are saved in
data/outputfolder. - Logs are available in
data/logs/pipeline.log.
- Excel files are saved in
-
The pipeline logs TAT for each processed file and computes total and average TAT.
-
See the summary at the end of
data/logs/pipeline.logfor detailed timing statistics.-
TAT analysis for given 3 sample
.emlfilesFile TAT (seconds) Output Sample-1.eml 1.14 Sample-1.xlsx Sample-2.eml 0.51 Sample-2.xlsx Sample-3.eml 0.17 Sample-3.xlsx - Total files processed: 3
- Total TAT: 1.82 seconds
- Average TAT per file: 0.61 seconds
-