From ee8e0df52e9a56bf252e82d310e19a2e7a4dade9 Mon Sep 17 00:00:00 2001 From: Stephen Epps Date: Tue, 25 Nov 2025 13:22:27 -0800 Subject: [PATCH 01/14] add admin_level to divisions schema --- schema/divisions/division.yaml | 6 ++++++ schema/divisions/division_area.yaml | 6 ++++++ schema/divisions/division_boundary.yaml | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/schema/divisions/division.yaml b/schema/divisions/division.yaml index f4eb4d008..ff15b4933 100644 --- a/schema/divisions/division.yaml +++ b/schema/divisions/division.yaml @@ -149,6 +149,12 @@ properties: # JSON Schema: Top-level object properties. parent divisions. allOf: - "$ref": "../defs.yaml#/$defs/propertyDefinitions/id" + admin_level: + description: + Integer representing this division's position in its country's administrative + hierarchy. Lower numbers correspond to higher-level administrative units. + type: integer + minimum: 0 perspectives: description: >- Political perspectives from which this division is considered diff --git a/schema/divisions/division_area.yaml b/schema/divisions/division_area.yaml index 985bdd60d..270958961 100644 --- a/schema/divisions/division_area.yaml +++ b/schema/divisions/division_area.yaml @@ -73,3 +73,9 @@ properties: # JSON Schema: Top-level object properties. belongs to. allOf: - "$ref": "../defs.yaml#/$defs/propertyDefinitions/iso3166_2SubdivisionCode" + admin_level: + description: + Integer representing the associated division's position in the country's + administrative hierarchy. Lower numbers correspond to higher-level divisions. + type: integer + minimum: 0 diff --git a/schema/divisions/division_boundary.yaml b/schema/divisions/division_boundary.yaml index f03134116..3613baaf7 100644 --- a/schema/divisions/division_boundary.yaml +++ b/schema/divisions/division_boundary.yaml @@ -92,6 +92,12 @@ properties: # JSON Schema: Top-level object properties. present on boundaries between different principal subdivisions or countries. allOf: - "$ref": "../defs.yaml#/$defs/propertyDefinitions/iso3166_2SubdivisionCode" + admin_level: + description: + Integer representing the administrative level shared by both divisions on the + boundary. Lower numbers correspond to higher-level administrative units. + type: integer + minimum: 0 is_disputed: description: >- Indicator if there are entities disputing this division boundary. From f6e0d237a9797bdd04f37bacf3e70a03185dbd50 Mon Sep 17 00:00:00 2001 From: Stephen Epps Date: Tue, 25 Nov 2025 13:25:39 -0800 Subject: [PATCH 02/14] add counterexample, update country yaml to support admin_level addition --- .../divisions/division/bad-admin-level.yaml | 21 +++++++++++++++++++ examples/divisions/division/country.yaml | 1 + 2 files changed, 22 insertions(+) create mode 100644 counterexamples/divisions/division/bad-admin-level.yaml diff --git a/counterexamples/divisions/division/bad-admin-level.yaml b/counterexamples/divisions/division/bad-admin-level.yaml new file mode 100644 index 000000000..80854412a --- /dev/null +++ b/counterexamples/divisions/division/bad-admin-level.yaml @@ -0,0 +1,21 @@ +--- +id: counterexample:division:bad-admin-level +type: Feature +geometry: + type: Point + coordinates: [0, 0] +properties: + theme: divisions + type: division + version: 0 + subtype: country + names: + primary: Invalid admin_level Example + country: ZZ + hierarchies: + - - division_id: counterexample:division:bad-admin-level + subtype: country + name: Invalid admin_level Example + admin_level: -1 + ext_expected_errors: + - "-1 is less than the minimum of 0" diff --git a/examples/divisions/division/country.yaml b/examples/divisions/division/country.yaml index c2c4d4a54..9d86f0e06 100644 --- a/examples/divisions/division/country.yaml +++ b/examples/divisions/division/country.yaml @@ -18,4 +18,5 @@ properties: name: United States norms: driving_side: right + admin_level: 0 capital_division_ids: [ example:division:locality:washington_dc ] From e39978f0d073f286564a552f6afa1bf9dc040c03 Mon Sep 17 00:00:00 2001 From: Stephen Epps Date: Tue, 25 Nov 2025 14:26:41 -0800 Subject: [PATCH 03/14] update ext_expected_errors to match the actual validator message --- counterexamples/divisions/division/bad-admin-level.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/counterexamples/divisions/division/bad-admin-level.yaml b/counterexamples/divisions/division/bad-admin-level.yaml index 80854412a..1bafc41e5 100644 --- a/counterexamples/divisions/division/bad-admin-level.yaml +++ b/counterexamples/divisions/division/bad-admin-level.yaml @@ -18,4 +18,4 @@ properties: name: Invalid admin_level Example admin_level: -1 ext_expected_errors: - - "-1 is less than the minimum of 0" + - "minimum: got -1, want 0" From 420480a47c1af8ea937296c6fa2a73b985564022 Mon Sep 17 00:00:00 2001 From: Stephen Epps Date: Wed, 26 Nov 2025 07:59:56 -0800 Subject: [PATCH 04/14] set admin_level to 1 for dependency --- examples/divisions/division/dependency.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/divisions/division/dependency.yaml b/examples/divisions/division/dependency.yaml index 98292a535..2708c8587 100644 --- a/examples/divisions/division/dependency.yaml +++ b/examples/divisions/division/dependency.yaml @@ -34,5 +34,6 @@ properties: name: United States norms: driving_side: right + admin_level: 1 capital_division_ids: [ example:division:locality:san_juan ] parent_division_id: example:division:country:us From 9102cc07ea43f2a32b793401fad1da5145dc8075 Mon Sep 17 00:00:00 2001 From: Stephen Epps Date: Mon, 1 Dec 2025 10:47:05 -0800 Subject: [PATCH 05/14] define admin_level in defs.yaml, add to required list --- schema/divisions/defs.yaml | 14 ++++++++++++++ schema/divisions/division.yaml | 10 +++------- schema/divisions/division_area.yaml | 8 ++------ schema/divisions/division_boundary.yaml | 10 +++------- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/schema/divisions/defs.yaml b/schema/divisions/defs.yaml index 4b3e3ec5d..caa2e70b1 100644 --- a/schema/divisions/defs.yaml +++ b/schema/divisions/defs.yaml @@ -57,6 +57,20 @@ description: Common schema definitions for divisions theme - microhood # A mini-neighborhood that is contained within a # division of type neighborhood. + admin_level: + description: + Integer representing this division's position in its country's + administrative hierarchy, where lower numbers correspond to higher + level administrative units. + + In Overture data releases, this value is typically equal to the + number of ancestor features in the division's primary hierarchy + (the one defined by following `parent_division_id`). Thus, a + country always has an `admin_level` of 0, a region has an + `admin_level` of 1, while further subdivisions have `admin_level` + values greater than 1. + type: integer + minimum: 0 hierarchy: description: A hierarchy of divisions, with the first entry being a country; diff --git a/schema/divisions/division.yaml b/schema/divisions/division.yaml index ff15b4933..b97b28224 100644 --- a/schema/divisions/division.yaml +++ b/schema/divisions/division.yaml @@ -27,10 +27,10 @@ properties: # JSON Schema: Top-level object properties. properties: subtype: { enum: [country] } then: - required: [names, subtype, country, hierarchies] + required: [names, subtype, country, hierarchies, admin_level] not: { required: [parent_division_id] } else: - required: [names, subtype, country, hierarchies, parent_division_id] + required: [names, subtype, country, hierarchies, parent_division_id, admin_level] properties: # JSON Schema: properties within GeoJSON top-level object 'properties' property subtype: { "$ref": "./defs.yaml#/$defs/propertyDefinitions/placetype" } class: @@ -150,11 +150,7 @@ properties: # JSON Schema: Top-level object properties. allOf: - "$ref": "../defs.yaml#/$defs/propertyDefinitions/id" admin_level: - description: - Integer representing this division's position in its country's administrative - hierarchy. Lower numbers correspond to higher-level administrative units. - type: integer - minimum: 0 + "$ref": "./defs.yaml#/$defs/propertyDefinitions/admin_level" perspectives: description: >- Political perspectives from which this division is considered diff --git a/schema/divisions/division_area.yaml b/schema/divisions/division_area.yaml index 270958961..ce057b390 100644 --- a/schema/divisions/division_area.yaml +++ b/schema/divisions/division_area.yaml @@ -22,7 +22,7 @@ properties: # JSON Schema: Top-level object properties. - "$ref": https://geojson.org/schema/MultiPolygon.json properties: # GeoJSON: top-level object 'properties' property. unevaluatedProperties: false - required: [names, subtype, class, country, division_id, is_land, is_territorial] + required: [names, subtype, class, country, division_id, is_land, is_territorial, admin_level] allOf: - "$ref": ../defs.yaml#/$defs/propertyContainers/overtureFeaturePropertiesContainer - "$ref": ../defs.yaml#/$defs/propertyContainers/namesContainer @@ -74,8 +74,4 @@ properties: # JSON Schema: Top-level object properties. allOf: - "$ref": "../defs.yaml#/$defs/propertyDefinitions/iso3166_2SubdivisionCode" admin_level: - description: - Integer representing the associated division's position in the country's - administrative hierarchy. Lower numbers correspond to higher-level divisions. - type: integer - minimum: 0 + "$ref": "./defs.yaml#/$defs/propertyDefinitions/admin_level" diff --git a/schema/divisions/division_boundary.yaml b/schema/divisions/division_boundary.yaml index 3613baaf7..65405683b 100644 --- a/schema/divisions/division_boundary.yaml +++ b/schema/divisions/division_boundary.yaml @@ -23,10 +23,10 @@ properties: # JSON Schema: Top-level object properties. properties: subtype: { enum: [country] } then: - required: [subtype, class, division_ids, is_land, is_territorial] + required: [subtype, class, division_ids, is_land, is_territorial, admin_level] not: { required: [country] } else: - required: [subtype, class, division_ids, is_land, is_territorial, country] + required: [subtype, class, division_ids, is_land, is_territorial, country, admin_level] oneOf: - properties: is_land: @@ -93,11 +93,7 @@ properties: # JSON Schema: Top-level object properties. allOf: - "$ref": "../defs.yaml#/$defs/propertyDefinitions/iso3166_2SubdivisionCode" admin_level: - description: - Integer representing the administrative level shared by both divisions on the - boundary. Lower numbers correspond to higher-level administrative units. - type: integer - minimum: 0 + "$ref": "./defs.yaml#/$defs/propertyDefinitions/admin_level" is_disputed: description: >- Indicator if there are entities disputing this division boundary. From 7742dde7493322ff77c8a2ff71a480a707ee601a Mon Sep 17 00:00:00 2001 From: Stephen Epps Date: Mon, 1 Dec 2025 11:04:55 -0800 Subject: [PATCH 06/14] remove admin_level as required --- schema/divisions/division.yaml | 4 ++-- schema/divisions/division_area.yaml | 2 +- schema/divisions/division_boundary.yaml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/schema/divisions/division.yaml b/schema/divisions/division.yaml index b97b28224..f8e8a5926 100644 --- a/schema/divisions/division.yaml +++ b/schema/divisions/division.yaml @@ -27,10 +27,10 @@ properties: # JSON Schema: Top-level object properties. properties: subtype: { enum: [country] } then: - required: [names, subtype, country, hierarchies, admin_level] + required: [names, subtype, country, hierarchies] not: { required: [parent_division_id] } else: - required: [names, subtype, country, hierarchies, parent_division_id, admin_level] + required: [names, subtype, country, hierarchies, parent_division_id] properties: # JSON Schema: properties within GeoJSON top-level object 'properties' property subtype: { "$ref": "./defs.yaml#/$defs/propertyDefinitions/placetype" } class: diff --git a/schema/divisions/division_area.yaml b/schema/divisions/division_area.yaml index ce057b390..68c7f0859 100644 --- a/schema/divisions/division_area.yaml +++ b/schema/divisions/division_area.yaml @@ -22,7 +22,7 @@ properties: # JSON Schema: Top-level object properties. - "$ref": https://geojson.org/schema/MultiPolygon.json properties: # GeoJSON: top-level object 'properties' property. unevaluatedProperties: false - required: [names, subtype, class, country, division_id, is_land, is_territorial, admin_level] + required: [names, subtype, class, country, division_id, is_land, is_territorial] allOf: - "$ref": ../defs.yaml#/$defs/propertyContainers/overtureFeaturePropertiesContainer - "$ref": ../defs.yaml#/$defs/propertyContainers/namesContainer diff --git a/schema/divisions/division_boundary.yaml b/schema/divisions/division_boundary.yaml index 65405683b..f66afc4ae 100644 --- a/schema/divisions/division_boundary.yaml +++ b/schema/divisions/division_boundary.yaml @@ -23,10 +23,10 @@ properties: # JSON Schema: Top-level object properties. properties: subtype: { enum: [country] } then: - required: [subtype, class, division_ids, is_land, is_territorial, admin_level] + required: [subtype, class, division_ids, is_land, is_territorial] not: { required: [country] } else: - required: [subtype, class, division_ids, is_land, is_territorial, country, admin_level] + required: [subtype, class, division_ids, is_land, is_territorial, country] oneOf: - properties: is_land: From 2812b60ac3e9e9c97bf5b96bf3727f51317eeafc Mon Sep 17 00:00:00 2001 From: Stephen Epps Date: Mon, 1 Dec 2025 11:43:16 -0800 Subject: [PATCH 07/14] update pydantic models with admin_level field --- .../src/overture/schema/divisions/division/models.py | 7 +++++++ .../src/overture/schema/divisions/division_area/models.py | 8 ++++++++ .../overture/schema/divisions/division_boundary/models.py | 8 ++++++++ 3 files changed, 23 insertions(+) diff --git a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division/models.py b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division/models.py index a8227d3e6..f2aa03d36 100644 --- a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division/models.py +++ b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division/models.py @@ -117,6 +117,13 @@ class Division( The default parent division is the parent division as seen from the default political perspective, if there is one, and is otherwise chosen somewhat arbitrarily. The hierarchies property can be used to inspect the exhaustive list of parent divisions.""", ), ] = None + admin_level: Annotated[ + int32 | None, + Field( + ge=0, + description="Integer representing this division's position in its country's administrative hierarchy, where lower numbers correspond to higher level administrative units.", + ), + ] = None # Optional diff --git a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_area/models.py b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_area/models.py index 5519b40e4..0838f93f7 100644 --- a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_area/models.py +++ b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_area/models.py @@ -16,6 +16,7 @@ Geometry, GeometryType, GeometryTypeConstraint, + int32, ) from overture.schema.system.ref import Id, Reference, Relationship from overture.schema.system.string import CountryCodeAlpha2, RegionCode @@ -93,3 +94,10 @@ class DivisionArea( description="ISO 3166-2 principal subdivision code of the division this area belongs to.", ), ] = None + admin_level: Annotated[ + int32 | None, + Field( + ge=0, + description="Integer representing this division's position in its country's administrative hierarchy, where lower numbers correspond to higher level administrative units.", + ), + ] = None diff --git a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_boundary/models.py b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_boundary/models.py index 5cd0fcc13..27d4c5b55 100644 --- a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_boundary/models.py +++ b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_boundary/models.py @@ -18,6 +18,7 @@ Geometry, GeometryType, GeometryTypeConstraint, + int32, ) from overture.schema.system.ref import Id, Reference, Relationship from overture.schema.system.string import CountryCodeAlpha2, RegionCode @@ -115,6 +116,13 @@ class DivisionBoundary( present on boundaries between different principal subdivisions or countries.""", ), ] = None + admin_level: Annotated[ + int32 | None, + Field( + ge=0, + description="Integer representing the shared administrative level of the divisions on either side of this boundary.", + ), + ] = None is_disputed: Annotated[ bool | None, Field( From 031105f54215cf7943eada355b765d94df8cbfb4 Mon Sep 17 00:00:00 2001 From: Stephen Epps Date: Mon, 1 Dec 2025 12:07:48 -0800 Subject: [PATCH 08/14] add admin_level to each baseline json --- .../tests/division_area_baseline_schema.json | 9 ++++++++- .../tests/division_baseline_schema.json | 9 ++++++++- .../tests/division_boundary_baseline_schema.json | 9 ++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/packages/overture-schema-divisions-theme/tests/division_area_baseline_schema.json b/packages/overture-schema-divisions-theme/tests/division_area_baseline_schema.json index b4ba3f48f..6e5f428bb 100644 --- a/packages/overture-schema-divisions-theme/tests/division_area_baseline_schema.json +++ b/packages/overture-schema-divisions-theme/tests/division_area_baseline_schema.json @@ -397,6 +397,13 @@ "title": "Is Territorial", "type": "boolean" }, + "admin_level": { + "description": "Integer representing this division's position in its country's administrative hierarchy, where lower numbers correspond to higher level administrative units.", + "maximum": 2147483647, + "minimum": 0, + "title": "Admin Level", + "type": "integer" + }, "names": { "$ref": "#/$defs/Names" }, @@ -464,4 +471,4 @@ ], "title": "division_area", "type": "object" -} \ No newline at end of file +} diff --git a/packages/overture-schema-divisions-theme/tests/division_baseline_schema.json b/packages/overture-schema-divisions-theme/tests/division_baseline_schema.json index 53434bd29..51c58c7a6 100644 --- a/packages/overture-schema-divisions-theme/tests/division_baseline_schema.json +++ b/packages/overture-schema-divisions-theme/tests/division_baseline_schema.json @@ -522,6 +522,13 @@ "title": "Parent Division Id", "type": "string" }, + "admin_level": { + "description": "Integer representing this division's position within its country's administrative hierarchy, where lower numbers correspond to higher level administrative units.", + "maximum": 2147483647, + "minimum": 0, + "title": "Admin Level", + "type": "integer" + }, "perspectives": { "$ref": "#/$defs/Perspectives", "description": "Political perspectives from which this division is considered to be an accurate representation.\n\nIf this property is absent, then this division is not known to be disputed from any political perspective. Consequently, there is only one division feature representing the entire real world entity.\n\nIf this property is present, it means the division represents one of several alternative perspectives on the same real-world entity.\n\nThere are two modes of perspective:\n\n1. `accepted_by` means the representation of the division is accepted by the listed entities and would be included on a map drawn from their perspective.\n\n2. `disputed_by` means the representation of the division is disputed by the listed entities and would be excluded from a map drawn from their perspective.\n\nWhen drawing a map from the perspective of a given country, one would start by gathering all the undisputed divisions (with no `perspectives` property), and then adding to that first all divisions explicitly accepted by the country, and second all divisions not explicitly disputed by the country." @@ -602,4 +609,4 @@ ], "title": "division", "type": "object" -} \ No newline at end of file +} diff --git a/packages/overture-schema-divisions-theme/tests/division_boundary_baseline_schema.json b/packages/overture-schema-divisions-theme/tests/division_boundary_baseline_schema.json index c76a177e8..155cdf86d 100644 --- a/packages/overture-schema-divisions-theme/tests/division_boundary_baseline_schema.json +++ b/packages/overture-schema-divisions-theme/tests/division_boundary_baseline_schema.json @@ -324,6 +324,13 @@ "title": "Is Territorial", "type": "boolean" }, + "admin_level": { + "description": "Integer representing the shared administrative level of the divisions on this boundary, where lower numbers correspond to higher level administrative units.", + "maximum": 2147483647, + "minimum": 0, + "title": "Admin Level", + "type": "integer" + }, "perspectives": { "$ref": "#/$defs/Perspectives", "description": "Political perspectives from which this division boundary is considered to be an accurate representation.\n\nIf this property is absent, then this boundary is not known to be disputed from any political perspective. Consequently, there is only one boundary feature representing the entire real world entity.\n\nIf this property is present, it means the boundary represents one of several alternative perspectives on the same real-world entity.\n\nThere are two modes of perspective:\n\n 1. `accepted_by` means the representation of the boundary is accepted by the listed entities and would be included on a map drawn from their perspective.\n\n 2. `disputed_by` means the representation of the boundary is disputed by the listed entities and would be excluded from a map drawn from their perspective.\n\nWhen drawing a map from the perspective of a given country, one would start by gathering all the undisputed boundary (with no `perspectives` property), and then adding to that first all boundary explicitly accepted by the country, and second all boundary not explicitly disputed by the country." @@ -390,4 +397,4 @@ ], "title": "boundary", "type": "object" -} \ No newline at end of file +} From d087a624fddea942c19a65b5e3ab4f81af31b525 Mon Sep 17 00:00:00 2001 From: Stephen Epps Date: Tue, 2 Dec 2025 09:25:52 -0800 Subject: [PATCH 09/14] make admin_level required for county and above, update schema and examples --- .../divisions/division/bad-capital-division-id.yaml | 1 + counterexamples/divisions/division/bad-country.yaml | 1 + .../division/bad-geometry-coordinates.yaml | 1 + .../divisions/division/bad-geometry-type.yaml | 1 + .../divisions/division/bad-hierarchies.yaml | 1 + counterexamples/divisions/division/bad-names.yaml | 1 + counterexamples/divisions/division/bad-norms.yaml | 1 + .../divisions/division/bad-parent-division-id.yaml | 1 + counterexamples/divisions/division/bad-region.yaml | 1 + .../division/parent-not-allowed-on-country.yaml | 1 + .../division/parent-required-on-sub-country.yaml | 1 + .../divisions/division_area/bad-class.yaml | 1 + .../divisions/division_area/bad-country.yaml | 1 + .../divisions/division_area/bad-division-id.yaml | 1 + .../division_area/bad-geometry-coordinates.yaml | 1 + .../divisions/division_area/bad-geometry-type.yaml | 1 + .../divisions/division_area/bad-is-land.yaml | 1 + .../divisions/division_area/bad-is-territorial.yaml | 1 + .../division_area/bad-missing-is-land.yaml | 9 +++++---- .../divisions/division_area/bad-region.yaml | 1 + .../divisions/division_boundary/bad-class.yaml | 1 + .../division_boundary/bad-division_ids-1.yaml | 1 + .../division_boundary/bad-division_ids-2.yaml | 1 + .../divisions/division_boundary/bad-is-land.yaml | 1 + .../division_boundary/bad-is-territorial.yaml | 3 ++- .../divisions/division_boundary/bad-not-both.yaml | 3 ++- .../divisions/division_boundary/missing-class.yaml | 1 + .../division_boundary/missing-country.yaml | 3 ++- .../division_boundary/missing-division_ids.yaml | 1 + .../division/multiple_capital_division.yaml | 1 + examples/divisions/division/perspectives.yaml | 1 + examples/divisions/division/population.yaml | 1 + examples/divisions/division/region.yaml | 1 + examples/divisions/division_area/country_land.yaml | 1 + .../divisions/division_area/country_maritime.yaml | 1 + examples/divisions/division_area/is_land.yaml | 3 ++- .../divisions/division_area/is_territorial.yaml | 1 + examples/divisions/division_area/region_land.yaml | 1 + examples/divisions/division_boundary/disputed.yaml | 1 + .../divisions/division_boundary/disputed_both.yaml | 1 + examples/divisions/division_boundary/is_land.yaml | 3 ++- .../divisions/division_boundary/is_territorial.yaml | 3 ++- .../divisions/division_boundary/land_county.yaml | 1 + .../divisions/division_boundary/land_region.yaml | 1 + .../division_boundary/maritime_country.yaml | 1 + .../overture/schema/divisions/division/models.py | 7 +++++++ .../schema/divisions/division_area/models.py | 12 +++++++++++- .../schema/divisions/division_boundary/models.py | 7 +++++++ .../divisions/division_area/country_land.yaml | 1 + .../divisions/division_area/country_maritime.yaml | 1 + .../examples/divisions/division_area/is_land.yaml | 3 ++- .../divisions/division_area/is_territorial.yaml | 1 + .../divisions/division_area/region_land.yaml | 1 + schema/divisions/division.yaml | 13 +++++++++++++ schema/divisions/division_area.yaml | 13 +++++++++++++ schema/divisions/division_boundary.yaml | 13 +++++++++++++ 56 files changed, 125 insertions(+), 12 deletions(-) diff --git a/counterexamples/divisions/division/bad-capital-division-id.yaml b/counterexamples/divisions/division/bad-capital-division-id.yaml index fa6822397..5d3ce804a 100644 --- a/counterexamples/divisions/division/bad-capital-division-id.yaml +++ b/counterexamples/divisions/division/bad-capital-division-id.yaml @@ -18,6 +18,7 @@ properties: name: A division with an invalid capital_division_id property. norms: driving_side: right + admin_level: 0 capital_division_ids: [' '] ext_expected_errors: - "' ' does not match pattern" diff --git a/counterexamples/divisions/division/bad-country.yaml b/counterexamples/divisions/division/bad-country.yaml index f0e9566b8..6d7c758ad 100644 --- a/counterexamples/divisions/division/bad-country.yaml +++ b/counterexamples/divisions/division/bad-country.yaml @@ -18,6 +18,7 @@ properties: name: A division with an invalid country property. norms: driving_side: left + admin_level: 0 ext_expected_errors: - "maxLength: got 3, want 2" - "'ZZZ' does not match pattern" diff --git a/counterexamples/divisions/division/bad-geometry-coordinates.yaml b/counterexamples/divisions/division/bad-geometry-coordinates.yaml index dc1cb3615..cd76b46e8 100644 --- a/counterexamples/divisions/division/bad-geometry-coordinates.yaml +++ b/counterexamples/divisions/division/bad-geometry-coordinates.yaml @@ -18,5 +18,6 @@ properties: name: A division with invalid geometry coordinates. norms: driving_side: left + admin_level: 0 ext_expected_errors: - "properties/coordinates/items/type]: got string, want number" diff --git a/counterexamples/divisions/division/bad-geometry-type.yaml b/counterexamples/divisions/division/bad-geometry-type.yaml index 5071b949b..147bdc871 100644 --- a/counterexamples/divisions/division/bad-geometry-type.yaml +++ b/counterexamples/divisions/division/bad-geometry-type.yaml @@ -18,5 +18,6 @@ properties: name: A division with an invalid geometry type. norms: driving_side: left + admin_level: 0 ext_expected_errors: - "value must be 'Point'" diff --git a/counterexamples/divisions/division/bad-hierarchies.yaml b/counterexamples/divisions/division/bad-hierarchies.yaml index a75612536..d2818ddd4 100644 --- a/counterexamples/divisions/division/bad-hierarchies.yaml +++ b/counterexamples/divisions/division/bad-hierarchies.yaml @@ -20,6 +20,7 @@ properties: - division_id: counterexample:division:bad-hierarchies-county name: bar - [] + admin_level: 2 norms: driving_side: left ext_expected_errors: diff --git a/counterexamples/divisions/division/bad-names.yaml b/counterexamples/divisions/division/bad-names.yaml index fe2987feb..5981f6aef 100644 --- a/counterexamples/divisions/division/bad-names.yaml +++ b/counterexamples/divisions/division/bad-names.yaml @@ -20,6 +20,7 @@ properties: name: A division with invalid names norms: driving_side: left + admin_level: 0 ext_expected_errors: - "/propertyDefinitions/allNames/properties/primary/type]: got null, want string" - additional properties 'a-b-c-d-e-f-g-h-i-j-k-l' not allowed diff --git a/counterexamples/divisions/division/bad-norms.yaml b/counterexamples/divisions/division/bad-norms.yaml index bdc9847d9..721832ec2 100644 --- a/counterexamples/divisions/division/bad-norms.yaml +++ b/counterexamples/divisions/division/bad-norms.yaml @@ -19,6 +19,7 @@ properties: norms: driving_side: middle random_property: 10 + admin_level: 0 ext_expected_errors: - "value must be one of 'left', 'right'" - "/properties/properties/properties/norms/unevaluatedProperties]: false schema" diff --git a/counterexamples/divisions/division/bad-parent-division-id.yaml b/counterexamples/divisions/division/bad-parent-division-id.yaml index bb5d89ec1..3c4957b3e 100644 --- a/counterexamples/divisions/division/bad-parent-division-id.yaml +++ b/counterexamples/divisions/division/bad-parent-division-id.yaml @@ -21,6 +21,7 @@ properties: name: A division with an invalid parent division ID norms: driving_side: right + admin_level: 1 parent_division_id: " " ext_expected_errors: - "' ' does not match pattern" diff --git a/counterexamples/divisions/division/bad-region.yaml b/counterexamples/divisions/division/bad-region.yaml index 27faecb21..4ffcae64c 100644 --- a/counterexamples/divisions/division/bad-region.yaml +++ b/counterexamples/divisions/division/bad-region.yaml @@ -20,6 +20,7 @@ properties: - division_id: counterexample:division:bad-region subtype: region name: A division with an invalid ISO 3166-2 primary subdivision code ('region') + admin_level: 1 parent_division_id: counterexample:division:some-parent-division ext_expected_errors: - "minLength: got 3, want 4" diff --git a/counterexamples/divisions/division/parent-not-allowed-on-country.yaml b/counterexamples/divisions/division/parent-not-allowed-on-country.yaml index 9f0ef2cee..0d75c6945 100644 --- a/counterexamples/divisions/division/parent-not-allowed-on-country.yaml +++ b/counterexamples/divisions/division/parent-not-allowed-on-country.yaml @@ -16,6 +16,7 @@ properties: - - division_id: counterexample:division:parent-not-allowed-on-country subtype: country name: A country division that has a parent ID, which is not allowed + admin_level: 0 parent_division_id: counterexample:division:some-parent-division ext_expected_errors: - "[S#/properties/properties/allOf/3/then]: not failed" diff --git a/counterexamples/divisions/division/parent-required-on-sub-country.yaml b/counterexamples/divisions/division/parent-required-on-sub-country.yaml index cd58ef39a..811617189 100644 --- a/counterexamples/divisions/division/parent-required-on-sub-country.yaml +++ b/counterexamples/divisions/division/parent-required-on-sub-country.yaml @@ -20,5 +20,6 @@ properties: - division_id: counterexample:division:parent-required-on-sub-country subtype: region name: A sub-country division that lacks a parent ID + admin_level: 1 ext_expected_errors: - "missing property 'parent_division_id'" diff --git a/counterexamples/divisions/division_area/bad-class.yaml b/counterexamples/divisions/division_area/bad-class.yaml index fd1a0e58c..1dbeed9ee 100644 --- a/counterexamples/divisions/division_area/bad-class.yaml +++ b/counterexamples/divisions/division_area/bad-class.yaml @@ -14,5 +14,6 @@ properties: names: primary: A division area with an invalid class property. country: ZZ + admin_level: 0 ext_expected_errors: - "value must be one of 'land', 'maritime'" diff --git a/counterexamples/divisions/division_area/bad-country.yaml b/counterexamples/divisions/division_area/bad-country.yaml index a32280d71..3665bb5a3 100644 --- a/counterexamples/divisions/division_area/bad-country.yaml +++ b/counterexamples/divisions/division_area/bad-country.yaml @@ -14,6 +14,7 @@ properties: names: primary: A division area with an invalid country property. country: ZZZ + admin_level: 0 ext_expected_errors: - "maxLength: got 3, want 2" - "'ZZZ' does not match pattern" diff --git a/counterexamples/divisions/division_area/bad-division-id.yaml b/counterexamples/divisions/division_area/bad-division-id.yaml index 56fa81d24..9b3f79f42 100644 --- a/counterexamples/divisions/division_area/bad-division-id.yaml +++ b/counterexamples/divisions/division_area/bad-division-id.yaml @@ -14,5 +14,6 @@ properties: names: primary: A division area with an invalid division ID property. country: ZZ + admin_level: 0 ext_expected_errors: - "'abc ' does not match pattern" diff --git a/counterexamples/divisions/division_area/bad-geometry-coordinates.yaml b/counterexamples/divisions/division_area/bad-geometry-coordinates.yaml index 109efaa70..1d645e3f0 100644 --- a/counterexamples/divisions/division_area/bad-geometry-coordinates.yaml +++ b/counterexamples/divisions/division_area/bad-geometry-coordinates.yaml @@ -14,5 +14,6 @@ properties: names: primary: A division area with invalid geometry coordinates. country: ZZ + admin_level: 0 ext_expected_errors: - got number, want array diff --git a/counterexamples/divisions/division_area/bad-geometry-type.yaml b/counterexamples/divisions/division_area/bad-geometry-type.yaml index 4c5352743..0a2b4c6e7 100644 --- a/counterexamples/divisions/division_area/bad-geometry-type.yaml +++ b/counterexamples/divisions/division_area/bad-geometry-type.yaml @@ -14,6 +14,7 @@ properties: names: primary: A division area with an invalid geometry type. country: ZZ + admin_level: 0 ext_expected_errors: - "/properties/type/enum]: value must be 'Polygon'" - "/properties/type/enum]: value must be 'MultiPolygon'" diff --git a/counterexamples/divisions/division_area/bad-is-land.yaml b/counterexamples/divisions/division_area/bad-is-land.yaml index d83b8b2f1..d5368bf93 100644 --- a/counterexamples/divisions/division_area/bad-is-land.yaml +++ b/counterexamples/divisions/division_area/bad-is-land.yaml @@ -12,5 +12,6 @@ properties: division_id: counterexample:division_boundary:some-division is_land: yes country: ZZ + admin_level: 0 ext_expected_errors: - "is_land/type]: got string, want boolean" diff --git a/counterexamples/divisions/division_area/bad-is-territorial.yaml b/counterexamples/divisions/division_area/bad-is-territorial.yaml index 31282ee4a..5bb2bd8b1 100644 --- a/counterexamples/divisions/division_area/bad-is-territorial.yaml +++ b/counterexamples/divisions/division_area/bad-is-territorial.yaml @@ -13,5 +13,6 @@ properties: is_territorial: no is_land: true country: ZZ + admin_level: 0 ext_expected_errors: - "is_territorial/type]: got string, want boolean" diff --git a/counterexamples/divisions/division_area/bad-missing-is-land.yaml b/counterexamples/divisions/division_area/bad-missing-is-land.yaml index 3c7018342..98842b080 100644 --- a/counterexamples/divisions/division_area/bad-missing-is-land.yaml +++ b/counterexamples/divisions/division_area/bad-missing-is-land.yaml @@ -8,7 +8,8 @@ properties: theme: divisions type: division_area version: 0 - subtype: country - division_id: counterexample:division_boundary:some-division - is_territorial: false - country: ZZ \ No newline at end of file + subtype: country + division_id: counterexample:division_boundary:some-division + is_territorial: false + country: ZZ + admin_level: 0 diff --git a/counterexamples/divisions/division_area/bad-region.yaml b/counterexamples/divisions/division_area/bad-region.yaml index c35633c40..d9edc8f1c 100644 --- a/counterexamples/divisions/division_area/bad-region.yaml +++ b/counterexamples/divisions/division_area/bad-region.yaml @@ -15,6 +15,7 @@ properties: primary: A division area with an invalid ISO 3166-2 primary subdivision code ('region') country: ZZ region: this just seems wrong + admin_level: 1 ext_expected_errors: - "/propertyDefinitions/iso3166_2SubdivisionCode/maxLength]: maxLength: got 21, want 6" - "'this just seems wrong' does not match pattern" diff --git a/counterexamples/divisions/division_boundary/bad-class.yaml b/counterexamples/divisions/division_boundary/bad-class.yaml index 698be511e..19ef8d3e7 100644 --- a/counterexamples/divisions/division_boundary/bad-class.yaml +++ b/counterexamples/divisions/division_boundary/bad-class.yaml @@ -9,6 +9,7 @@ properties: type: division_boundary version: 0 subtype: country + admin_level: 0 class: foo divisions: ["example:division:country:left", "example:division:country:right"] is_disputed: false diff --git a/counterexamples/divisions/division_boundary/bad-division_ids-1.yaml b/counterexamples/divisions/division_boundary/bad-division_ids-1.yaml index e72f326d2..092efd36e 100644 --- a/counterexamples/divisions/division_boundary/bad-division_ids-1.yaml +++ b/counterexamples/divisions/division_boundary/bad-division_ids-1.yaml @@ -9,6 +9,7 @@ properties: type: division_boundary version: 1 subtype: region + admin_level: 1 class: land country: "XX" division_ids: ["example:division:country:left", "example:division:country:right", "example:division:country:right", 123] diff --git a/counterexamples/divisions/division_boundary/bad-division_ids-2.yaml b/counterexamples/divisions/division_boundary/bad-division_ids-2.yaml index 3bfedeee5..6d1324af4 100644 --- a/counterexamples/divisions/division_boundary/bad-division_ids-2.yaml +++ b/counterexamples/divisions/division_boundary/bad-division_ids-2.yaml @@ -9,6 +9,7 @@ properties: type: division_boundary version: 1 subtype: county + admin_level: 2 country: "XX" class: land division_ids: ["example:division:country:lonelylhsdivision"] diff --git a/counterexamples/divisions/division_boundary/bad-is-land.yaml b/counterexamples/divisions/division_boundary/bad-is-land.yaml index 11835e6ab..1deea2cad 100644 --- a/counterexamples/divisions/division_boundary/bad-is-land.yaml +++ b/counterexamples/divisions/division_boundary/bad-is-land.yaml @@ -9,6 +9,7 @@ properties: type: division_boundary version: 0 subtype: country + admin_level: 0 division_ids: ["example:division:country:left", "example:division:country:right"] is_land: yes is_territorial: false diff --git a/counterexamples/divisions/division_boundary/bad-is-territorial.yaml b/counterexamples/divisions/division_boundary/bad-is-territorial.yaml index 4ee7d2afc..7b7bf9618 100644 --- a/counterexamples/divisions/division_boundary/bad-is-territorial.yaml +++ b/counterexamples/divisions/division_boundary/bad-is-territorial.yaml @@ -9,10 +9,11 @@ properties: type: division_boundary version: 0 subtype: country + admin_level: 0 division_ids: ["example:division:country:left", "example:division:country:right"] class: land is_territorial: no is_land: true country: ZZ ext_expected_errors: - - "is_territorial/type]: got string, want boolean" \ No newline at end of file + - "is_territorial/type]: got string, want boolean" diff --git a/counterexamples/divisions/division_boundary/bad-not-both.yaml b/counterexamples/divisions/division_boundary/bad-not-both.yaml index bee287fe9..fa6f095bf 100644 --- a/counterexamples/divisions/division_boundary/bad-not-both.yaml +++ b/counterexamples/divisions/division_boundary/bad-not-both.yaml @@ -9,9 +9,10 @@ properties: type: division_boundary version: 1 subtype: country + admin_level: 0 is_land: true is_territorial: true class: land division_ids: ["example:division:country:left", "example:division:country:right"] ext_expected_errors: - - "division_boundary.yaml#/properties/properties/oneOf]: oneOf failed, subschemas 0, 1 matched" \ No newline at end of file + - "division_boundary.yaml#/properties/properties/oneOf]: oneOf failed, subschemas 0, 1 matched" diff --git a/counterexamples/divisions/division_boundary/missing-class.yaml b/counterexamples/divisions/division_boundary/missing-class.yaml index 287516eb2..9952db2e1 100644 --- a/counterexamples/divisions/division_boundary/missing-class.yaml +++ b/counterexamples/divisions/division_boundary/missing-class.yaml @@ -9,6 +9,7 @@ properties: type: division_boundary version: 0 subtype: macroregion + admin_level: 1 is_territorial: true is_land: false country: "XX" diff --git a/counterexamples/divisions/division_boundary/missing-country.yaml b/counterexamples/divisions/division_boundary/missing-country.yaml index 73462f91a..6efbd4ceb 100644 --- a/counterexamples/divisions/division_boundary/missing-country.yaml +++ b/counterexamples/divisions/division_boundary/missing-country.yaml @@ -9,9 +9,10 @@ properties: type: division_boundary version: 0 subtype: region + admin_level: 1 is_territorial: true is_land: false class: land division_ids: ["example:division:country:left", "example:division:country:right"] ext_expected_errors: - - "missing property 'country'" \ No newline at end of file + - "missing property 'country'" diff --git a/counterexamples/divisions/division_boundary/missing-division_ids.yaml b/counterexamples/divisions/division_boundary/missing-division_ids.yaml index 96f014e57..02505eab0 100644 --- a/counterexamples/divisions/division_boundary/missing-division_ids.yaml +++ b/counterexamples/divisions/division_boundary/missing-division_ids.yaml @@ -12,6 +12,7 @@ properties: is_territorial: false is_land: true subtype: macrocounty + admin_level: 2 country: "XX" ext_expected_errors: - "missing property 'division_ids'" diff --git a/examples/divisions/division/multiple_capital_division.yaml b/examples/divisions/division/multiple_capital_division.yaml index 0e8e890be..ee8fb19eb 100644 --- a/examples/divisions/division/multiple_capital_division.yaml +++ b/examples/divisions/division/multiple_capital_division.yaml @@ -26,5 +26,6 @@ properties: - division_id: example:division:region:pl-04 subtype: region name: Woj Kujawsko-Pomorskie + admin_level: 1 capital_division_ids: [ example:division:locality:bydgoszcz, example:division:locality:torun] parent_division_id: example:division:country:pl diff --git a/examples/divisions/division/perspectives.yaml b/examples/divisions/division/perspectives.yaml index d00468248..c89e1c6f3 100644 --- a/examples/divisions/division/perspectives.yaml +++ b/examples/divisions/division/perspectives.yaml @@ -24,6 +24,7 @@ properties: - - division_id: example:perspectives:trnc subtype: country name: Kuzey Kıbrıs + admin_level: 0 perspectives: mode: accepted_by countries: [TR] diff --git a/examples/divisions/division/population.yaml b/examples/divisions/division/population.yaml index d1044f221..a0742ad38 100644 --- a/examples/divisions/division/population.yaml +++ b/examples/divisions/division/population.yaml @@ -26,6 +26,7 @@ properties: - division_id: example:division:region:ca-on subtype: region name: Ontario + admin_level: 1 capital_division_ids: [ example:division:locality:toronto ] parent_division_id: example:division:country:ca population: 13550900 diff --git a/examples/divisions/division/region.yaml b/examples/divisions/division/region.yaml index c38bbfb42..e646519a7 100644 --- a/examples/divisions/division/region.yaml +++ b/examples/divisions/division/region.yaml @@ -26,5 +26,6 @@ properties: - division_id: example:division:region:us-ny subtype: region name: New York + admin_level: 1 capital_division_ids: [ example:division:locality:albany ] parent_division_id: example:division:country:us diff --git a/examples/divisions/division_area/country_land.yaml b/examples/divisions/division_area/country_land.yaml index f7620a998..7abee632f 100644 --- a/examples/divisions/division_area/country_land.yaml +++ b/examples/divisions/division_area/country_land.yaml @@ -310,3 +310,4 @@ properties: names: primary: United States country: US + admin_level: 0 diff --git a/examples/divisions/division_area/country_maritime.yaml b/examples/divisions/division_area/country_maritime.yaml index 6da93d96a..388f1ffac 100644 --- a/examples/divisions/division_area/country_maritime.yaml +++ b/examples/divisions/division_area/country_maritime.yaml @@ -86,3 +86,4 @@ properties: common: en: Finland country: FI + admin_level: 0 diff --git a/examples/divisions/division_area/is_land.yaml b/examples/divisions/division_area/is_land.yaml index 6ade21cbb..c3fc774d3 100644 --- a/examples/divisions/division_area/is_land.yaml +++ b/examples/divisions/division_area/is_land.yaml @@ -305,8 +305,9 @@ properties: is_land: true is_territorial: false country: US + admin_level: 0 version: 0 class: land division_id: example:division:country:us names: - primary: United States \ No newline at end of file + primary: United States diff --git a/examples/divisions/division_area/is_territorial.yaml b/examples/divisions/division_area/is_territorial.yaml index 18b8edda6..36c0810c3 100644 --- a/examples/divisions/division_area/is_territorial.yaml +++ b/examples/divisions/division_area/is_territorial.yaml @@ -79,6 +79,7 @@ properties: is_territorial: true is_land: false country: FI + admin_level: 0 version: 0 class: land division_id: example:division:country:fi diff --git a/examples/divisions/division_area/region_land.yaml b/examples/divisions/division_area/region_land.yaml index 6fa857863..ba51642ce 100644 --- a/examples/divisions/division_area/region_land.yaml +++ b/examples/divisions/division_area/region_land.yaml @@ -80,3 +80,4 @@ properties: primary: Umbria country: IT region: IT-55 + admin_level: 1 diff --git a/examples/divisions/division_boundary/disputed.yaml b/examples/divisions/division_boundary/disputed.yaml index 525a80bbb..613e63c85 100644 --- a/examples/divisions/division_boundary/disputed.yaml +++ b/examples/divisions/division_boundary/disputed.yaml @@ -9,6 +9,7 @@ properties: type: division_boundary version: 1 subtype: country + admin_level: 0 class: land is_land: true is_territorial: false diff --git a/examples/divisions/division_boundary/disputed_both.yaml b/examples/divisions/division_boundary/disputed_both.yaml index ee491390b..791187240 100644 --- a/examples/divisions/division_boundary/disputed_both.yaml +++ b/examples/divisions/division_boundary/disputed_both.yaml @@ -9,6 +9,7 @@ properties: type: division_boundary version: 1 subtype: country + admin_level: 0 class: land is_land: true is_territorial: false diff --git a/examples/divisions/division_boundary/is_land.yaml b/examples/divisions/division_boundary/is_land.yaml index 418a89f90..50d0865fd 100644 --- a/examples/divisions/division_boundary/is_land.yaml +++ b/examples/divisions/division_boundary/is_land.yaml @@ -9,7 +9,8 @@ properties: type: division_boundary version: 1 subtype: country + admin_level: 0 is_land: true is_territorial: false class: land - division_ids: ["example:division:country:left", "example:division:country:right"] \ No newline at end of file + division_ids: ["example:division:country:left", "example:division:country:right"] diff --git a/examples/divisions/division_boundary/is_territorial.yaml b/examples/divisions/division_boundary/is_territorial.yaml index f5d8b34b4..6c13a7a36 100644 --- a/examples/divisions/division_boundary/is_territorial.yaml +++ b/examples/divisions/division_boundary/is_territorial.yaml @@ -10,7 +10,8 @@ properties: type: division_boundary version: 1 subtype: country + admin_level: 0 is_territorial: true is_land: false class: maritime - division_ids: ["example:division:country:left", "example:division:country:right"] \ No newline at end of file + division_ids: ["example:division:country:left", "example:division:country:right"] diff --git a/examples/divisions/division_boundary/land_county.yaml b/examples/divisions/division_boundary/land_county.yaml index a9dc67197..dc47082eb 100644 --- a/examples/divisions/division_boundary/land_county.yaml +++ b/examples/divisions/division_boundary/land_county.yaml @@ -9,6 +9,7 @@ properties: type: division_boundary version: 1 subtype: region + admin_level: 1 class: land country: "XX" region: "XX-01" diff --git a/examples/divisions/division_boundary/land_region.yaml b/examples/divisions/division_boundary/land_region.yaml index a4e8a52fe..d9d162bef 100644 --- a/examples/divisions/division_boundary/land_region.yaml +++ b/examples/divisions/division_boundary/land_region.yaml @@ -9,6 +9,7 @@ properties: type: division_boundary version: 1 subtype: region + admin_level: 1 class: land country: "XX" is_land: true diff --git a/examples/divisions/division_boundary/maritime_country.yaml b/examples/divisions/division_boundary/maritime_country.yaml index 13d73ed4d..ca163134a 100644 --- a/examples/divisions/division_boundary/maritime_country.yaml +++ b/examples/divisions/division_boundary/maritime_country.yaml @@ -9,6 +9,7 @@ properties: type: division_boundary version: 1 subtype: country + admin_level: 0 class: maritime is_territorial: true is_land: false diff --git a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division/models.py b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division/models.py index f2aa03d36..2fa86e6ce 100644 --- a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division/models.py +++ b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division/models.py @@ -17,6 +17,7 @@ UniqueItemsConstraint, ) from overture.schema.system.model_constraint import ( + FieldEqCondition, forbid_if, no_extra_fields, require_if, @@ -51,6 +52,12 @@ class Norms(BaseModel): @forbid_if(["parent_division_id"], IS_COUNTRY) @require_if(["parent_division_id"], ~IS_COUNTRY) +@require_if(["admin_level"], FieldEqCondition("subtype", PlaceType.COUNTRY)) +@require_if(["admin_level"], FieldEqCondition("subtype", PlaceType.DEPENDENCY)) +@require_if(["admin_level"], FieldEqCondition("subtype", PlaceType.MACROREGION)) +@require_if(["admin_level"], FieldEqCondition("subtype", PlaceType.REGION)) +@require_if(["admin_level"], FieldEqCondition("subtype", PlaceType.MACROCOUNTY)) +@require_if(["admin_level"], FieldEqCondition("subtype", PlaceType.COUNTY)) class Division( OvertureFeature[Literal["divisions"], Literal["division"]], Named, diff --git a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_area/models.py b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_area/models.py index 0838f93f7..9b0849583 100644 --- a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_area/models.py +++ b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_area/models.py @@ -11,7 +11,11 @@ Named, Names, ) -from overture.schema.system.model_constraint import radio_group +from overture.schema.system.model_constraint import ( + FieldEqCondition, + radio_group, + require_if, +) from overture.schema.system.primitive import ( Geometry, GeometryType, @@ -26,6 +30,12 @@ from .enums import AreaClass +@require_if(["admin_level"], FieldEqCondition("subtype", PlaceType.COUNTRY)) +@require_if(["admin_level"], FieldEqCondition("subtype", PlaceType.DEPENDENCY)) +@require_if(["admin_level"], FieldEqCondition("subtype", PlaceType.MACROREGION)) +@require_if(["admin_level"], FieldEqCondition("subtype", PlaceType.REGION)) +@require_if(["admin_level"], FieldEqCondition("subtype", PlaceType.MACROCOUNTY)) +@require_if(["admin_level"], FieldEqCondition("subtype", PlaceType.COUNTY)) @radio_group("is_land", "is_territorial") class DivisionArea( OvertureFeature[Literal["divisions"], Literal["division_area"]], Named diff --git a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_boundary/models.py b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_boundary/models.py index 27d4c5b55..8de611782 100644 --- a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_boundary/models.py +++ b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_boundary/models.py @@ -10,6 +10,7 @@ from overture.schema.core.models import Perspectives from overture.schema.system.field_constraint import UniqueItemsConstraint from overture.schema.system.model_constraint import ( + FieldEqCondition, forbid_if, radio_group, require_if, @@ -30,6 +31,12 @@ @forbid_if(["country"], IS_COUNTRY) @require_if(["country"], ~IS_COUNTRY) +@require_if(["admin_level"], FieldEqCondition("subtype", PlaceType.COUNTRY)) +@require_if(["admin_level"], FieldEqCondition("subtype", PlaceType.DEPENDENCY)) +@require_if(["admin_level"], FieldEqCondition("subtype", PlaceType.MACROREGION)) +@require_if(["admin_level"], FieldEqCondition("subtype", PlaceType.REGION)) +@require_if(["admin_level"], FieldEqCondition("subtype", PlaceType.MACROCOUNTY)) +@require_if(["admin_level"], FieldEqCondition("subtype", PlaceType.COUNTY)) @radio_group("is_land", "is_territorial") class DivisionBoundary( OvertureFeature[Literal["divisions"], Literal["division_boundary"]] diff --git a/reference/examples/divisions/division_area/country_land.yaml b/reference/examples/divisions/division_area/country_land.yaml index f7620a998..7abee632f 100644 --- a/reference/examples/divisions/division_area/country_land.yaml +++ b/reference/examples/divisions/division_area/country_land.yaml @@ -310,3 +310,4 @@ properties: names: primary: United States country: US + admin_level: 0 diff --git a/reference/examples/divisions/division_area/country_maritime.yaml b/reference/examples/divisions/division_area/country_maritime.yaml index 6da93d96a..388f1ffac 100644 --- a/reference/examples/divisions/division_area/country_maritime.yaml +++ b/reference/examples/divisions/division_area/country_maritime.yaml @@ -86,3 +86,4 @@ properties: common: en: Finland country: FI + admin_level: 0 diff --git a/reference/examples/divisions/division_area/is_land.yaml b/reference/examples/divisions/division_area/is_land.yaml index 6ade21cbb..c3fc774d3 100644 --- a/reference/examples/divisions/division_area/is_land.yaml +++ b/reference/examples/divisions/division_area/is_land.yaml @@ -305,8 +305,9 @@ properties: is_land: true is_territorial: false country: US + admin_level: 0 version: 0 class: land division_id: example:division:country:us names: - primary: United States \ No newline at end of file + primary: United States diff --git a/reference/examples/divisions/division_area/is_territorial.yaml b/reference/examples/divisions/division_area/is_territorial.yaml index 18b8edda6..36c0810c3 100644 --- a/reference/examples/divisions/division_area/is_territorial.yaml +++ b/reference/examples/divisions/division_area/is_territorial.yaml @@ -79,6 +79,7 @@ properties: is_territorial: true is_land: false country: FI + admin_level: 0 version: 0 class: land division_id: example:division:country:fi diff --git a/reference/examples/divisions/division_area/region_land.yaml b/reference/examples/divisions/division_area/region_land.yaml index 6fa857863..ba51642ce 100644 --- a/reference/examples/divisions/division_area/region_land.yaml +++ b/reference/examples/divisions/division_area/region_land.yaml @@ -80,3 +80,4 @@ properties: primary: Umbria country: IT region: IT-55 + admin_level: 1 diff --git a/schema/divisions/division.yaml b/schema/divisions/division.yaml index f8e8a5926..3026389c3 100644 --- a/schema/divisions/division.yaml +++ b/schema/divisions/division.yaml @@ -31,6 +31,19 @@ properties: # JSON Schema: Top-level object properties. not: { required: [parent_division_id] } else: required: [names, subtype, country, hierarchies, parent_division_id] + - if: + properties: + subtype: + enum: + - country + - dependency + - macroregion + - region + - macrocounty + - county + then: + required: + - admin_level properties: # JSON Schema: properties within GeoJSON top-level object 'properties' property subtype: { "$ref": "./defs.yaml#/$defs/propertyDefinitions/placetype" } class: diff --git a/schema/divisions/division_area.yaml b/schema/divisions/division_area.yaml index 68c7f0859..e49fd9221 100644 --- a/schema/divisions/division_area.yaml +++ b/schema/divisions/division_area.yaml @@ -26,6 +26,19 @@ properties: # JSON Schema: Top-level object properties. allOf: - "$ref": ../defs.yaml#/$defs/propertyContainers/overtureFeaturePropertiesContainer - "$ref": ../defs.yaml#/$defs/propertyContainers/namesContainer + - if: + properties: + subtype: + enum: + - country + - dependency + - macroregion + - region + - macrocounty + - county + then: + required: + - admin_level anyOf: - properties: is_land: diff --git a/schema/divisions/division_boundary.yaml b/schema/divisions/division_boundary.yaml index f66afc4ae..52a65bc2f 100644 --- a/schema/divisions/division_boundary.yaml +++ b/schema/divisions/division_boundary.yaml @@ -27,6 +27,19 @@ properties: # JSON Schema: Top-level object properties. not: { required: [country] } else: required: [subtype, class, division_ids, is_land, is_territorial, country] + - if: + properties: + subtype: + enum: + - country + - dependency + - macroregion + - region + - macrocounty + - county + then: + required: + - admin_level oneOf: - properties: is_land: From 84551621fd903bd04455c67fd235aaae929eb6db Mon Sep 17 00:00:00 2001 From: Stephen Epps Date: Tue, 2 Dec 2025 09:26:20 -0800 Subject: [PATCH 10/14] regenerate baseline schema files --- .../tests/division_area_baseline_schema.json | 102 ++++++++++++++++-- .../tests/division_baseline_schema.json | 100 +++++++++++++++-- .../division_boundary_baseline_schema.json | 100 +++++++++++++++-- 3 files changed, 278 insertions(+), 24 deletions(-) diff --git a/packages/overture-schema-divisions-theme/tests/division_area_baseline_schema.json b/packages/overture-schema-divisions-theme/tests/division_area_baseline_schema.json index 6e5f428bb..71f441071 100644 --- a/packages/overture-schema-divisions-theme/tests/division_area_baseline_schema.json +++ b/packages/overture-schema-divisions-theme/tests/division_area_baseline_schema.json @@ -340,6 +340,92 @@ }, "properties": { "additionalProperties": false, + "allOf": [ + { + "if": { + "properties": { + "subtype": { + "const": "county" + } + } + }, + "then": { + "required": [ + "admin_level" + ] + } + }, + { + "if": { + "properties": { + "subtype": { + "const": "macrocounty" + } + } + }, + "then": { + "required": [ + "admin_level" + ] + } + }, + { + "if": { + "properties": { + "subtype": { + "const": "region" + } + } + }, + "then": { + "required": [ + "admin_level" + ] + } + }, + { + "if": { + "properties": { + "subtype": { + "const": "macroregion" + } + } + }, + "then": { + "required": [ + "admin_level" + ] + } + }, + { + "if": { + "properties": { + "subtype": { + "const": "dependency" + } + } + }, + "then": { + "required": [ + "admin_level" + ] + } + }, + { + "if": { + "properties": { + "subtype": { + "const": "country" + } + } + }, + "then": { + "required": [ + "admin_level" + ] + } + } + ], "not": { "required": [ "id", @@ -369,6 +455,13 @@ } }, "properties": { + "admin_level": { + "description": "Integer representing this division's position in its country's administrative hierarchy, where lower numbers correspond to higher level administrative units.", + "maximum": 2147483647, + "minimum": 0, + "title": "Admin Level", + "type": "integer" + }, "class": { "$ref": "#/$defs/AreaClass" }, @@ -397,13 +490,6 @@ "title": "Is Territorial", "type": "boolean" }, - "admin_level": { - "description": "Integer representing this division's position in its country's administrative hierarchy, where lower numbers correspond to higher level administrative units.", - "maximum": 2147483647, - "minimum": 0, - "title": "Admin Level", - "type": "integer" - }, "names": { "$ref": "#/$defs/Names" }, @@ -471,4 +557,4 @@ ], "title": "division_area", "type": "object" -} +} \ No newline at end of file diff --git a/packages/overture-schema-divisions-theme/tests/division_baseline_schema.json b/packages/overture-schema-divisions-theme/tests/division_baseline_schema.json index 51c58c7a6..72c2cd823 100644 --- a/packages/overture-schema-divisions-theme/tests/division_baseline_schema.json +++ b/packages/overture-schema-divisions-theme/tests/division_baseline_schema.json @@ -392,6 +392,90 @@ "properties": { "additionalProperties": false, "allOf": [ + { + "if": { + "properties": { + "subtype": { + "const": "county" + } + } + }, + "then": { + "required": [ + "admin_level" + ] + } + }, + { + "if": { + "properties": { + "subtype": { + "const": "macrocounty" + } + } + }, + "then": { + "required": [ + "admin_level" + ] + } + }, + { + "if": { + "properties": { + "subtype": { + "const": "region" + } + } + }, + "then": { + "required": [ + "admin_level" + ] + } + }, + { + "if": { + "properties": { + "subtype": { + "const": "macroregion" + } + } + }, + "then": { + "required": [ + "admin_level" + ] + } + }, + { + "if": { + "properties": { + "subtype": { + "const": "dependency" + } + } + }, + "then": { + "required": [ + "admin_level" + ] + } + }, + { + "if": { + "properties": { + "subtype": { + "const": "country" + } + } + }, + "then": { + "required": [ + "admin_level" + ] + } + }, { "if": { "not": { @@ -438,6 +522,13 @@ } }, "properties": { + "admin_level": { + "description": "Integer representing this division's position in its country's administrative hierarchy, where lower numbers correspond to higher level administrative units.", + "maximum": 2147483647, + "minimum": 0, + "title": "Admin Level", + "type": "integer" + }, "capital_division_ids": { "description": "Division IDs of this division's capital divisions. If present, this property will refer to the division IDs of the capital cities, county seats, etc. of a division.", "items": { @@ -522,13 +613,6 @@ "title": "Parent Division Id", "type": "string" }, - "admin_level": { - "description": "Integer representing this division's position within its country's administrative hierarchy, where lower numbers correspond to higher level administrative units.", - "maximum": 2147483647, - "minimum": 0, - "title": "Admin Level", - "type": "integer" - }, "perspectives": { "$ref": "#/$defs/Perspectives", "description": "Political perspectives from which this division is considered to be an accurate representation.\n\nIf this property is absent, then this division is not known to be disputed from any political perspective. Consequently, there is only one division feature representing the entire real world entity.\n\nIf this property is present, it means the division represents one of several alternative perspectives on the same real-world entity.\n\nThere are two modes of perspective:\n\n1. `accepted_by` means the representation of the division is accepted by the listed entities and would be included on a map drawn from their perspective.\n\n2. `disputed_by` means the representation of the division is disputed by the listed entities and would be excluded from a map drawn from their perspective.\n\nWhen drawing a map from the perspective of a given country, one would start by gathering all the undisputed divisions (with no `perspectives` property), and then adding to that first all divisions explicitly accepted by the country, and second all divisions not explicitly disputed by the country." @@ -609,4 +693,4 @@ ], "title": "division", "type": "object" -} +} \ No newline at end of file diff --git a/packages/overture-schema-divisions-theme/tests/division_boundary_baseline_schema.json b/packages/overture-schema-divisions-theme/tests/division_boundary_baseline_schema.json index 155cdf86d..a2c301419 100644 --- a/packages/overture-schema-divisions-theme/tests/division_boundary_baseline_schema.json +++ b/packages/overture-schema-divisions-theme/tests/division_boundary_baseline_schema.json @@ -222,6 +222,90 @@ "properties": { "additionalProperties": false, "allOf": [ + { + "if": { + "properties": { + "subtype": { + "const": "county" + } + } + }, + "then": { + "required": [ + "admin_level" + ] + } + }, + { + "if": { + "properties": { + "subtype": { + "const": "macrocounty" + } + } + }, + "then": { + "required": [ + "admin_level" + ] + } + }, + { + "if": { + "properties": { + "subtype": { + "const": "region" + } + } + }, + "then": { + "required": [ + "admin_level" + ] + } + }, + { + "if": { + "properties": { + "subtype": { + "const": "macroregion" + } + } + }, + "then": { + "required": [ + "admin_level" + ] + } + }, + { + "if": { + "properties": { + "subtype": { + "const": "dependency" + } + } + }, + "then": { + "required": [ + "admin_level" + ] + } + }, + { + "if": { + "properties": { + "subtype": { + "const": "country" + } + } + }, + "then": { + "required": [ + "admin_level" + ] + } + }, { "if": { "not": { @@ -284,6 +368,13 @@ } }, "properties": { + "admin_level": { + "description": "Integer representing the shared administrative level of the divisions on either side of this boundary.", + "maximum": 2147483647, + "minimum": 0, + "title": "Admin Level", + "type": "integer" + }, "class": { "$ref": "#/$defs/BoundaryClass" }, @@ -324,13 +415,6 @@ "title": "Is Territorial", "type": "boolean" }, - "admin_level": { - "description": "Integer representing the shared administrative level of the divisions on this boundary, where lower numbers correspond to higher level administrative units.", - "maximum": 2147483647, - "minimum": 0, - "title": "Admin Level", - "type": "integer" - }, "perspectives": { "$ref": "#/$defs/Perspectives", "description": "Political perspectives from which this division boundary is considered to be an accurate representation.\n\nIf this property is absent, then this boundary is not known to be disputed from any political perspective. Consequently, there is only one boundary feature representing the entire real world entity.\n\nIf this property is present, it means the boundary represents one of several alternative perspectives on the same real-world entity.\n\nThere are two modes of perspective:\n\n 1. `accepted_by` means the representation of the boundary is accepted by the listed entities and would be included on a map drawn from their perspective.\n\n 2. `disputed_by` means the representation of the boundary is disputed by the listed entities and would be excluded from a map drawn from their perspective.\n\nWhen drawing a map from the perspective of a given country, one would start by gathering all the undisputed boundary (with no `perspectives` property), and then adding to that first all boundary explicitly accepted by the country, and second all boundary not explicitly disputed by the country." @@ -397,4 +481,4 @@ ], "title": "boundary", "type": "object" -} +} \ No newline at end of file From 64e4dfe42558a5f34937908b82c2c46dd1dbb575 Mon Sep 17 00:00:00 2001 From: Stephen Epps Date: Tue, 20 Jan 2026 18:43:36 -0800 Subject: [PATCH 11/14] use uint8 AdminLevel for divisions admin_level, regenerate schema files --- .../src/overture/schema/divisions/division/models.py | 5 ++--- .../src/overture/schema/divisions/division_area/models.py | 5 ++--- .../overture/schema/divisions/division_boundary/models.py | 5 ++--- .../src/overture/schema/divisions/types.py | 4 ++++ .../tests/division_area_baseline_schema.json | 2 +- .../tests/division_baseline_schema.json | 2 +- .../tests/division_boundary_baseline_schema.json | 2 +- 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division/models.py b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division/models.py index 2fa86e6ce..8b57c6055 100644 --- a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division/models.py +++ b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division/models.py @@ -33,7 +33,7 @@ from ..enums import IS_COUNTRY, DivisionClass, PlaceType from ..models import CapitalOfDivisionItem -from ..types import Hierarchy +from ..types import AdminLevel, Hierarchy @no_extra_fields @@ -125,9 +125,8 @@ class Division( ), ] = None admin_level: Annotated[ - int32 | None, + AdminLevel | None, Field( - ge=0, description="Integer representing this division's position in its country's administrative hierarchy, where lower numbers correspond to higher level administrative units.", ), ] = None diff --git a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_area/models.py b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_area/models.py index 9b0849583..67d11ff17 100644 --- a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_area/models.py +++ b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_area/models.py @@ -20,13 +20,13 @@ Geometry, GeometryType, GeometryTypeConstraint, - int32, ) from overture.schema.system.ref import Id, Reference, Relationship from overture.schema.system.string import CountryCodeAlpha2, RegionCode from ..division.models import Division from ..enums import PlaceType +from ..types import AdminLevel from .enums import AreaClass @@ -105,9 +105,8 @@ class DivisionArea( ), ] = None admin_level: Annotated[ - int32 | None, + AdminLevel | None, Field( - ge=0, description="Integer representing this division's position in its country's administrative hierarchy, where lower numbers correspond to higher level administrative units.", ), ] = None diff --git a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_boundary/models.py b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_boundary/models.py index 8de611782..396a4ceda 100644 --- a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_boundary/models.py +++ b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_boundary/models.py @@ -19,13 +19,13 @@ Geometry, GeometryType, GeometryTypeConstraint, - int32, ) from overture.schema.system.ref import Id, Reference, Relationship from overture.schema.system.string import CountryCodeAlpha2, RegionCode from ..division import Division from ..enums import IS_COUNTRY, PlaceType +from ..types import AdminLevel from .enums import BoundaryClass @@ -124,9 +124,8 @@ class DivisionBoundary( ), ] = None admin_level: Annotated[ - int32 | None, + AdminLevel | None, Field( - ge=0, description="Integer representing the shared administrative level of the divisions on either side of this boundary.", ), ] = None diff --git a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/types.py b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/types.py index 6fdacc482..747a6befd 100644 --- a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/types.py +++ b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/types.py @@ -2,10 +2,14 @@ from pydantic import Field +from overture.schema.system.primitive import uint8 + from overture.schema.system.field_constraint import UniqueItemsConstraint from .models import HierarchyItem +AdminLevel = NewType("AdminLevel", uint8) + Hierarchy = NewType( "Hierarchy", Annotated[ diff --git a/packages/overture-schema-divisions-theme/tests/division_area_baseline_schema.json b/packages/overture-schema-divisions-theme/tests/division_area_baseline_schema.json index 71f441071..866bd98fa 100644 --- a/packages/overture-schema-divisions-theme/tests/division_area_baseline_schema.json +++ b/packages/overture-schema-divisions-theme/tests/division_area_baseline_schema.json @@ -457,7 +457,7 @@ "properties": { "admin_level": { "description": "Integer representing this division's position in its country's administrative hierarchy, where lower numbers correspond to higher level administrative units.", - "maximum": 2147483647, + "maximum": 255, "minimum": 0, "title": "Admin Level", "type": "integer" diff --git a/packages/overture-schema-divisions-theme/tests/division_baseline_schema.json b/packages/overture-schema-divisions-theme/tests/division_baseline_schema.json index 72c2cd823..b5099f867 100644 --- a/packages/overture-schema-divisions-theme/tests/division_baseline_schema.json +++ b/packages/overture-schema-divisions-theme/tests/division_baseline_schema.json @@ -524,7 +524,7 @@ "properties": { "admin_level": { "description": "Integer representing this division's position in its country's administrative hierarchy, where lower numbers correspond to higher level administrative units.", - "maximum": 2147483647, + "maximum": 255, "minimum": 0, "title": "Admin Level", "type": "integer" diff --git a/packages/overture-schema-divisions-theme/tests/division_boundary_baseline_schema.json b/packages/overture-schema-divisions-theme/tests/division_boundary_baseline_schema.json index a2c301419..f0d8b5486 100644 --- a/packages/overture-schema-divisions-theme/tests/division_boundary_baseline_schema.json +++ b/packages/overture-schema-divisions-theme/tests/division_boundary_baseline_schema.json @@ -370,7 +370,7 @@ "properties": { "admin_level": { "description": "Integer representing the shared administrative level of the divisions on either side of this boundary.", - "maximum": 2147483647, + "maximum": 255, "minimum": 0, "title": "Admin Level", "type": "integer" From eaeb1858630cc75aed41bb6c2bb5d0722fca625c Mon Sep 17 00:00:00 2001 From: Stephen Epps Date: Tue, 20 Jan 2026 19:13:26 -0800 Subject: [PATCH 12/14] centralize AdminLevel type with description, regenerate schema files --- .../src/overture/schema/divisions/division/models.py | 7 +------ .../overture/schema/divisions/division_area/models.py | 7 +------ .../schema/divisions/division_boundary/models.py | 7 +------ .../src/overture/schema/divisions/types.py | 10 +++++++++- .../tests/division_area_baseline_schema.json | 1 - .../tests/division_baseline_schema.json | 1 - .../tests/division_boundary_baseline_schema.json | 1 - 7 files changed, 12 insertions(+), 22 deletions(-) diff --git a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division/models.py b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division/models.py index 8b57c6055..59f8a7789 100644 --- a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division/models.py +++ b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division/models.py @@ -124,12 +124,7 @@ class Division( The default parent division is the parent division as seen from the default political perspective, if there is one, and is otherwise chosen somewhat arbitrarily. The hierarchies property can be used to inspect the exhaustive list of parent divisions.""", ), ] = None - admin_level: Annotated[ - AdminLevel | None, - Field( - description="Integer representing this division's position in its country's administrative hierarchy, where lower numbers correspond to higher level administrative units.", - ), - ] = None + admin_level: AdminLevel = None # Optional diff --git a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_area/models.py b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_area/models.py index 67d11ff17..fe149b400 100644 --- a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_area/models.py +++ b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_area/models.py @@ -104,9 +104,4 @@ class DivisionArea( description="ISO 3166-2 principal subdivision code of the division this area belongs to.", ), ] = None - admin_level: Annotated[ - AdminLevel | None, - Field( - description="Integer representing this division's position in its country's administrative hierarchy, where lower numbers correspond to higher level administrative units.", - ), - ] = None + admin_level: AdminLevel = None diff --git a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_boundary/models.py b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_boundary/models.py index 396a4ceda..51de24280 100644 --- a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_boundary/models.py +++ b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_boundary/models.py @@ -123,12 +123,7 @@ class DivisionBoundary( present on boundaries between different principal subdivisions or countries.""", ), ] = None - admin_level: Annotated[ - AdminLevel | None, - Field( - description="Integer representing the shared administrative level of the divisions on either side of this boundary.", - ), - ] = None + admin_level: AdminLevel = None is_disputed: Annotated[ bool | None, Field( diff --git a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/types.py b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/types.py index 747a6befd..c2e9096b3 100644 --- a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/types.py +++ b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/types.py @@ -8,7 +8,15 @@ from .models import HierarchyItem -AdminLevel = NewType("AdminLevel", uint8) +AdminLevel = NewType( + "AdminLevel", + Annotated[ + uint8 | None, + Field( + description="Integer representing the division's position in its country's administrative hierarchy, where lower numbers correspond to higher level administrative units.", + ), + ], +) Hierarchy = NewType( "Hierarchy", diff --git a/packages/overture-schema-divisions-theme/tests/division_area_baseline_schema.json b/packages/overture-schema-divisions-theme/tests/division_area_baseline_schema.json index 866bd98fa..ce7830ddd 100644 --- a/packages/overture-schema-divisions-theme/tests/division_area_baseline_schema.json +++ b/packages/overture-schema-divisions-theme/tests/division_area_baseline_schema.json @@ -456,7 +456,6 @@ }, "properties": { "admin_level": { - "description": "Integer representing this division's position in its country's administrative hierarchy, where lower numbers correspond to higher level administrative units.", "maximum": 255, "minimum": 0, "title": "Admin Level", diff --git a/packages/overture-schema-divisions-theme/tests/division_baseline_schema.json b/packages/overture-schema-divisions-theme/tests/division_baseline_schema.json index b5099f867..8c649e243 100644 --- a/packages/overture-schema-divisions-theme/tests/division_baseline_schema.json +++ b/packages/overture-schema-divisions-theme/tests/division_baseline_schema.json @@ -523,7 +523,6 @@ }, "properties": { "admin_level": { - "description": "Integer representing this division's position in its country's administrative hierarchy, where lower numbers correspond to higher level administrative units.", "maximum": 255, "minimum": 0, "title": "Admin Level", diff --git a/packages/overture-schema-divisions-theme/tests/division_boundary_baseline_schema.json b/packages/overture-schema-divisions-theme/tests/division_boundary_baseline_schema.json index f0d8b5486..85e4232b8 100644 --- a/packages/overture-schema-divisions-theme/tests/division_boundary_baseline_schema.json +++ b/packages/overture-schema-divisions-theme/tests/division_boundary_baseline_schema.json @@ -369,7 +369,6 @@ }, "properties": { "admin_level": { - "description": "Integer representing the shared administrative level of the divisions on either side of this boundary.", "maximum": 255, "minimum": 0, "title": "Admin Level", From 2f2a30028a1b2d32cbb33de68193c9893543ae13 Mon Sep 17 00:00:00 2001 From: Stephen Epps Date: Tue, 20 Jan 2026 19:34:02 -0800 Subject: [PATCH 13/14] ruff formatting --- .../src/overture/schema/divisions/types.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/types.py b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/types.py index c2e9096b3..ff2017b51 100644 --- a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/types.py +++ b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/types.py @@ -2,9 +2,8 @@ from pydantic import Field -from overture.schema.system.primitive import uint8 - from overture.schema.system.field_constraint import UniqueItemsConstraint +from overture.schema.system.primitive import uint8 from .models import HierarchyItem From 488262c272deca471ce541a23762d1ffbc621ed0 Mon Sep 17 00:00:00 2001 From: Stephen Epps Date: Tue, 20 Jan 2026 19:43:52 -0800 Subject: [PATCH 14/14] fix make check error --- .../src/overture/schema/divisions/division/models.py | 2 +- .../src/overture/schema/divisions/division_area/models.py | 2 +- .../src/overture/schema/divisions/division_boundary/models.py | 2 +- .../src/overture/schema/divisions/types.py | 2 +- .../tests/division_area_baseline_schema.json | 1 + .../tests/division_baseline_schema.json | 1 + .../tests/division_boundary_baseline_schema.json | 1 + 7 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division/models.py b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division/models.py index 59f8a7789..a3ad0a5ca 100644 --- a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division/models.py +++ b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division/models.py @@ -124,7 +124,7 @@ class Division( The default parent division is the parent division as seen from the default political perspective, if there is one, and is otherwise chosen somewhat arbitrarily. The hierarchies property can be used to inspect the exhaustive list of parent divisions.""", ), ] = None - admin_level: AdminLevel = None + admin_level: AdminLevel | None = None # Optional diff --git a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_area/models.py b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_area/models.py index fe149b400..06b38bb68 100644 --- a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_area/models.py +++ b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_area/models.py @@ -104,4 +104,4 @@ class DivisionArea( description="ISO 3166-2 principal subdivision code of the division this area belongs to.", ), ] = None - admin_level: AdminLevel = None + admin_level: AdminLevel | None = None diff --git a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_boundary/models.py b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_boundary/models.py index 51de24280..86ea6e7cf 100644 --- a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_boundary/models.py +++ b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/division_boundary/models.py @@ -123,7 +123,7 @@ class DivisionBoundary( present on boundaries between different principal subdivisions or countries.""", ), ] = None - admin_level: AdminLevel = None + admin_level: AdminLevel | None = None is_disputed: Annotated[ bool | None, Field( diff --git a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/types.py b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/types.py index ff2017b51..621cfc416 100644 --- a/packages/overture-schema-divisions-theme/src/overture/schema/divisions/types.py +++ b/packages/overture-schema-divisions-theme/src/overture/schema/divisions/types.py @@ -10,7 +10,7 @@ AdminLevel = NewType( "AdminLevel", Annotated[ - uint8 | None, + uint8, Field( description="Integer representing the division's position in its country's administrative hierarchy, where lower numbers correspond to higher level administrative units.", ), diff --git a/packages/overture-schema-divisions-theme/tests/division_area_baseline_schema.json b/packages/overture-schema-divisions-theme/tests/division_area_baseline_schema.json index ce7830ddd..f3e8c2abd 100644 --- a/packages/overture-schema-divisions-theme/tests/division_area_baseline_schema.json +++ b/packages/overture-schema-divisions-theme/tests/division_area_baseline_schema.json @@ -456,6 +456,7 @@ }, "properties": { "admin_level": { + "description": "Integer representing the division's position in its country's administrative hierarchy, where lower numbers correspond to higher level administrative units.", "maximum": 255, "minimum": 0, "title": "Admin Level", diff --git a/packages/overture-schema-divisions-theme/tests/division_baseline_schema.json b/packages/overture-schema-divisions-theme/tests/division_baseline_schema.json index 8c649e243..fbd34ad41 100644 --- a/packages/overture-schema-divisions-theme/tests/division_baseline_schema.json +++ b/packages/overture-schema-divisions-theme/tests/division_baseline_schema.json @@ -523,6 +523,7 @@ }, "properties": { "admin_level": { + "description": "Integer representing the division's position in its country's administrative hierarchy, where lower numbers correspond to higher level administrative units.", "maximum": 255, "minimum": 0, "title": "Admin Level", diff --git a/packages/overture-schema-divisions-theme/tests/division_boundary_baseline_schema.json b/packages/overture-schema-divisions-theme/tests/division_boundary_baseline_schema.json index 85e4232b8..336d2d484 100644 --- a/packages/overture-schema-divisions-theme/tests/division_boundary_baseline_schema.json +++ b/packages/overture-schema-divisions-theme/tests/division_boundary_baseline_schema.json @@ -369,6 +369,7 @@ }, "properties": { "admin_level": { + "description": "Integer representing the division's position in its country's administrative hierarchy, where lower numbers correspond to higher level administrative units.", "maximum": 255, "minimum": 0, "title": "Admin Level",