The Activity Code Analyzer (actcod) is a Python data pipeline built during the Santander internship to categorize millions of banking transactions by their activity codes (COD_ACT). It maps raw numeric codes to business categories using a reference CSV, with support for multiprocessing to handle large transaction files efficiently.
What it does
The pipeline reads transaction data and a reference mapping file (referencias.csv), then:
- Loads references — Parses a CSV with
Categoriasandcodigoscolumns, building a dictionary mapping each integer code to one or more business categories. - Processes transactions — Reads transaction files and looks up each row’s activity code against the reference map.
- Fuzzy matching — Uses
difflib.SequenceMatcherfor near-matches when exact code lookups fail. - Multiprocessing — Distributes work across CPU cores via
multiprocessing.Poolfor throughput on large datasets. - Exports results — Writes categorized output with timestamps and progress logging.
Two script versions ship in the repo:
Verbose.py— Full-featured pipeline with detailed logging, statistics, and multiprocessingverboseOG.py— Earlier single-threaded prototype for validation
Context
This project grew out of the CodigosActividad exploratory work archived in the Santander internship repo (txtversion), where multiple algorithm versions (simple, advanced, SQL-based) were tested before converging on the validated multiprocessing approach in this repository.
Activity code categorization supports fraud detection, customer segmentation, and regulatory reporting — turning opaque numeric codes into actionable business categories.
Tech stack
| Layer | Choice |
|---|---|
| Language | Python 3 |
| Data | Pandas |
| Matching | difflib.SequenceMatcher, regex |
| Performance | multiprocessing.Pool, cpu_count() |
| I/O | CSV read/write, JSON export |
Development process
PrimerVersion
Initial commit with the first working categorization script — basic reference loading and single-file transaction processing.
PrimeraVersionNoMutihilo
Refined logic without multiprocessing to validate correctness on smaller samples before scaling.
PrimeraVersionmultihilo
Added multiprocessing with Pool to parallelize transaction batches across available CPU cores.
VersionMultihilovalidada
Final validated multiprocessing version (Verbose.py) — tested against reference data with correct category mappings at scale. This is the production-ready script in the repo.
README update (main branch)
Updated project documentation on the default main branch (the code lives on master).


Building Smartclic Demo