Skip to main content

Authoritative tooling for creating OGC API - EDR Part 3 Service Profiles

Project description

OGC API - EDR Part 3 Service Profile Generator

Authoritative tooling for creating OGC API - Environmental Data Retrieval (EDR) Part 3 Service Profiles, built on Pydantic and edr-pydantic.

Overview

Profile structure is defined as Pydantic models (src/models.py). Instantiating a ServiceProfile validates the entire profile — enums enforce normative OGC values, cross-model validators catch referential errors — before any files are written.

Collections use edr-pydantic's authoritative Collection model directly, meaning a profile config is simultaneously a valid EDR collection descriptor and a Part 3 profile definition.

Installation

pip install ogc-edr-profile

Usage

Generate profile artifacts

ogc-edr-profile generate --config examples/water_gauge.yaml --output ./my_profile

Validate a config without generating output

ogc-edr-profile validate --config examples/water_gauge.yaml

Export the JSON Schema

ogc-edr-profile schema --output profile.schema.json

The schema can be used for editor autocompletion — point your YAML extension at profile.schema.json to get inline validation and suggestions while authoring configs.

Output

my_profile/
├── openapi.yaml
├── asyncapi.yaml                        # if pubsub is configured
├── profile_config.json                  # round-trip model export
├── requirements/
│   ├── requirements_class_core.adoc
│   └── core/REQ_<id>.adoc
└── abstract_tests/
    ├── ATS_class_core.adoc
    └── core/ATS_<id>.adoc

Getting Started

The fastest way to create a profile is to copy the example and modify it:

cp examples/water_gauge.yaml my_profile.yaml

Then edit my_profile.yaml — at minimum change name, title, and the collection id. Validate as you go:

ogc-edr-profile validate --config my_profile.yaml

Once valid, generate:

ogc-edr-profile generate --config my_profile.yaml --output ./my_profile

If you prefer to build from scratch, the minimal valid config looks like this:

name: my_profile
title: My EDR Profile

collections:
  - id: my_collection
    links:
      - href: https://example.com/collections/my_collection
        rel: self
        type: application/json
    extent:
      spatial:
        bbox:
          - [-180, -90, 180, 90]
        crs: "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
    parameter_names: {}

From there, add data_queries to declare which query types your collection supports, output_formats to declare response formats, requirements to define normative statements, and abstract_tests to define conformance tests. Each section is described in detail below.


Authoring a Profile Config

A profile config is a YAML or JSON file that defines a ServiceProfile. The full machine-readable schema is in profile.schema.json. Below is a field-by-field reference.

Top-level fields

Field Type Required Description
name string yes Lowercase identifier using only a-z, 0-9, _. Used in OGC URIs, filenames, and OpenAPI operationIds. e.g. water_gauge
title string yes Human-readable profile title. e.g. Water Gauge Observations Profile
version string no Profile version. Defaults to 1.0
collections list yes One or more EDR collections (see below)
requirements list no Normative requirements (see below)
abstract_tests list no Conformance tests — each must reference a valid requirement id (see below)
pubsub object no OGC API - EDR Part 2 PubSub configuration (see below)

collections[]

Each collection uses the edr-pydantic Collection schema — the same model an EDR server returns at /collections/{id}. Key fields:

Field Type Required Description
id string yes Collection identifier. e.g. water_gauge
title string no Human-readable collection name
description string no Collection description
links list yes At minimum a self link
extent object yes Spatial (and optionally temporal/vertical) extent
extent.spatial.bbox list yes Bounding box as [[minLon, minLat, maxLon, maxLat]]
extent.spatial.crs string yes CRS URI, typically http://www.opengis.net/def/crs/OGC/1.3/CRS84
data_queries object no Which EDR query types this collection supports (see below)
output_formats list no Supported output format labels e.g. GeoJSON, CoverageJSON, CSV
parameter_names object no Map of parameter id → Parameter object describing observed properties

data_queries

Each key is an EDR query type. Set it to enable that query type for the collection. Supported keys:

items · position · area · radius · cube · trajectory · corridor · locations · instances

Each value is an EDRQuery object with a link field:

data_queries:
  position:
    link:
      href: https://example.com/collections/water_gauge/position
      rel: data
      variables:
        query_type: position
        output_formats:
          - CoverageJSON
  items:
    link:
      href: https://example.com/collections/water_gauge/items
      rel: data
      variables:
        query_type: items
        output_formats:
          - GeoJSON
          - CSV

parameter_names

Describes the observed properties the collection exposes. Each entry is a Parameter object:

parameter_names:
  gauge_height:
    type: Parameter
    observedProperty:
      label: Gauge Height
    unit:
      label: feet
      symbol: ft
  streamflow:
    type: Parameter
    observedProperty:
      label: Streamflow
    unit:
      label: cubic feet per second
      symbol: cfs

requirements[]

Normative requirements that implementations of this profile must satisfy. Each requirement becomes a REQ_<id>.adoc file and an entry in the requirements class.

Field Type Required Description
id string yes Lowercase, hyphen-separated identifier. e.g. data-query-items-water-gauge. Must match pattern ^[a-z0-9][a-z0-9\-]*$
statement string yes One-sentence normative statement of the requirement
parts list[string] yes One or more SHALL/MUST clauses that make up the requirement body
requirements:
  - id: data-query-items-water-gauge
    statement: The water_gauge collection SHALL support the Items query type.
    parts:
      - The service SHALL provide a /collections/water_gauge/items endpoint.
      - The Items query SHALL return a GeoJSON FeatureCollection.

abstract_tests[]

Conformance tests corresponding to requirements. Each test becomes an ATS_<id>.adoc file and an entry in the conformance class. Every requirement_id must match an existing requirement id — the model validator will reject the profile if not.

Field Type Required Description
id string yes Must equal requirement_id
requirement_id string yes The id of the requirement this test validates
steps list[string] yes Ordered test steps
abstract_tests:
  - id: data-query-items-water-gauge
    requirement_id: data-query-items-water-gauge
    steps:
      - Send GET request to /collections/water_gauge/items.
      - Verify the response is a valid GeoJSON FeatureCollection.

pubsub

Optional. Configures OGC API - EDR Part 2 (PubSub) output. When present, an asyncapi.yaml is generated.

Field Type Default Description
broker_host string localhost Message broker hostname
broker_port integer 5672 Broker port (1–65535)
protocol string amqp One of amqp, mqtt, kafka
filters list [] Subscription filters (see below)

pubsub.filters[]

Field Type Required Description
name string yes Filter parameter name
description string yes What the filter does
type string no One of string, number, array, boolean. Defaults to string
pubsub:
  broker_host: localhost
  broker_port: 5672
  protocol: amqp
  filters:
    - name: state
      description: Filter by US state abbreviation.
      type: string
    - name: threshold_ft
      description: Only notify when gauge height exceeds this value.
      type: number

See examples/water_gauge.yaml for a complete working config.

Programmatic Use

from ogc_edr_profile.models import ServiceProfile
from ogc_edr_profile.generate import generate
from pathlib import Path

profile = ServiceProfile.model_validate(config_dict)
generate(profile, Path("./output"))

Repository Structure

├── src/
│   ├── models.py         # Authoritative Pydantic schema
│   ├── generate.py       # Serialization: validated model → OpenAPI, AsyncAPI, AsciiDoc
│   └── cli.py            # CLI entry point
├── examples/
│   └── water_gauge.yaml  # Complete example profile config
├── profile.schema.json   # Machine-readable JSON Schema for profile configs
└── pyproject.toml

Standards

  • OGC API - EDR Part 1: Core
  • OGC API - EDR Part 2: PubSub
  • OGC API - EDR Part 3: Service Profiles (draft)
  • OpenAPI 3.0 / AsyncAPI 3.0
  • Metanorma/AsciiDoc documentation format

License

Apache License 2.0 — See LICENSE for details.

Contact

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ogc_edr_profile-1.0.1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ogc_edr_profile-1.0.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file ogc_edr_profile-1.0.1.tar.gz.

File metadata

  • Download URL: ogc_edr_profile-1.0.1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for ogc_edr_profile-1.0.1.tar.gz
Algorithm Hash digest
SHA256 985a610acfae3bda35673f62ce8197eca59ec287b2194f2bd620a66333028729
MD5 cc9434e9c5ddbed385441ff3e6d6b12f
BLAKE2b-256 c40b762ac216a48e5c85157a5fdaea202e142d88ceee7f8b16a25ca2f408ad46

See more details on using hashes here.

File details

Details for the file ogc_edr_profile-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ogc_edr_profile-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f873b5ba4d03dc4566523e97cca0154211b27c3a84823227855ba063ff2a6ab7
MD5 37de23144923e2d8d4f01879cc7888f8
BLAKE2b-256 e49e8c0ce49ecb038fa46ff087ac6e085a3e4e3e1cae05b2e5cc06b0be9ec8bf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page