dosi-semantic-authoring

Author Dosi semantic models, metrics, and window calculations as OSI YAML.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing semantic models by hand often produces inconsistent YAML, invalid key declarations, and ambiguous metric definitions that break downstream SQL generation and BI consumption. This Skill enforces a strict authoring contract for Dosi semantic models so datasets, relationships, metrics, and window calculations are valid OSI core YAML.

Core Features & Use Cases

  • Semantic Model Authoring: Define datasets bound to physical tables or reusable SELECT queries, with verified primary keys, unique keys, time dimensions, and model-level relationships.
  • Metric and Window Authoring: Express base metrics with natural aggregates and build rolling, cumulative, period-over-period, rank, and value windows as structured standalone metrics.
  • DATUS Extensions: Encode Dosi-only keys such as time_dimension, join_type, subject_path, and unit inside custom_extensions with versioned JSON payloads.
  • Use Case: A data engineer needs to define a revenue metric with a month-over-month comparison. The Skill guides declaring the orders dataset, marking order_date as the time dimension, and authoring a pop window metric that validates against the native Dosi parser.

Quick Start

Ask the agent to author a Dosi semantic model defining a revenue metric with a rolling 7-day window over the orders dataset.

Frequently Asked Questions about dosi-semantic-authoring

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

FAQPage Schema
How do I author a semantic model in Dosi OSI YAML?

Define one semantic_model per file with stable snake_case names, bind each dataset to a qualified physical table or complete SELECT, and declare every referenced column as a field. Mark time fields with is_time and validate the result with the native Dosi parser.

How do I create window metrics like rolling averages or period-over-period comparisons?

Express each window result as a standalone metric whose OSI expression is one plain aggregate, then put the derivation in a structured window object. Choose pop or offset for period comparisons, rolling for trailing buckets, cumulative for running totals, and rank or value for distribution and nth-value calculations.

When can I declare a primary key on a query-backed dataset?

A source-declared key holds only if the query preserves it, since a one-to-many join repeats key values. Declare a key the source does not declare only after full-table validation confirms the columns are non-null and duplicate-free.

What are DATUS custom_extensions in Dosi semantic models?

Custom_extensions carry Dosi-only keys such as time_dimension, time_granularity, join_type, and metric subject_path inside the owning object. Each entry encodes data as one JSON-object string stamped with the runtime datus_extension_version.

When should I add ai_context instructions to a dataset or field?

Add dataset ai_context.instructions only when the grain or intended use does not follow from the description, and field synonyms only when users reference the field by a name the column does not carry. Restating the description dilutes what a reader can act on.