Linter

CIMPyORM supports linting CIM datasets against their schema definition using the lint function:

cimpyorm.lint(session, model)[source]

Check the model for missing obligatory values and references and for invalid references (foreign key validation) and return the results in a pandas pivot-table.

Parameters
  • session – The SQLAlchemy session object (obtained from parse/load).

  • model – The parsed CIMPyORM model (obtained from parse/load).

Returns

Pandas pivot-table.

The function yields a pandas pivot_table containing information about schema violations and model inconsistencies, namely:

  • Missing non-optional values (see Exploring on how to determine which fields are optional)

  • Missing references

  • Invalid references (foreign-key reference not found in referenced table)

Linting the ENTSO-E example FullGrid dataset against the CGMES 2.4.15 specification yields the following violations:

Unique violations Total violations
Type Class Total Property
Invalid SvVoltage 25 TopologicalNode 5.0 5
Terminal 144 ConnectivityNode 5.0 10
TopologicalNode 6.0 10
Missing ConnectivityNode 40 entsoe_boundaryPoint NaN 40
entsoe_fromEndIsoCode NaN 40
entsoe_fromEndName NaN 40
entsoe_fromEndNameTso NaN 40
entsoe_toEndIsoCode NaN 40
entsoe_toEndName NaN 40
entsoe_toEndNameTso NaN 40
IdentifiedObject 731 description NaN 2
entsoe_shortName NaN 2
OperationalLimitType 9 limitType NaN 9
Terminal 144 TopologicalNode NaN 40
TopologicalNode 20 entsoe_boundaryPoint NaN 20
entsoe_fromEndIsoCode NaN 20
entsoe_fromEndName NaN 20
entsoe_fromEndNameTso NaN 20
entsoe_toEndIsoCode NaN 20
entsoe_toEndName NaN 20
entsoe_toEndNameTso NaN 20

Note

As of version 0.6, the linter does not yet validate many-to-many relationships.