osi-semantic-authoring

Author OSI core schema semantic models with field roles, keys, relationships, and validation.

1.7k|248|Updated Jul 4, 2025
One-click install
npx skills add https://github.com/Datus-ai/Datus-agent --skill osi-semantic-authoring
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: osi-semantic-authoring
Source: https://github.com/Datus-ai/Datus-agent/tree/main/datus/resources/skills/osi-semantic-authoring
Command: npx skills add https://github.com/Datus-ai/Datus-agent --skill osi-semantic-authoring

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Defining semantic models over warehouse tables requires consistent decisions about which columns are dimensions, keys, or measure sources, and mistakes cause validation failures and broken metric compilation. This Skill encodes the OSI (Open Semantic Interchange) core authoring rules so semantic models are generated correctly the first time.

Core Features & Use Cases

  • Structural field-role assignment: Classifies columns as dimensions (with a dimension: block), keys (primary/unique keys and relationship columns), or plain measure-source fields based on SQL usage evidence.
  • Key verification discipline: Distinguishes declared physical primary keys from candidate logical keys, requiring full-table validation via validate_semantic_key_candidates before declaring unique_keys.
  • Relationship and time-dimension authoring: Declares relationships inside the semantic model with composite-key correspondence, and assigns exactly one verified time field with a data-derived time_granularity hint.
  • Use Case: Given a monthly loan-quality snapshot table with no declared primary key, generate a valid OSI semantic model where balance columns are plain aggregation fields, code columns are dimensions, and the snapshot date carries a verified monthly granularity.

Quick Start

Ask the agent to generate an OSI semantic model for your fact and dimension tables based on the provided SQL history, then validate and publish it.

Frequently Asked Questions about osi-semantic-authoring

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I author an OSI semantic model for warehouse tables?

Plan the target model with plan_osi_semantic_model_target, inspect sources with inspect_semantic_sources, then upsert datasets with upsert_osi_datasets. Declare dimensions via a dimension block, keys via primary_key or validated unique_keys, and measure sources as plain fields, then run validate_semantic and publish_semantic_model.

How are dimensions, keys, and measures declared in OSI core schema?

A field with a dimension block is a dimension; keys are declared at dataset level as primary_key or unique_keys and in relationships; any field without a dimension block is a measure source used only for aggregation. Never write dimension: {is_time: false} for non-dimension fields.

Does OSI semantic authoring support MetricFlow YAML?

No. This skill authors OSI core semantics only and never writes MetricFlow data_source, measures, identifiers, or create_metric YAML. The Datus OSI compiler lowers OSI core documents to the configured execution backend.

When can I declare a primary key or unique key on a dataset?

Declare primary_key only when DDL or a data contract explicitly defines it. Candidate logical keys from SQL joins must pass validate_semantic_key_candidates with full-table verification scope before being added as unique_keys; sort keys like ClickHouse ORDER BY are never transcribed.

Why does semantic model validation report a column lowering to multiple types?

This happens when a column is inconsistently declared as both a dimension and a measure source or key across datasets. Fix it structurally by giving the column a dimension block everywhere, moving it into verified keys or relationships, or dropping the dimension block where it is only aggregated.