IF Commons GitHub

reason

concept

A reason code that says why a stage stopped, rejected or lost something, so that no loss is unexplained

Model flow. Written in commons/data/models/flow/mod.ts:77. Identified by reasonId.

Governance: attributes

meaningtextrequired

What it means, in a sentence

Becomes the column meaning of reason.

Written at commons/data/models/flow/mod.ts:77

producedBycode of producerrequired

Who produces it

Becomes the column producer_code of reason.

Written at commons/data/models/flow/mod.ts:77

reasonIdidentifierrequired

What identifies the reason: its code

Becomes the column reason_id of reason.

Written at commons/data/models/flow/mod.ts:77

stagecode of stageoptional

The stage it is of, where it is of one

Becomes the column stage of reason.

Written at commons/data/models/flow/mod.ts:107

Logical: the table

Projects to the table reason with the primary key reason_id.

ColumnTypeNullRoleFrom
meaningtextfalseattributereason.meaning
producer_codetextfalsereferencereason.producedBy
reason_idtextfalseattributereason.reasonId
stagetexttrueattributereason.stage

Physical: SQL

CREATE TABLE IF NOT EXISTS "reason" (
    "reason_id" VARCHAR NOT NULL PRIMARY KEY,
    "meaning" VARCHAR NOT NULL,
    "producer_code" VARCHAR NOT NULL,
    "stage" VARCHAR,
    CONSTRAINT "reason_producer_code_fk" FOREIGN KEY ("producer_code") REFERENCES "producer" ("code"),
    CONSTRAINT "reason_stage_ck" CHECK ("stage" IN ('received', 'captured', 'parsed', 'mapped', 'validated', 'forwarded', 'dest_verdict', 'usable'))
);

Physical: the typed table

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

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

const rows = await from(reason).select((s) => ({ reasonId: s.reason.reasonId, meaning: s.reason.meaning })).run(runner);

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