Workflow to build new analysis pipelines for external government datasets (Peru Compras / Open Data).
This skill is for adding new processing capabilities to the open-data module.
It handles the ingestion, parsing, and visualization of large datasets (usually CSVs from government portals).
Locate lib/open-data.ts.
export interface RawOcamEntry {
"RUC PROVEEDOR": string;
"MONTO TOTAL": string; // Note: Raw data is often string
"FECHA FORMALIZACION": string;
// ...
}
Create/Edit lib/open-data-processing.ts.
Implement a normalization function that converts Raw Strings -> Typed Objects (Numbers, Dates).
export function normalizeOcamData(raw: RawOcamEntry[]): NormalizedEntry[] {
return raw.map(item => ({
amount: parseFloat(item["MONTO TOTAL"]),
vendor: item["RUC PROVEEDOR"],
date: parse(item["FECHA FORMALIZACION"], "dd/MM/yyyy", new Date())
}))
}
Implement specific business logic questions as pure functions.
competitor_matrix table.Since datasets are large, processing should happen on the server.
app/api/open-data/[analysis-type]/route.ts.Create components/open-data/[analysis-name]-chart.tsx.
recharts.