Building an Ontology Schema for a Small Supply Network
Описание и применение
Создана единая схема YAML для небольшого сети поставок, обеспечивающая согласованные метрики, такие как своевременность, заполнение и время ожидания, и выводя таблицу и график с 57,1 % своевременности.
Задача
Different notebooks defined the same operational word inconsistently, leading to conflicting metrics such as on‑time rates.
Результат
The ontology schema enforces consistent metric definitions, preventing duplicate or misspelled columns, and produces a 57.1% on‑time rate with clear lane‑level insights.
Рабочий процесс
- Define the question and cutoff (on‑time < 50%)
- Choose fact grain (Shipment) and dimensions (Node, Lane, Carrier, Sku)
- Define properties (actual_hours, planned_hours, etc.) and metrics (OnTime, FillPercent, DwellHours, LateHours)
- Write YAML schema in schema/inland_network.yaml
- Load schema with PyYAML and validate with ontology.py
- Bind data from data/network.json with bind.py
- Score shipments with metrics.py using rules from ontology
- Generate brief table via main.py and FastAPI endpoint
- Run tests with pytest to ensure correctness
Доказательства
I wanted one place that says what a shipment is, which lane it used, and what "on time" means, before any table or brief was allowed to invent a second meaning.
LaneSchema is that place, as a personal experiment on a laptop.
The ontology lives in schema/inland_network.yaml.
The fact grain is Shipment. The dimensions are Node, Lane, Carrier, and Sku.
A metric that points at a property the grain does not have dies in load_ontology with a SchemaError.
python main.py prints that table. FastAPI serves the same build_report function.
- Дата записи: 2026-10-16T03:41:25.792Z