Automated pipeline for extracting and structuring financial statements of African listed companies.
# Africa Financials Extraction
A financial data engineering project for turning African listed-company reports into structured, analysis-ready financial metrics.
The current prototype combines digital PDF parsing, table extraction, OCR fallback, metric matching, balance-sheet validation, and CSV/Excel export.
## Problem
Financial statements across African markets are frequently published as PDFs with inconsistent layouts, scanned pages, and exchange-specific reporting formats. This makes cross-company screening and analysis difficult to automate.
This project explores a reusable extraction pipeline that converts those reports into structured data for analysts, researchers, and downstream financial applications.
## Current pipeline
```text
Annual / quarterly report PDF
|
v
PyMuPDF text blocks
|
+------> Camelot table extraction
|
+------> Tesseract OCR fallback
|
v
Metric matching and normalization
|
v
Balance-sheet consistency check
|
v
CSV + multi-sheet Excel output
```
## Metrics currently targeted
- Total revenue
- Net income / profit after tax
- Total assets
- Total liabilities
- Shareholders' equity
The extractor searches common reporting-language variants such as revenue, turnover, sales, net income, profit after tax, and equity.
## Implemented components
- Digital PDF block extraction with PyMuPDF
- Table extraction with Camelot
- OCR fallback with Tesseract and pdfplumber
- Regex-based financial metric matching
- CSV output for extracted metrics
- Multi-sheet Excel export containing metrics, text blocks, tables, and summary data
- Basic accounting-equation validation for assets versus liabilities plus equity
- Sample financial reports and structured output files for experimentation
## Run locally
```bash
git clone
github.com
cd africa-financials-extraction
python -m venv .venv
```
Activate the environment:
```bash
# macOS / Linux
source .venv/bin/activate
# Windows
.venv\Scripts\activate …