Skip to main content

Orquestador de consultas sobre SECOP desde el API del portal de datos abiertos.

Project description

pysecop 🇨🇴

Python 3.9+ License: MIT

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 processors for dates, URLs, and categorical encoding.
  • 🔗 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())

[!TIP] Use standardized column names like documento_proveedor, nit_entidad, and valor_del_contrato to search across all data regardless of the original government field names.


🏛️ 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysecop-1.2.0.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysecop-1.2.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file pysecop-1.2.0.tar.gz.

File metadata

  • Download URL: pysecop-1.2.0.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysecop-1.2.0.tar.gz
Algorithm Hash digest
SHA256 b2ca76e2242f070d2516bec102d08bd6c66ecc5121d9bdbc8a3fa63537abf1a5
MD5 55a3cda39894e715e7e64c569d4b5993
BLAKE2b-256 b780fb5b45eb8ebcad9135294dbd07ce63cf51a498818fdd79adb691b17a73ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysecop-1.2.0.tar.gz:

Publisher: python-publish.yml on 26-jorge-01/pysecop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pysecop-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: pysecop-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pysecop-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 360f7e634b6212ab218b07729abd7fc0bed67ca2210153b999652a54dcf003ea
MD5 4152dc09b6cf55f4b8cdf2b3e365eb77
BLAKE2b-256 2478d34b7e6800b5c8502842b1d371fe79558a3806337e7d5c845b70b52f4050

See more details on using hashes here.

Provenance

The following attestation bundles were made for pysecop-1.2.0-py3-none-any.whl:

Publisher: python-publish.yml on 26-jorge-01/pysecop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page