Documentation Index
Fetch the complete documentation index at: https://mintlify.com/open-contracting/cardinal-rs/llms.txt
Use this file to discover all available pages before exploring further.
Overview
This guide walks you through a complete Cardinal workflow using a real example. You’ll initialize settings, prepare OCDS data, and calculate procurement indicators.Prerequisites
- Cardinal installed via Cargo or pip
- OCDS data in line-delimited JSON format (compiled releases)
- Basic familiarity with the command line
Complete Workflow
Cardinal’s workflow consists of three main steps: initialize settings, prepare data, and calculate indicators.Step 1: Initialize Settings
Create a default configuration file that enables all indicators and documents all available options:Output
Output
settings.ini file with default values and extensive comments explaining each option.
View the settings file contents
View the settings file contents
- as the filename:Step 2: Prepare Your Data
Theprepare command corrects quality issues in your OCDS data and reports problems that could affect indicator calculations.
Run the prepare command
input.jsonl with your OCDS data file.Command breakdown
Command breakdown
input.jsonl: Your OCDS compiled releases (one JSON object per line)--settings settings.ini: Configuration file from step 1--output prepared.jsonl: Where to write corrected data--errors issues.csv: Where to write quality issue reports
Review quality issues
issues.csv to see reported quality issues. The CSV has these columns:| Column | Description |
|---|---|
| line | Line number in the input file |
| ocid | OCID of the contracting process |
| path | JSON path to the problematic field |
| array indexes | Index position if the field is in an array |
| incorrect value | The problematic value (blank if not set) |
| error description | Type of issue: not set, invalid, or is zero |
ocds-213czf-1 is missing a status field.Configure data corrections
settings.ini to fix quality issues automatically. For example, if bids are missing status values, add:Fill in missing currency
Fill in missing currency
Set default classification scheme
Set default classification scheme
Redact placeholder amounts
Redact placeholder amounts
Prefix organization IDs
Prefix organization IDs
Re-map invalid bid statuses
Re-map invalid bid statuses
Step 3: Calculate Indicators
Run red flag analysis on your prepared data:Command options
Command options
--count: Print the number of results per group to stderr--map: Include mappings from contracting processes to organizations--no-meta: Exclude statistical metadata from results
Step 4: Analyze Results
Openresults.json to view your indicator results.
Example output structure
Example output structure
Understanding the Output
Results are organized by group (OCID, Buyer, ProcuringEntity, Tenderer) and identifier:OCID group
OCID group
/ocid.Example: "ocds-213czf-1" triggered indicators R036 and R028.- R036: Lowest bid disqualified (value: 1.0 = true)
- R028: Identical bid prices (value: 1.0 = true)
Buyer group
Buyer group
/buyer/id.Example: Buyer "DO-UC-55216" has a high rate of disqualified bids (R038: 0.85).ProcuringEntity group
ProcuringEntity group
/tender/procuringEntity/id.Tenderer group
Tenderer group
/bids/details[]/tenderers[]/id.Example: Tenderer "DO-RPE-1422" has:- R025: Low win rate (0.12 = winning bid rate is a low outlier)
- R048: High variety of items supplied (2.5 = heterogeneous supplier)
Meta section
Meta section
Indicator Codes
Each code represents a specific red flag:| Code | Red Flag | Description |
|---|---|---|
| R003 | Short submission period | Submission period is too short |
| R018 | Single bid received | Only one tenderer submitted a bid |
| R024 | Price close to winning bid | Second-lowest bid is suspiciously close to winner |
| R025 | Excessive unsuccessful bids | Tenderer has low win rate (outlier) |
| R028 | Identical bid prices | Multiple tenderers submitted same price |
| R030 | Late bid won | Winning bid received after deadline |
| R035 | All except winner disqualified | Only winner’s bids were valid |
| R036 | Lowest bid disqualified | Lowest bid rejected despite price-only criterion |
| R038 | Excessive disqualified bids | High disqualification rate (outlier) |
| R048 | Heterogeneous supplier | Tenderer supplies unusually diverse items |
| R058 | Heavily discounted bid | Winner’s price is much lower than competitors |
Real-World Example
Let’s walk through a concrete example using sample data.Sample Data
Create a file calledexample.jsonl with this OCDS compiled release:
Run the Analysis
Common Workflows
Testing specific indicators
Testing specific indicators
Excluding specific procurement methods
Excluding specific procurement methods
Adjusting thresholds
Adjusting thresholds
Working with large datasets
Working with large datasets
-v for warnings, -vv for info, -vvv for debug output.Troubleshooting
No indicators are triggered
No indicators are triggered
- Settings file missing indicator sections: Check that indicators are enabled in
settings.ini - Data quality issues: Review
issues.csv- missing required fields prevent calculations - All data excluded: Check your
[exclusions]configuration - Currency mismatches: Cardinal excludes processes with non-primary currencies
Too many false positives
Too many false positives
- Adjust thresholds in your settings file for specific indicators
- Add exclusions for procurement methods that shouldn’t be analyzed
- Configure price comparison methods to exclude inappropriate procedures:
Prepare command reports many issues
Prepare command reports many issues
- Sort the CSV by the
pathcolumn to group similar issues - Add configuration to fix entire categories at once
- Focus on
not seterrors first - these prevent indicator calculations - Iterate - run prepare → review → configure → repeat
