Mapping Sheet

ocdskit.mapping_sheet.mapping_sheet(schema, io, order_by=None, infer_required=False, extension_field=None)[source]

Writes information about all field paths in a JSON Schema to a CSV file.

Parameters:
  • schema (dict) – a JSON schema
  • io – a file-like object to which to write the rows
  • order_by (str) – the column by which to sort the rows
  • infer_required (bool) – whether to infer that a field is required if “null” is not in its type
  • extension_field (str) – the property in the JSON schema containing the name of the extension in which each field was defined

The CSV’s columns are:

Section:

The first part of the JSON path to the field in the data, e.g. tender

Path:

The JSON path to the field in the data, e.g. tender/id

Title:

The field’s title in the JSON schema. If the field has no title, defaults to the field’s name followed by “*”.

Description:

The field’s description in the JSON schema. URLs are removed (see the links column).

Type:

A comma-separated list of the field’s type in the JSON schema, excluding “null”. If the field has no type, defaults to “unknown”.

Range:

The field’s allowed number of occurrences.

  • “0..1” if the field defines an optional literal value.
  • “0..n” if the field defines an optional array.
  • “1..1” if the field defines a required literal value.
  • “1..n” if the field defines a required array.
Values:

If the field’s schema sets:

  • format: the format
  • pattern: the pattern
  • enum: “Enum: ” followed by the enum as a comma-separated list, excluding null
  • items/enum: “Enum: ” followed by the items/enum as a comma-separated list, excluding null
Links:

The URLs extracted from the field’s description

Deprecated:

The OCDS minor version in which the field (or its parent) was deprecated

DeprecationNotes:
 

The explanation for the deprecation of the field

Extension:

The name of the extension in which the field was defined (see the extension_field parameter)