feat: add extended metadata fields for fields and metrics - #287
Open
jklahr wants to merge 2 commits into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
fieldsandmetrics.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 tofieldsandmetricsosi-schema.json— adds new$defs:SemanticType,Measurement,DefaultSort,SemanticMapping,DesiredDirection,DefaultAggregation,DefaultTimeGranularity,UnitSystemspec.md— documents all new fields with tables, type descriptions, and examplesNew fields
display_labelsemantic_typemonetary, orhttps://www.iso20022.org/glossary/LEI)measurementquantity_kind,unitISO 4217,unit_system)display_format$#,##0.00)default_sortsemantic_mappingstarget,predicate,provenance)hiddengroup_labeldesired_directionhigher_is_better,lower_is_better,neutraldefault_aggregationdefault_time_granularityday,week,month,quarter,yearDesign principles
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:
semantic_mappingsuses an open predicate vocabulary (SKOS baseline:exactMatch,closeMatch,broadMatch,narrowMatch,relatedMatch) rather than a closed enum, allowing non-positive assertions likeDISTINCT_FROMvia extensions. This addresses the regulatory homonym problem — e.g., "Counterparty" under EMIR and "Counterparty" under MiFIR are distinct concepts that should not be conflated.semantic_typeaccepts 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: falseper existing convention; all new fields are added explicitly to theFieldandMetricdefinitions.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