An ETL pipeline aimed at automating and visualization of hospital statistical data, taking as its case study the National Ophthalmology Institute of Angola.
Report Bug Β Β·Β Request Feature
- Overview
- Features
- Tech Stack
- Getting Started
- Usage
- Project Structure
- API Reference
- Screenshots
- Roadmap
- Contributing
- License
- Authors
- Acknowledgements
ETL-lar is a comprehensive ETL (Extract, Transform, Load) pipeline designed to automate the processing and visualization of hospital statistical data. The project focuses on the National Ophthalmology Institute of Angola, aiming to streamline data management and provide actionable insights through interactive dashboards. By leveraging modern technologies and best practices in data engineering, ETL-lar enables healthcare professionals to make informed decisions based on accurate and timely data.
- Data Extraction: Implement robust data extraction mechanisms to pull data from various sources, including databases, APIs, and flat files.
- Data Transformation: Develop a flexible transformation layer to clean, normalize, and enrich the extracted data, ensuring it is in the correct format for analysis and visualization.
- Data Loading: Set up efficient loading processes to store the transformed data in a centralized data warehouse, optimizing for query performance and scalability.
- Visualization: Create interactive dashboards and reports that allow users to explore the data, identify trends, and derive insights relevant to ophthalmology care and hospital management.
- Automation: Schedule and automate the entire ETL process to ensure that the data is always up-to-date, reducing manual intervention and minimizing errors.
- Extract to CSV, XLSX, SQL: Implement functionality to export the processed data into various formats such as CSV, XLSX, and SQL for further analysis or sharing with stakeholders.
| Layer | Technology |
|---|---|
| Dashboard | Streamlit (version 1.55.0) |
| Backend | Python (3.13.9) |
| Post-Processing | Pandas, NumPy |
| Database | MySQL |
| Data Visualization | Power BI |
| DevOps | Docker, Git |
This Python project dependencies:
-
pandas>=2.2.0 -
numpy>=1.26.0 -
SQLAlchemy>=2.0.0 -
PyMySQL>=1.1.0 -
openpyxl>=3.1.0 -
python-dotenv>=1.0.0 -
streamlit>=1.34.0 -
altair<5
1. Clone the repository
git clone https://github.com/fevunge/etl-lar.git
cd etl-lar2. Install dependencies
If you are using Linux, macOS, WSL or another Unix-like system, is highly recommended to use a virtual environment to manage dependencies.
You can create one using venv:
python -m venv venv
source venv/bin/activateOtherwise, if you are a experienced Windows user, you decide create a virtual environment or not.
pip install -r requirements.txt3. Set up environment variables
cp .env.example .env4. Run database
docker compose up -d-
-
Install MySQL/MySQL Workbench and create a database named
etl_laron Workbench interface. -
Use Docker Desktop to download and run MySQL image, then create a database named
etl_laron MySQL Workbench interface or using MySQL CLI (RECOMMENDED). -
Use WSL to run the same commands as Unix-like systems.
-
5. Start the development server
- Command Line Interface:
python src/main.py- Dashboard Interface:
python -m streamlit run src/dashboard.pyBy default, the dashboard will be available at http://localhost:8501.
You can change the port by adding --server.port <PORT_NUMBER> to the command above.
Or it can change automatically if the default port is already in use.
Create a .env file in the root directory. See .env.example for reference.
| Variable | Description | Required |
|---|---|---|
DB_HOST |
MySQL Database host (e.g 0.0.0.0) |
β |
DB_PORT |
MySQL Database port (e.g 3306) |
β |
DB_USER |
MySQL Database username (e.g root) |
β |
DB_PASSWORD |
MySQL Database password | β |
DB_NAME |
MySQL Database name (e.g etl_lar) |
β |
With are you using Docker, this variables are already set in docker-compose.yml, you must have the same values in your .env file to connect to the database container.
... Soon ...
etl-lar
βββ data_raw
β βββ cirurgias.csv
β βββ consultas.csv
β βββ exames_complementares.csv
β βββ exames_laboratoriais.csv
β βββ farmacia_consumo.csv
β βββ internamentos.csv
β βββ medicos.csv
β βββ pacientes.csv
β βββ patologias.csv
βββ logs
β βββ etl.log
βββ src
β βββ config.py
β βββ dashboard.py
β βββ export.py
β βββ extract.py
β βββ load.py
β βββ logs.py
β βββ main.py
β βββ transform.py
βββ .env.example
βββ .gitignore
βββ etlar.cmd
βββ etllar.sh
βββ LICENSE
βββ Makefile
βββ README.md
βββ requirements.txt
βββ SPEC.md
Extracts data from the source files and returns a dictionary of DataFrames. Returns:
Dict[str, pd.DataFrame]: A dictionary where keys are table names and values are the corresponding DataFrames.
Transforms the extracted data by performing cleaning, normalization, and enrichment operations. Parameters:
data (Dict[str, pd.DataFrame]): A dictionary of DataFrames to be transformed. Returns:Dict[str, pd.DataFrame]: A dictionary of transformed DataFrames.
Loads the transformed data into the MySQL database. Parameters:
data (Dict[str, pd.DataFrame]): A dictionary of DataFrames to be loaded into the database.
... Soon ...
Please check back later for updates on how to contribute to this project.
Distributed under the MIT License.
- Power BI β Data visualization tool
- Streamlit β Dashboard framework
- MySQL β Database management system
- Pandas β Data manipulation library
- NumPy β Numerical computing library
- SQLAlchemy β SQL toolkit and Object-Relational Mapping (ORM) library
- PyMySQL β MySQL client library
- openpyxl β Excel file handling library
Made with π§ and β by fevunge
β Star this repo if you found it insightful!

