prepare command corrects quality issues within OCDS compiled releases in a line-delimited JSON file. Corrected data is written to one file, and quality issues are written to another file as CSV for review.
This command is designed to only warn about quality issues that (1) it can fix and (2) that interfere with the calculation of indicators. For comprehensive quality checking, consider using Pelican.
Command Syntax
Arguments
The path to the input file (or
- for standard input), in which each line is a contracting process as JSON text.Options
The path to the settings file. Use
-s as a shorthand. If not provided, default settings are used.The file to which to write corrected data (or
- for standard output). Use -o as a shorthand.The file to which to write quality issues (or
- for standard output). Use -e as a shorthand.Increase verbosity. Use
-v as a shorthand. Can be repeated for more verbosity.Output Format
Corrected Data
Corrected data is written as line-delimited JSON, with one compiled release per line.Quality Issues
Quality issues are written as CSV rows with these columns:| Column | Description |
|---|---|
| line | Line number of the problematic compiled release in the input file |
| ocid | OCID of the problematic compiled release (for finding it in other systems) |
| path | JSON path to the field with an issue (useful for sorting and filtering) |
| array indexes | Index of the problematic array entry (if path contains arrays) |
| incorrect value | The value that caused the issue (blank if field isn’t set) |
| error description | Description of the issue (see table below) |
Error Descriptions
| Error Description | Meaning | Solution |
|---|---|---|
| not set | The field isn’t set | Fill in missing values |
| invalid | The code isn’t valid | Re-map incorrect codes |
| is zero | The bid’s value is zero | Redact incorrect values |
Usage Examples
Example Quality Issues Output
Given this input file with a bid missing a status:Configuration
Theprepare command can be configured through a settings file. Initialize one with:
Automatic Corrections
These corrections are always applied and cannot be disabled:Correct Structural Errors
Replaces objects with arrays where OCDS expects arrays:/bids/details[]/tenderers/awards/suppliers
Normalize ID Fields
Converts ID fields from integers to strings to prevent lookup failures:/parties[]/id/buyer/id/tender/procuringEntity/id/bids/details[]/tenderers[]/id/awards[]/id/awards[]/suppliers[]/id/awards[]/items[]/classification/id/contracts[]/awardID
Fill in Missing Values
Add a[defaults] section to fill in missing fields:
/bids/details[]/value/currency/bids/details[]/items[]/classification/scheme/bids/details[]/status/awards[]/items[]/classification/scheme/awards[]/status/parties[]/roles[](whenparty_roles = true)
Redact Incorrect Values
Monetary Amounts
Redact placeholder amount values:/bids/details[]/value/amount
Organization IDs
Redact placeholder organization IDs:/parties[]/id/buyer/id/tender/procuringEntity/id/bids/details[]/tenderers[]/id/awards[]/suppliers[]/id
Re-map Invalid Codes
Substitute invalid codelist values:Move Auction Bids
Move non-standard auction bids to the standard location:/auctions[]/stages[]/bids[] to /bids/details[].
Prefix Organization IDs
Add prefixes to organization IDs to match/parties[] entries:
/buyer/id/tender/procuringEntity/id/bids/details[]/tenderers[]/id/awards[]/suppliers[]/id
Standardize Unconstrained Values
Split and standardize text values:/tender/procurementMethodDetails
Replace Incorrect Award Statuses
Change award status based on contract statuses:Workflow
Review quality issues
Open
issues.csv in a spreadsheet application to review problems. Most issues are repetitive and can be fixed at once with configuration changes.Next Steps
Indicators Command
Calculate procurement indicators from prepared data
Coverage Command
Analyze field coverage in your data
