Checks¶
This page describes the checks performed by the pythonvalidate CLI command and Python API. There are three categories of check:
Conformance: Check data conforms to normative rules specified in the descriptions of OFDS fields, but not otherwise encoded in the OFDS schema. For more information on the rules, see Other normative rules in the OFDS Development Handbook.
Quality: Check other aspects of data quality.
Information: Check other facts about data, not related to conformance or quality.
The CLI command and Python API return a list of check failures, each represented by a JSON object with at least the following properties:
type: the type of check failurenetwork_id: the.idof the network that failed the checkpath: the JSON path to the field that failed the check
Some check failures include additional properties with further details of the failure, specific to the nature of the check.
Conformance checks¶
Node reference is resolvable¶
spans/start and spans/end match the .id of exactly one node in the /nodes array.
Failure type:
span_start_node_not_foundspan_end_node_not_found
Additional properties:
span_id: The.idof the span that failed the checkmissing_node_id: The node reference that could not be resolved
Node location type is ‘Point’¶
nodes/location/type is ‘Point’.
Failure type: node_location_type_incorrect
Additional properties:
node_id: The.idof the node that failed the checkincorrect_type: The.location.typeof the node that failed the check
Node location coordinates format is a single position¶
nodes/location/coordinates is a single position, i.e. an array of numbers.
Failure type: node_location_coordinates_incorrect
Additional properties:
node_id: The.idof the node that failed the checkincorrect_coordinates: The.location.coordinatesof the node that failed the check
Span route type is ‘LineString’¶
spans/route/type is ‘LineString’.
Failure type: span_route_type_incorrect
Additional properties:
span_id: The.idof the span that failed the checkincorrect_type: The.location.typeof the node that failed the check
Span route coordinates is an array of positions¶
spans/route/coordinates is an array of positions, i.e. an array of arrays of numbers.
Failure type: span_route_coordinates_incorrect
Additional properties:
span_id: The.idof the span that failed the checkincorrect_coordinates: The.route.coordinatesof the span that failed the check
Phase reference is resolvable¶
/nodes/phase/id, /spans/phase/id and /contracts/relatedPhases/id match the .id of exactly one phase in the /phases array.
Failure type:
node_phase_reference_id_not_foundspan_phase_reference_id_not_foundcontract_related_phase_reference_id_not_found
Additional properties:
node_id,span_idorcontract_id: The.idof the node, span or contract that failed the checkphase_id_not_foundthe.idof the phase reference that could not be resolved
Phase reference name is consistent¶
/nodes/phase/name, /spans/phase/name and /contracts/relatedPhases/name match the .name of the referenced Phase object in the /phases array.
Failure type:
node_phase_reference_name_does_not_matchspan_phase_reference_name_does_not_matchcontract_related_phase_reference_name_does_not_match
Additional properties:
node_id,span_idorcontract_id: The.idof the node, span or contract that failed the checkname_in_reference: The.nameof the phase referencename_should_be: The.nameof the referenced phrase
Organisation reference is resolvable¶
The following fields match the .id of exactly one organisation in the /organisations array:
/nodes/physicalInfrastructureProvider/id/nodes/networkProvider/id/spans/physicalInfrastructureProvider/id/spans/networkProvider/id/spans/supplier/id/phases/funders/id
Failure type:
node_organisation_reference_id_not_foundspan_organisation_reference_id_not_foundphase_organisation_reference_id_not_found
Additional properties:
node_id,span_idorcontract_id: The.idof the node, span or contract that failed the checkfield: The organisation reference that could not be resolvedorganisation_id_not_found: The.idof the organisation reference that could not be resolved
Organisation reference name is consistent¶
The following fields match the .name of the referenced Organisation object in the /organisations array.
/nodes/physicalInfrastructureProvider/name/nodes/networkProvider/name/spans/physicalInfrastructureProvider/name/spans/networkProvider/name/spans/supplier/name/phases/funders/name
Failure type:
node_organisation_reference_name_does_not_matchspan_organisation_reference_name_does_not_matchphase_organisation_reference_name_does_not_match
Additional properties:
node_id,span_idorphase_id: The.idof the node, span or phase that failed the checkfield: The organisation reference whose.nameis inconsistentname_in_reference: The.nameof the organisation referencename_should_be: The.nameof the referenced organisation
Node international connections country is set¶
/nodes/internationalConnections/country is set for each international connection in /nodes/internationalConnections.
Failure type: node_international_connections_country_not_set
Additional properties:
node_id: The.idof the node that failed the check
Identifier is unique¶
The following fields are unique within the scope of their parent arrays:
/nodes/id/spans/id/phases/id/organisations/id/contracts/id
Failure type:
duplicate_node_idduplicate_span_idduplicate_phase_idduplicate_organisation_idduplicate_contract_id
Additional properties:
node_id,span_id,phase_id,organisation_idorcontract_id: The.idof the node, span, phase, organisation or contract that failed the check
Quality checks¶
Node is referenced¶
nodes/id matches the .start or .end of at least one Span object in the /spans array.
Failure type: node_not_used_in_any_spans
Additional properties:
node_id: The.idof the node that failed the span
Informational checks¶
Links to external data¶
The links array contains a link with .rel set to one of the following values:
Failure type:
has_links_with_external_node_datahas_links_with_external_span_data