Skip to content

feat: add extended metadata fields for fields and metrics - #287

Open
jklahr wants to merge 2 commits into
apache:mainfrom
jklahr:extended-metadata
Open

feat: add extended metadata fields for fields and metrics#287
jklahr wants to merge 2 commits into
apache:mainfrom
jklahr:extended-metadata

Conversation

@jklahr

@jklahr jklahr commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR proposes a new extended metadata layer for the Apache Ossie core spec — a standardized, optional set of non-executional, interpretability metadata fields for fields and metrics.

A companion announcement and discussion will be sent to dev@ossie.apache.org.

Motivation

OSI/Ossie defines what data is. There is currently limited standardization for how data should be interpreted and presented. As a result, consumers (BI tools, AI agents, developers) must repeatedly infer or redefine units, display conventions, aggregation behavior, KPI polarity, and field visibility.

This proposal addresses those gaps through optional metadata that does not affect query execution.

Extended proposal document (design rationale, field-by-field detail, open questions): https://docs.google.com/document/d/1DLuteF0WwlVbpD5kmHhcqa6vItqNFL4MoAQrImy6dKo

Changes

Three files in core-spec/ are updated:

  • spec.yaml — adds extended metadata fields to fields and metrics
  • osi-schema.json — adds new $defs: SemanticType, Measurement, DefaultSort, SemanticMapping, DesiredDirection, DefaultAggregation, DefaultTimeGranularity, UnitSystem
  • spec.md — documents all new fields with tables, type descriptions, and examples

New fields

Field Applies to Purpose
display_label fields, metrics Human-readable display name
semantic_type fields, metrics Token or URI classification (e.g., monetary, or https://www.iso20022.org/glossary/LEI)
measurement fields, metrics Unit/quantity metadata (quantity_kind, unit ISO 4217, unit_system)
display_format fields, metrics Excel-compatible format string (e.g., $#,##0.00)
default_sort fields, metrics Default sort direction, null handling, and optional sort-by-field
semantic_mappings fields, metrics Links to external ontologies via SKOS-based open predicate vocabulary (target, predicate, provenance)
hidden fields, metrics Hide from consumer UIs while remaining available in expressions
group_label fields, metrics Organizational grouping for UI presentation
desired_direction metrics only KPI polarity: higher_is_better, lower_is_better, neutral
default_aggregation fields only Default aggregation when field is used as a measure
default_time_granularity fields only Default time bucket for temporal fields: day, week, month, quarter, year

Design principles

  • Non-executional: no field affects query execution
  • Optional and backward compatible: all existing models remain valid
  • Consumer-focused: designed for BI tools, AI agents, and developers

Community input incorporated

Dragos Crintea (maintainer of semantido, a SQLAlchemy-based semantic layer used in capital-markets/regulatory-reporting contexts) provided substantive feedback that has been incorporated into this PR:

  1. semantic_mappings uses an open predicate vocabulary (SKOS baseline: exactMatch, closeMatch, broadMatch, narrowMatch, relatedMatch) rather than a closed enum, allowing non-positive assertions like DISTINCT_FROM via extensions. This addresses the regulatory homonym problem — e.g., "Counterparty" under EMIR and "Counterparty" under MiFIR are distinct concepts that should not be conflated.
  2. semantic_type accepts either a well-known token or a URI, keeping simple cases simple while supporting governed external type systems (ISO 20022, FIBO, SKOS vocabularies, LEI, ISIN, etc.).

Dragos has also offered to contribute a reference implementation in the semantido-OSI converter and benchmark data showing accuracy improvements from this class of metadata. Those contributions will follow in subsequent PRs.

Impact on existing implementations

None — all additions are optional. The JSON schema uses additionalProperties: false per existing convention; all new fields are added explicitly to the Field and Metric definitions.

Related discussions

AI disclosure

This contribution was developed with AI assistance (Snowflake Cortex Code). The author (Josh Klahr) has reviewed all changes and is personally responsible for the content per the ASF Generative Tooling Guidance.

.... Generated with Cortex Code

Co-Authored-By: Cortex Code noreply@snowflake.com

Josh Klahr and others added 2 commits July 28, 2026 23:51
Introduces optional, non-executional interpretability metadata to the
core spec. New fields enable consumers (BI tools, AI agents, developers)
to correctly interpret, render, and present semantic model data.

New field-level attributes: display_label, semantic_type, measurement,
display_format, default_aggregation, default_sort, default_time_granularity,
semantic_mappings, hidden, group_label.

New metric-level attributes: display_label, semantic_type, measurement,
display_format, desired_direction, default_sort, semantic_mappings,
hidden, group_label.

All additions are optional and backward compatible. Existing models
remain valid without modification.

.... Generated with [Cortex Code](https://docs.snowflake.com/en/user-guide/cortex-code/cortex-code)

Co-Authored-By: Cortex Code <noreply@snowflake.com>
…c_type

Incorporate suggestions from semantido maintainer:

- Restructure semantic_mappings: replace source+identifier with target
  (URI) + predicate (open vocabulary, SKOS baseline) + optional provenance.
  The open predicate vocabulary allows non-positive assertions such as
  DISTINCT_FROM to be expressed via extensions, addressing the regulatory
  homonym problem (e.g. EMIR vs MiFIR Counterparty disambiguation).

- Change semantic_type from a closed enum to token-or-URI. Well-known
  tokens (categorical, monetary, temporal, etc.) continue to work as-is;
  a URI value allows governed external type systems (ISO 20022, FIBO,
  SKOS vocabularies) to carry domain-specific types without requiring
  spec changes.

.... Generated with [Cortex Code](https://docs.snowflake.com/en/user-guide/cortex-code/cortex-code)

Co-Authored-By: Cortex Code <noreply@snowflake.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant