IF Commons GitHub

mapping

concept

A source system's value mapped to the canonical value, with how the two relate, the rule it follows, who approved it and the dates between which it holds

Model meaning. Written in commons/data/models/meaning/mod.ts:69. Identified by mappingId.

Governance: attributes

approvedAtinstantoptional

When it was approved

Becomes the column approved_at of mapping.

Written at commons/data/models/meaning/mod.ts:82

approvedBytextoptional

Who approved it

Becomes the column approved_by of mapping.

Written at commons/data/models/meaning/mod.ts:81

mappingIdidentifierrequired

What identifies the mapping

Becomes the column mapping_id of mapping.

Written at commons/data/models/meaning/mod.ts:72

relationshipTypecode of relationshipTyperequired

How the two relate

Becomes the column relationship_type of mapping.

Written at commons/data/models/meaning/mod.ts:78

ruletextoptional

The rule it follows, where it is more than a lookup

Becomes the column rule of mapping.

Written at commons/data/models/meaning/mod.ts:79

sourceFieldtextrequired

The field the value is of

Becomes the column source_field of mapping.

Written at commons/data/models/meaning/mod.ts:74

sourceSystemtextrequired

The system the value is from

Becomes the column source_system of mapping.

Written at commons/data/models/meaning/mod.ts:73

sourceValuetextrequired

The value as the source gives it

Becomes the column source_value of mapping.

Written at commons/data/models/meaning/mod.ts:75

statuscode of mappingStatusrequired

Where it is in its approval

Becomes the column status of mapping.

Written at commons/data/models/meaning/mod.ts:80

targetFieldtextrequired

The canonical field

Becomes the column target_field of mapping.

Written at commons/data/models/meaning/mod.ts:76

targetValuetextoptional

The canonical value; none where the relationship is unmapped

Becomes the column target_value of mapping.

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

validFrominstantrequired

From when it holds

Becomes the column valid_from of mapping.

Written at commons/data/models/meaning/mod.ts:83

validToinstantoptional

Until when it holds, where it ends

Becomes the column valid_to of mapping.

Written at commons/data/models/meaning/mod.ts:84

Logical: the table

Projects to the table mapping with the primary key mapping_id.

ColumnTypeNullRoleFrom
approved_attimestamptrueattributemapping.approvedAt
approved_bytexttrueattributemapping.approvedBy
mapping_idtextfalseattributemapping.mappingId
relationship_typetextfalseattributemapping.relationshipType
ruletexttrueattributemapping.rule
source_fieldtextfalseattributemapping.sourceField
source_systemtextfalseattributemapping.sourceSystem
source_valuetextfalseattributemapping.sourceValue
statustextfalseattributemapping.status
target_fieldtextfalseattributemapping.targetField
target_valuetexttrueattributemapping.targetValue
valid_fromtimestampfalseattributemapping.validFrom
valid_totimestamptrueattributemapping.validTo

Physical: SQL

CREATE TABLE IF NOT EXISTS "mapping" (
    "mapping_id" VARCHAR NOT NULL PRIMARY KEY,
    "source_system" VARCHAR NOT NULL,
    "source_field" VARCHAR NOT NULL,
    "source_value" VARCHAR NOT NULL,
    "target_field" VARCHAR NOT NULL,
    "target_value" VARCHAR,
    "relationship_type" VARCHAR NOT NULL,
    "rule" VARCHAR,
    "status" VARCHAR NOT NULL,
    "approved_by" VARCHAR,
    "approved_at" TIMESTAMPTZ,
    "valid_from" TIMESTAMPTZ NOT NULL,
    "valid_to" TIMESTAMPTZ,
    CONSTRAINT "mapping_relationship_type_ck" CHECK ("relationship_type" IN ('equivalent', 'broader', 'narrower', 'related', 'unmapped')),
    CONSTRAINT "mapping_status_ck" CHECK ("status" IN ('draft', 'approved', 'retired'))
);

Physical: the typed table

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

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

const rows = await from(mapping).select((s) => ({ mappingId: s.mapping.mappingId, sourceSystem: s.mapping.sourceSystem })).run(runner);

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