Orquestador de consultas sobre SECOP desde el API del portal de datos abiertos.
Project description
pysecop 🇨🇴
pysecop is a high-performance Python package designed to interact seamlessly with Colombia's Public Procurement Data (SECOP I & II).
It abstracts the complexity of the Socrata (SODA) API, handles messy government data cleaning, and provides a fluent interface for building complex queries that are ready for Machine Learning and Big Data pipelines.
🚀 Why pysecop?
Public procurement data is the foundation of transparency and market intelligence. However, raw government APIs often return inconsistent formats, "polluted" URL strings, and fragmented schemas. pysecop solves this by providing:
- 🏗️ Fluent SoQL Builder: Build complex Socrata queries without writing a single line of raw SQL.
- 🧹 Automated Data Hygiene: Pre-configured vectorized processors for dates, URLs, and categorical encoding (v1.3.0+).
- 🚀 Native Parallel Fetching: Auto-sliced concurrent requests for high-throughput historical data scavenging.
- 🔗 Unified Schema: High-level methods to join data across SECOP I and SECOP II seamlessly.
- 🐳 Production Ready: Fully Dockerized and tested for mission-critical ETL environments.
🛠️ Quick Start
Installation
pip install pysecop
Unified Search (SECOP I & II)
The most powerful feature of pysecop is the ability to search across both SECOP I and SECOP II with a single command and get a single, consolidated DataFrame. The engine includes Intelligent Input Resilience, allowing you to provide formatted IDs (like NITs with dashes) that are automatically cleaned for the backend.
from pysecop import SecopClient
client = SecopClient()
# Search by NIT across both datasets simultaneously (automatic ID cleaning)
df = client.search(nit_entidad="900000000-1")
# The result is a single, consolidated "Matrix-in-Blocks" DataFrame
print(df[["source", "nombre_entidad", "valor_del_contrato", "estado_contrato"]].head())
Parallel Ingestion & Native Slicing (v1.3.0+)
For high-throughput pipelines, pysecop now supports Native Parallel Slicing. It automatically partitions large requests into concurrent worker threads with shared-state rate limiting:
# Automatic High-Throughput (Auto-calculates concurrency and slices offsets)
df = client.search(limit=250000) # Slices into 5 concurrent batches internally
[!TIP] Shared-State Resilience: Version 1.3.0+ includes internal Global Backoff. If one thread hits a
429 Too Many Requests, the entire client pauses correctly across all threads to protect your IP reputation.
🏛️ Project Architecture
The system follows a modular design to ensure scalability and ease of maintenance:
graph LR
A[SecopClient] -->|Builds| B[QueryBuilder]
A -->|Authenticates| C[Socrata API]
C -->|Returns Raw| D[DataFrame]
D -->|Refines| E[DataProcessor]
E -->|Output| F[Analysis Ready Data]
For a deeper dive into the system design, check out the Architecture Deep Dive.
📂 Documentation Layers
- ARCHITECTURE.md: Technical design, data flow, and architectural trade-offs.
- GUIDE.md: Full API reference, installation, and extension guide.
- USE_CASES.md: Business value, anti-corruption use cases, and market intelligence examples.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pysecop-1.4.2.tar.gz.
File metadata
- Download URL: pysecop-1.4.2.tar.gz
- Upload date:
- Size: 25.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7f2b44428f499f95fe80ca7c05b199cb4acd0ae507c2c8ff76451d5f3cfcf98
|
|
| MD5 |
d08c6a18961fb7ba1b28c63420aa42b2
|
|
| BLAKE2b-256 |
9df33558aef421c5efb9fa196de55a63626be7979e3cba498d94330960b0f4dd
|
Provenance
The following attestation bundles were made for pysecop-1.4.2.tar.gz:
Publisher:
python-publish.yml on 26-jorge-01/pysecop
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pysecop-1.4.2.tar.gz -
Subject digest:
b7f2b44428f499f95fe80ca7c05b199cb4acd0ae507c2c8ff76451d5f3cfcf98 - Sigstore transparency entry: 1338955267
- Sigstore integration time:
-
Permalink:
26-jorge-01/pysecop@26f7b3af9cac76abfe18f31125def36206b41c56 -
Branch / Tag:
refs/tags/v1.4.2 - Owner: https://github.com/26-jorge-01
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@26f7b3af9cac76abfe18f31125def36206b41c56 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pysecop-1.4.2-py3-none-any.whl.
File metadata
- Download URL: pysecop-1.4.2-py3-none-any.whl
- Upload date:
- Size: 20.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f958bc522d9f579d26eaf9e7c1b0fcb6aff656e748b76c1218131f4d9a31191
|
|
| MD5 |
e22ece7d03bc268913d677f45e960084
|
|
| BLAKE2b-256 |
54b901fef5e5e3f7d303a4bcbdae12160572081eef9c0f1192d5efea794768b0
|
Provenance
The following attestation bundles were made for pysecop-1.4.2-py3-none-any.whl:
Publisher:
python-publish.yml on 26-jorge-01/pysecop
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pysecop-1.4.2-py3-none-any.whl -
Subject digest:
7f958bc522d9f579d26eaf9e7c1b0fcb6aff656e748b76c1218131f4d9a31191 - Sigstore transparency entry: 1338955275
- Sigstore integration time:
-
Permalink:
26-jorge-01/pysecop@26f7b3af9cac76abfe18f31125def36206b41c56 -
Branch / Tag:
refs/tags/v1.4.2 - Owner: https://github.com/26-jorge-01
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@26f7b3af9cac76abfe18f31125def36206b41c56 -
Trigger Event:
release
-
Statement type: