IF Commons GitHub

consent

concept

A subject's consent to a purpose between two dates, and whether it was taken back: what makes a use of their data allowed or not

Model contract. Written in commons/data/models/contract/mod.ts:131. Identified by consentId.

Governance: attributes

consentIdidentifierrequired

What identifies the consent

Becomes the column consent_id of consent.

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

purposetextrequired

What the data may be used for

Becomes the column purpose of consent.

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

statuscode of consentStatusrequired

Whether it is in force

Becomes the column status of consent.

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

subjecttextrequired

Whose it is, as a pseudonymous key

Becomes the column subject of consent.

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

validFrominstantrequired

From when it holds

Becomes the column valid_from of consent.

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

validToinstantoptional

Until when it holds, where it ends

Becomes the column valid_to of consent.

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

Logical: the table

Projects to the table consent with the primary key consent_id.

ColumnTypeNullRoleFrom
consent_idtextfalseattributeconsent.consentId
purposetextfalseattributeconsent.purpose
statustextfalseattributeconsent.status
subjecttextfalseattributeconsent.subject
valid_fromtimestampfalseattributeconsent.validFrom
valid_totimestamptrueattributeconsent.validTo

Physical: SQL

CREATE TABLE IF NOT EXISTS "consent" (
    "consent_id" VARCHAR NOT NULL PRIMARY KEY,
    "subject" VARCHAR NOT NULL,
    "purpose" VARCHAR NOT NULL,
    "status" VARCHAR NOT NULL,
    "valid_from" TIMESTAMPTZ NOT NULL,
    "valid_to" TIMESTAMPTZ,
    CONSTRAINT "consent_status_ck" CHECK ("status" IN ('granted', 'withdrawn'))
);

Physical: the typed table

Read and written from TypeScript with the types the model gives: import { consent } 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 { consent } from "@intellectual-frontiers/data/sql/typed/models";

const rows = await from(consent).select((s) => ({ consentId: s.consent.consentId, subject: s.consent.subject })).run(runner);

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