IF Commons GitHub

dataContract

concept

What a dataset promises to those who read it, in one version: its owner, its status and the dates between which the version holds; its fields are the fields of the contract

Model contract. Written in commons/data/models/contract/mod.ts:56. Identified by dataContractId.

Governance: attributes

dataContractIdidentifierrequired

What identifies the contract: its dataset and version

Becomes the column data_contract_id of data_contract.

Written at commons/data/models/contract/mod.ts:59

datasettextrequired

The dataset it is of

Becomes the column dataset of data_contract.

Written at commons/data/models/contract/mod.ts:60

ownertextrequired

Who answers for it

Becomes the column owner of data_contract.

Written at commons/data/models/contract/mod.ts:63

statuscode of contractStatusrequired

Where it is

Becomes the column status of data_contract.

Written at commons/data/models/contract/mod.ts:62

validFrominstantrequired

From when it holds

Becomes the column valid_from of data_contract.

Written at commons/data/models/contract/mod.ts:64

validToinstantoptional

Until when it holds, where it ends

Becomes the column valid_to of data_contract.

Written at commons/data/models/contract/mod.ts:65

versiontextrequired

The version of the contract, as major.minor.patch

Becomes the column version of data_contract.

Written at commons/data/models/contract/mod.ts:61

Logical: the table

Projects to the table data_contract with the primary key data_contract_id.

ColumnTypeNullRoleFrom
data_contract_idtextfalseattributedataContract.dataContractId
datasettextfalseattributedataContract.dataset
ownertextfalseattributedataContract.owner
statustextfalseattributedataContract.status
valid_fromtimestampfalseattributedataContract.validFrom
valid_totimestamptrueattributedataContract.validTo
versiontextfalseattributedataContract.version

Physical: SQL

CREATE TABLE IF NOT EXISTS "data_contract" (
    "data_contract_id" VARCHAR NOT NULL PRIMARY KEY,
    "dataset" VARCHAR NOT NULL,
    "version" VARCHAR NOT NULL,
    "status" VARCHAR NOT NULL,
    "owner" VARCHAR NOT NULL,
    "valid_from" TIMESTAMPTZ NOT NULL,
    "valid_to" TIMESTAMPTZ,
    CONSTRAINT "data_contract_dataset_version_uq" UNIQUE ("dataset", "version"),
    CONSTRAINT "data_contract_status_ck" CHECK ("status" IN ('draft', 'active', 'deprecated', 'retired'))
);

Physical: the typed table

Read and written from TypeScript with the types the model gives: import { dataContract } from "@intellectual-frontiers/data/sql/typed/models". Generated in commons/data/sql/typed/models/contract.auto.ts: do not edit.

import { from } from "@intellectual-frontiers/data/sql/typed";
import { dataContract } from "@intellectual-frontiers/data/sql/typed/models";

const rows = await from(dataContract).select((s) => ({ dataContractId: s.dataContract.dataContractId, dataset: s.dataContract.dataset })).run(runner);

Titles, headings, exports, tables, columns and requirements. Esc closes.