Mapping Sheet#
- ocdskit.mapping_sheet.mapping_sheet(schema, order_by=None, infer_required=False, extension_field=None, inherit_extension=True, include_codelist=False, include_deprecated=True, include_definitions=False, base_uri=None)[source]#
Returns information about all field paths in a JSON Schema, as columns and rows.
If
include_definitions=False
, this function resolves$ref
properties.- Parameters:
schema (dict) – a JSON schema
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
inherit_extension (bool) – whether fields defined via $ref properties inherit the “extension” value of their parent field
include_codelist (bool) – whether to include a “codelist” column
include_deprecated (bool) – whether to include any deprecated fields
include_definitions (bool) – whether to traverse the “definitions” property
base_uri (str) – the URL to resolve relative references against
- Returns:
information about all field paths in a JSON Schema, as columns and rows
- Return type:
The 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 notitle
, defaults to the field’s name followed by “*”.- Description:
The field’s
description
in the JSON schema. URLs are removed (see thelinks
column).- Type:
A comma-separated list of the field’s
type
in the JSON schema, excluding “null”. If the field has notype
, 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
: theformat
pattern
: thepattern
enum
: “Enum: “ followed by theenum
as a comma-separated list, excludingnull
items/enum
: “Enum: “ followed by theitems/enum
as a comma-separated list, excludingnull
- Codelist:
The field’s
codelist
in the JSON schema- 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 that introduced the JSON path (see the
extension_field
parameter)- Raises:
MissingColumnError – if the column by which to order is missing