Semantic data model for LLM-consumable data catalog - shared contract across Nomox services.
Project description
Nomox Semantic Model
The shared knowledge contract between every Nomox service. Describes what data exists (physical layer) and what it means (ontology), and ties the two together so an agent can move from a natural-language concept all the way down to a specific column in a specific table.
Installation
pip install git+https://${GITHUB_TOKEN}@github.com/Nomox-ai/semantics-model.git
Pin to a tag for reproducible installs:
pip install git+https://${GITHUB_TOKEN}@github.com/Nomox-ai/semantics-model.git@v0.1.0
Quickstart
from uuid import uuid4
from nomox_semantics import (
SemanticCatalog, DataSource, SourceType, Table, Column, ColumnDataType,
Entity, EntityAttribute, EntityTableMapping, AttributeRole, SemanticType,
)
# 1. Physical layer — what exists in the database
src = DataSource(slug="prod", name="Prod", source_type=SourceType.POSTGRES)
users = Table(source_id=src.id, schema_name="public", table_name="users")
ltv = Column(table_id=users.id, source_id=src.id, column_name="ltv_cents",
ordinal_position=1, data_type=ColumnDataType.BIGINT, raw_data_type="bigint")
# 2. Semantic layer — what the data means in business terms
customer = Entity(
slug="customer", name="Customer", plural_name="Customers",
aliases=["user", "account holder"], # for natural-language matching
table_mappings=[EntityTableMapping(table_id=users.id, source_id=src.id)], # entity -> table
)
# An EntityAttribute binds a business field to a physical column
ltv_attr = EntityAttribute(
entity_id=customer.id, column_id=ltv.id, source_id=src.id,
name="lifetime_value", display_name="Lifetime Value",
role=AttributeRole.MEASURE, default_aggregation="SUM", # tells the query engine it's aggregatable
semantic_type=SemanticType.CURRENCY, unit="EUR", # values are EUR, not raw cents
)
# 3. Assemble the catalog — the root object every Nomox service consumes
catalog = SemanticCatalog(organisation_id=uuid4(), name="Acme")
catalog.sources[src.id] = src
catalog.tables[users.id] = users
catalog.columns[ltv.id] = ltv
catalog.entities[customer.id] = customer
catalog.attributes[ltv_attr.id] = ltv_attr
Documentation
See docs/ for the full design documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nomox_semantics-0.1.0.tar.gz.
File metadata
- Download URL: nomox_semantics-0.1.0.tar.gz
- Upload date:
- Size: 49.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
debfb4a3b58e4982791c916a8d20bcd4734e81ab7a87be5a98f7e871912cd14f
|
|
| MD5 |
987ca3b2459fad670ca57cde58694b8d
|
|
| BLAKE2b-256 |
1d56396cb854cc74ec7bacad4f36df9736b58c5d6504f3a993d18439816b776c
|
Provenance
The following attestation bundles were made for nomox_semantics-0.1.0.tar.gz:
Publisher:
publish.yml on Nomox-ai/semantics-model
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nomox_semantics-0.1.0.tar.gz -
Subject digest:
debfb4a3b58e4982791c916a8d20bcd4734e81ab7a87be5a98f7e871912cd14f - Sigstore transparency entry: 1615065086
- Sigstore integration time:
-
Permalink:
Nomox-ai/semantics-model@18a074afc869b11961ea54e38d779fdebcfc83a2 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Nomox-ai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@18a074afc869b11961ea54e38d779fdebcfc83a2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file nomox_semantics-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nomox_semantics-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5df4892004272667618ae03595369cea8a152cf9ca0d9946d72681e74d79602c
|
|
| MD5 |
e8030e87aa60021c199d4b760ed9827f
|
|
| BLAKE2b-256 |
5404091cefa21b9f24c01540a0f3f7027b738ce5518f838fde17a25ac03708aa
|
Provenance
The following attestation bundles were made for nomox_semantics-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Nomox-ai/semantics-model
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nomox_semantics-0.1.0-py3-none-any.whl -
Subject digest:
5df4892004272667618ae03595369cea8a152cf9ca0d9946d72681e74d79602c - Sigstore transparency entry: 1615065105
- Sigstore integration time:
-
Permalink:
Nomox-ai/semantics-model@18a074afc869b11961ea54e38d779fdebcfc83a2 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Nomox-ai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@18a074afc869b11961ea54e38d779fdebcfc83a2 -
Trigger Event:
release
-
Statement type: