Repository navigation
docs(examples): add the GASP SaaS core example and conformance scripts - #773
Open
403pagelabs wants to merge 19 commits into
Open
403pagelabs wants to merge 19 commits into
403pagelabs wants to merge 19 commits into
Conversation
The Core department of the GASP Standard (Generally Accepted SaaS Principles, https://gaspwiki.com) as three documents in the layout of the flights set: an ontology (6 entity types, 46 value types with enum constraints), a semantic model (6 datasets, 5 relationships, 39 metrics; 16 staged per-period datasets for the formulas the portable language cannot state in one expression) and the mapping between them, referencing the ontology by name and relative IRI. Generated from the standard's canonical formulas by its exporter and kept in sync there; every metric is an OSSIE_SQL_2026 expression where the language can state it, with filtered aggregates in the FILTER (WHERE ...) form. All three files pass validate.py, including the cross-document checks, and are added to the validation workflow. A runnable demo (data, one query per metric and the expected values, for DuckDB or Postgres) lives beside the source: https://github.com/GASP-Standard/standard/tree/main/standard/exports/ossie/example
The exporter now writes each field and metric expression as the top-level sql form alone, as the flights example does since apache#640, instead of a one-entry dialects list. No expression text changes; all three files still pass validate.py.
…tensions Regenerated from the GASP Standard after apache#522 and apache#691: the three documents declare 0.3.0.dev0 and carry the GASP payloads under nonportable_extensions with data as an object. They pass validate.py, the cross-document checks included.
# Conflicts: # .github/workflows/validation-ci.yml
# Conflicts: # .github/workflows/validation-ci.yml
…ir datasets A metric that reads one dataset is now declared under that dataset and names its fields directly (29 of the 39). The 10 that read several datasets stay at the model root. The ontology picks up three field descriptions reworded in the standard.
…pshot rule to the dataset The ontology declares two prefixes and gives four of its six entity types an iri: the two CEL event classes point at their headings on the CEL page and Customer and Subscription at their glossary pages. Annotations carry the ontology version, the level of Customer and Subscription and the edge class of Customer's two relationships to other entities. A snapshot dataset now states its reading rule once in its own ai_context (one row per key per snapshot date, select one date). The metrics that read it no longer repeat the rule. A dataset description is the label alone. The three files pass validation/validate.py with no warnings.
…t in the examples README
…and the pay-as-you-go status
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.
Adds the Core department of the GASP Standard (Generally Accepted SaaS Principles, https://gaspwiki.com) as an example set in the layout of the flights files: an ontology, a semantic model and the mapping between them, with 15 conformance cases as
ostscripts beside them. GASP is an open standard for SaaS metrics. I offered this on dev@ in the [INTRO] thread (https://lists.apache.org/thread/hyo7xqcyn2339cjtnn31bwsjnxd6rxs3) as a candidate for the roadmap's "Industry / Domain-Specific Semantic Models".What is in it:
gasp_saas.ontology.yaml: 6 entity types (one per dataset), their relationships with multiplicity and 47 value types with enum constraints. All six entity types carry anirithrough three declared prefixes: the two event classes point at their headings on the standard's event ledger page, Customer and Subscription at their glossary pages and the survey response and financials datasets at their entries on the datasets page.gasp_saas.semantic_model.yaml: 6 datasets (revenue_event,cost_event,customer,subscription,survey_response,financials), 5 relationships and 39 metrics. The metrics are MRR, ARR, NRR, GRR, logo churn, CAC, LTV, gross margin, Rule of 40 and the MRR movements, with Operating and Market forms where the standard defines both. 23 of them areOSSIE_SQL_2026expressions, with filtered aggregates in theFILTER (WHERE ...)form. The other 16 need a cohort, a prior period or an opening snapshot, which an expression cannot state, so they read 12 staged datasets whosesourceis the compiled SQL: 11 with one row per period and one cohort table with a row per customer per period, which NRR, GRR and revenue churn rate sum over. The reason is in the GASP extension on each staged dataset. A metric that reads one dataset is declared under that dataset, 29 of the 39. The 10 that read more than one sit at the model root. Thecustomerandsubscriptiondatasets state the snapshot reading rule in theirai_context.gasp_saas.mapping.yaml: the ontology mapped onto the model. It names the other two files by name and relative IRI, so the cross-document checks run.gasp_saas_conformance/: 15 cases from the standard's conformance set, each a semantic model and a script forost. A script creates the tables its case reads, loads the model and asks for one metric throughexecuteExpand, with the expanded SQL and the result under each command. 12 of the cases read a staged dataset, so they run a query as a datasetsourcethrough the expander (fix(expander): expand a dataset whose source is a query #812). The models are slices of the full export, since the cases reach past the Core department (uptime, ticket backlog, DAU over MAU).The files are generated from the standard's formulas by its exporter (https://github.com/GASP-Standard/standard, Apache 2.0) and I will refresh them from there when the standard changes. The full export, 384 metrics, stays in that repository.
All three pass
validate.pywith the cross-document checks. The PR adds their validate lines and path filter tovalidation-ci.ymlbeside the flights set and one line for the three files to the document map inexamples/README.md. Thenonportable_extensionsentries use theGASPtoken registered in #765. Withmainmerged in atc298049,validation/tests/gives 1112 passed and 1 skipped. The Python and scripts suites pass. The 15 scripts pass onostat the head of this branch in about two seconds and their models passvalidate.py. The PR adds a step for them and their path toost-ci.yml, with a second line inexamples/README.md.A runnable demo sits beside the source: data for the six tables, one query per metric and the expected values, for DuckDB or Postgres (https://github.com/GASP-Standard/standard/tree/main/standard/exports/ossie/example/demo). GASP's own test suite runs it on DuckDB and compares each value with the compiled SQL. The conformance set the scripts come from sits in the same repository, with its data files and the expected rows as SQL (https://github.com/GASP-Standard/standard/tree/main/standard/exports/ossie/conformance).
Two things a reviewer may want to weigh in on, both about size. The staged datasets carry their Snowflake, BigQuery and Databricks sources in the GASP extension, because
sourceis one string. That makes the semantic model about 149 KB, far larger than the flights one. If the size is a problem I can drop the other dialects from this copy and keep them in the full export. The scripts add 2.9 MB, because each carries its tables inline so that it stands alone. The largest is 421 KB. If that is too much for this directory I can cut the set to the small cases or move it to a pull request of its own.Updated 2026-11-26 with the files regenerated from the standard. Since the pull request opened: NRR, GRR and revenue churn rate read one cohort table (12 staged sources where there were 16), single-dataset metrics moved under their datasets, the ontology gained its
prefixes,iriandannotationsand the snapshot rule moved from each metric's instructions to the dataset. In this update GRR and revenue churn rate add the contraction that reverses realised usage (the columnusage_reversalon the cohort table),customer_statusgains the valuepay_as_you_goand the survey response dataset gains the fieldbrand_awareness. The conformance scripts were added the same day.