@mailwoman/geographic-model 10.0.0 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -32
- package/data/geographic-model.json +5 -5
- package/data/model/concepts.json +5 -5
- package/lib/artifact.ts +37 -65
- package/lib/compile.ts +55 -70
- package/lib/index.ts +22 -35
- package/lib/load.ts +60 -72
- package/lib/lookup.ts +12 -28
- package/lib/packaged.ts +50 -0
- package/lib/schema.ts +104 -97
- package/lib/validate.ts +32 -56
- package/lib/validation/issues.ts +32 -36
- package/lib/validation/references.ts +24 -27
- package/out/artifact.d.ts +28 -45
- package/out/artifact.d.ts.map +1 -1
- package/out/artifact.js +25 -52
- package/out/artifact.js.map +1 -1
- package/out/compile.d.ts +27 -41
- package/out/compile.d.ts.map +1 -1
- package/out/compile.js +42 -64
- package/out/compile.js.map +1 -1
- package/out/index.d.ts +22 -35
- package/out/index.d.ts.map +1 -1
- package/out/index.js +22 -35
- package/out/index.js.map +1 -1
- package/out/load.d.ts +30 -39
- package/out/load.d.ts.map +1 -1
- package/out/load.js +42 -56
- package/out/load.js.map +1 -1
- package/out/lookup.d.ts +12 -28
- package/out/lookup.d.ts.map +1 -1
- package/out/lookup.js +4 -16
- package/out/lookup.js.map +1 -1
- package/out/packaged.d.ts +24 -0
- package/out/packaged.d.ts.map +1 -0
- package/out/packaged.js +42 -0
- package/out/packaged.js.map +1 -0
- package/out/schema.d.ts +104 -97
- package/out/schema.d.ts.map +1 -1
- package/out/schema.js +37 -52
- package/out/schema.js.map +1 -1
- package/out/tools/build-artifact.d.ts +27 -0
- package/out/tools/build-artifact.d.ts.map +1 -0
- package/out/tools/build-artifact.js +44 -0
- package/out/tools/build-artifact.js.map +1 -0
- package/out/validate.d.ts +29 -50
- package/out/validate.d.ts.map +1 -1
- package/out/validate.js +12 -35
- package/out/validate.js.map +1 -1
- package/out/validation/issues.d.ts +17 -20
- package/out/validation/issues.d.ts.map +1 -1
- package/out/validation/issues.js +25 -29
- package/out/validation/issues.js.map +1 -1
- package/out/validation/references.d.ts.map +1 -1
- package/out/validation/references.js +20 -23
- package/out/validation/references.js.map +1 -1
- package/package.json +35 -76
- package/tools/build-artifact.ts +56 -0
- package/out/scripts/build-artifact.d.ts +0 -51
- package/out/scripts/build-artifact.d.ts.map +0 -1
- package/out/scripts/build-artifact.js +0 -85
- package/out/scripts/build-artifact.js.map +0 -1
package/out/packaged.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
* @file Reads the compiled model this package ships in `data/geographic-model.json`.
|
|
6
|
+
*/
|
|
7
|
+
import { readLocalTextFile } from "@mailwoman/core/fs/readers";
|
|
8
|
+
import { pathExists } from "@mailwoman/core/fs/readers/stat";
|
|
9
|
+
import { resolvePackagePath } from "@mailwoman/core/module/resolvers";
|
|
10
|
+
import { resolvePath } from "path-ts";
|
|
11
|
+
import { parseCompiledGeographicModel } from "#artifact";
|
|
12
|
+
/**
|
|
13
|
+
* The authoring directory and the artifact it compiles to.
|
|
14
|
+
*
|
|
15
|
+
* Probes for `model/model.json`, so a genuinely missing `data/` throws naming the path.
|
|
16
|
+
*/
|
|
17
|
+
export async function packagedModelPaths() {
|
|
18
|
+
const candidates = [resolvePackagePath("@mailwoman/geographic-model", "data")];
|
|
19
|
+
const probes = [];
|
|
20
|
+
for (const candidate of candidates) {
|
|
21
|
+
probes.push([candidate, await pathExists(resolvePath(candidate, "model/model.json"))]);
|
|
22
|
+
}
|
|
23
|
+
const found = probes.find(([, exists]) => exists)?.[0];
|
|
24
|
+
if (!found) {
|
|
25
|
+
throw new Error(`geographic-model: could not find data/model — looked in ${candidates.join(", ")}`);
|
|
26
|
+
}
|
|
27
|
+
return { source: resolvePath(found, "model"), artifact: resolvePath(found, "geographic-model.json") };
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Read the committed artifact.
|
|
31
|
+
*
|
|
32
|
+
* The reader checks the format version.
|
|
33
|
+
* It trusts the records because the loader validated them on input.
|
|
34
|
+
*/
|
|
35
|
+
export async function readCompiledGeographicModel() {
|
|
36
|
+
const text = await readLocalTextFile((await packagedModelPaths()).artifact);
|
|
37
|
+
// A corrupt committed artifact is a broken build and the `SyntaxError` names the offset.
|
|
38
|
+
// The package's parse wrappers live in `@mailwoman/core`, which this package deliberately does not depend on.
|
|
39
|
+
// oxlint-disable-next-line no-restricted-properties -- see the note above.
|
|
40
|
+
return parseCompiledGeographicModel(JSON.parse(text));
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=packaged.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packaged.js","sourceRoot":"","sources":["../lib/packaged.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,EAAgC,4BAA4B,EAAE,MAAM,WAAW,CAAA;AAEtF;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACvC,MAAM,UAAU,GAAG,CAAC,kBAAkB,CAAC,6BAA6B,EAAE,MAAM,CAAC,CAAC,CAAA;IAC9E,MAAM,MAAM,GAA6B,EAAE,CAAA;IAE3C,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACpC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,MAAM,UAAU,CAAC,WAAW,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAA;IACvF,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IAEtD,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,2DAA2D,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACpG,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,WAAW,CAAC,KAAK,EAAE,uBAAuB,CAAC,EAAE,CAAA;AACtG,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B;IAChD,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAAC,CAAC,MAAM,kBAAkB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAA;IAE3E,yFAAyF;IACzF,8GAA8G;IAC9G,2EAA2E;IAC3E,OAAO,4BAA4B,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;AACtD,CAAC"}
|
package/out/schema.d.ts
CHANGED
|
@@ -3,116 +3,101 @@
|
|
|
3
3
|
* @license AGPL-3.0
|
|
4
4
|
* @author Teffen Ellis, et al.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* vocabularies
|
|
8
|
-
* observations, and derived facts.
|
|
6
|
+
* Defines the authored record schema for `@mailwoman/geographic-model`: identifiers, closed
|
|
7
|
+
* vocabularies and the shapes of concepts, relations, mappings, observations and derived facts.
|
|
9
8
|
*
|
|
10
|
-
*
|
|
9
|
+
* The schema has no numeric fields. {@link Modality} is a vocabulary of words with no exported order,
|
|
10
|
+
* because ranking weights belong to `@mailwoman/resolver` and `@mailwoman/neural`.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* called, and ranking belongs to `@mailwoman/resolver` and `@mailwoman/neural`.
|
|
12
|
+
* Authored assertions, source observations and derived facts are separate types with separately
|
|
13
|
+
* branded identifiers. A derived fact has no {@link SourceProvenance}. Its `derivation` and `inputs`
|
|
14
|
+
* serve as its provenance.
|
|
16
15
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* {@link SourceObservationRecord} records what a named external source states and never enters the
|
|
20
|
-
* concept table; a {@link DerivedFactRecord} names the procedure that produced it and every input
|
|
21
|
-
* that procedure read. Their identifiers are separately branded, so one is not assignable where
|
|
22
|
-
* another is expected.
|
|
23
|
-
*
|
|
24
|
-
* **Every record carries provenance, and a derived fact carries it structurally.** A derived fact
|
|
25
|
-
* has no {@link SourceProvenance} of its own: its `derivation` plus its resolved `inputs` ARE its
|
|
26
|
-
* provenance, and each input carries source provenance in turn.
|
|
27
|
-
*
|
|
28
|
-
* Identifier namespaces are per-table. A {@link ConceptID} and a {@link RelationID} may read the
|
|
29
|
-
* same string without colliding; the brands are what keep them apart in a consumer.
|
|
30
|
-
*
|
|
31
|
-
* Consumed by `./validate.ts` (which refuses a document violating any rule above), by #1926's
|
|
32
|
-
* deterministic compiler, and by the first authored document in #1927.
|
|
33
|
-
*
|
|
34
|
-
* Boundary record: `docs/superpowers/specs/2026-08-26-geographic-model-boundaries.md` (#1917).
|
|
16
|
+
* Each table has its own identifier namespace, so a {@link ConceptID} and a {@link RelationID} may hold
|
|
17
|
+
* the same string.
|
|
35
18
|
*/
|
|
36
19
|
import type { POICategoryID } from "@mailwoman/poi-taxonomy/types";
|
|
37
20
|
import type { Tagged } from "type-fest";
|
|
38
21
|
/**
|
|
39
|
-
* A concept identifier,
|
|
22
|
+
* A branded concept identifier, such as `pharmacy` or `obtain_medication`.
|
|
40
23
|
*/
|
|
41
24
|
export type ConceptID = Tagged<string, "GeographicConceptID">;
|
|
42
25
|
/**
|
|
43
|
-
*
|
|
26
|
+
* Brands a string as a {@link ConceptID} without changing it.
|
|
44
27
|
*/
|
|
45
28
|
export declare function toConceptID(id: string): ConceptID;
|
|
46
29
|
/**
|
|
47
|
-
* A relation identifier,
|
|
30
|
+
* A branded relation identifier, such as `affords`.
|
|
48
31
|
*/
|
|
49
32
|
export type RelationID = Tagged<string, "GeographicRelationID">;
|
|
50
33
|
/**
|
|
51
|
-
*
|
|
34
|
+
* Brands a string as a {@link RelationID} without changing it.
|
|
52
35
|
*/
|
|
53
36
|
export declare function toRelationID(id: string): RelationID;
|
|
54
37
|
/**
|
|
55
|
-
* The identifier of one
|
|
38
|
+
* The branded identifier of one {@link RelationAssertion}.
|
|
56
39
|
*/
|
|
57
40
|
export type RuleID = Tagged<string, "GeographicRuleID">;
|
|
58
41
|
/**
|
|
59
|
-
*
|
|
42
|
+
* Brands a string as a {@link RuleID} without changing it.
|
|
60
43
|
*/
|
|
61
44
|
export declare function toRuleID(id: string): RuleID;
|
|
62
45
|
/**
|
|
63
|
-
* The identifier of one {@link ExternalMappingRecord}.
|
|
46
|
+
* The branded identifier of one {@link ExternalMappingRecord}.
|
|
64
47
|
*/
|
|
65
48
|
export type MappingID = Tagged<string, "GeographicMappingID">;
|
|
66
49
|
/**
|
|
67
|
-
*
|
|
50
|
+
* Brands a string as a {@link MappingID} without changing it.
|
|
68
51
|
*/
|
|
69
52
|
export declare function toMappingID(id: string): MappingID;
|
|
70
53
|
/**
|
|
71
|
-
* The identifier of one {@link SourceObservationRecord}.
|
|
54
|
+
* The branded identifier of one {@link SourceObservationRecord}.
|
|
72
55
|
*/
|
|
73
56
|
export type ObservationID = Tagged<string, "GeographicObservationID">;
|
|
74
57
|
/**
|
|
75
|
-
*
|
|
58
|
+
* Brands a string as an {@link ObservationID} without changing it.
|
|
76
59
|
*/
|
|
77
60
|
export declare function toObservationID(id: string): ObservationID;
|
|
78
61
|
/**
|
|
79
|
-
* The identifier of one {@link DerivedFactRecord}.
|
|
62
|
+
* The branded identifier of one {@link DerivedFactRecord}.
|
|
80
63
|
*/
|
|
81
64
|
export type DerivedFactID = Tagged<string, "GeographicDerivedFactID">;
|
|
82
65
|
/**
|
|
83
|
-
*
|
|
66
|
+
* Brands a string as a {@link DerivedFactID} without changing it.
|
|
84
67
|
*/
|
|
85
68
|
export declare function toDerivedFactID(id: string): DerivedFactID;
|
|
86
69
|
/**
|
|
87
|
-
* The
|
|
88
|
-
*
|
|
89
|
-
* which is the review cost the program accepted in exchange for refusing speculative upper-ontology breadth.
|
|
70
|
+
* The concept kinds.
|
|
71
|
+
* A new kind requires a reviewed schema revision.
|
|
90
72
|
*/
|
|
91
73
|
export declare const ConceptKind: {
|
|
92
74
|
/**
|
|
93
|
-
* A geographic
|
|
75
|
+
* A geographic area or point where other things are located.
|
|
94
76
|
*/
|
|
95
77
|
readonly Place: "place";
|
|
96
78
|
/**
|
|
97
|
-
* A class of premises a person can
|
|
79
|
+
* A class of premises that a person can visit, such as `pharmacy`.
|
|
98
80
|
*/
|
|
99
81
|
readonly Establishment: "establishment";
|
|
100
82
|
/**
|
|
101
|
-
*
|
|
102
|
-
* are owned by #1683.
|
|
83
|
+
* A kind of activity, such as `obtain_medication`.
|
|
103
84
|
*/
|
|
104
85
|
readonly Activity: "activity";
|
|
105
86
|
};
|
|
87
|
+
/**
|
|
88
|
+
* A {@link ConceptKind} value.
|
|
89
|
+
*/
|
|
106
90
|
export type ConceptKind = (typeof ConceptKind)[keyof typeof ConceptKind];
|
|
107
91
|
/**
|
|
108
|
-
* How strongly an assertion,
|
|
92
|
+
* How strongly an assertion, observation or derived fact claims that its proposition holds.
|
|
109
93
|
*
|
|
110
|
-
* The
|
|
111
|
-
*
|
|
94
|
+
* The values are ordinal in meaning, but the module exports no order
|
|
95
|
+
* so callers do not convert them into weights.
|
|
112
96
|
*/
|
|
113
97
|
export declare const Modality: {
|
|
114
98
|
/**
|
|
115
|
-
* Holds in every instance
|
|
99
|
+
* Holds in every instance.
|
|
100
|
+
* A counterexample falsifies the record.
|
|
116
101
|
*/
|
|
117
102
|
readonly Necessary: "necessary";
|
|
118
103
|
/**
|
|
@@ -123,12 +108,15 @@ export declare const Modality: {
|
|
|
123
108
|
readonly Expected: "expected";
|
|
124
109
|
readonly WeaklyExpected: "weakly_expected";
|
|
125
110
|
/**
|
|
126
|
-
* Consistent with the concept
|
|
111
|
+
* Consistent with the concept, with no claim about frequency.
|
|
127
112
|
*/
|
|
128
113
|
readonly Possible: "possible";
|
|
129
114
|
readonly Unusual: "unusual";
|
|
130
115
|
readonly StronglyUnusual: "strongly_unusual";
|
|
131
116
|
};
|
|
117
|
+
/**
|
|
118
|
+
* A {@link Modality} value.
|
|
119
|
+
*/
|
|
132
120
|
export type Modality = (typeof Modality)[keyof typeof Modality];
|
|
133
121
|
/**
|
|
134
122
|
* Whether a relation's assertions admit exceptions.
|
|
@@ -143,61 +131,75 @@ export declare const RelationSemantics: {
|
|
|
143
131
|
*/
|
|
144
132
|
readonly Defeasible: "defeasible";
|
|
145
133
|
};
|
|
134
|
+
/**
|
|
135
|
+
* A {@link RelationSemantics} value.
|
|
136
|
+
*/
|
|
146
137
|
export type RelationSemantics = (typeof RelationSemantics)[keyof typeof RelationSemantics];
|
|
147
138
|
/**
|
|
148
|
-
* A concept's
|
|
149
|
-
*
|
|
139
|
+
* A concept's review status.
|
|
140
|
+
* It tells consumers whether to use the record.
|
|
150
141
|
*/
|
|
151
142
|
export declare const ConceptStatus: {
|
|
152
143
|
/**
|
|
153
|
-
* Authored
|
|
144
|
+
* Authored but not yet reviewed.
|
|
154
145
|
*/
|
|
155
146
|
readonly Draft: "draft";
|
|
156
147
|
readonly Active: "active";
|
|
157
148
|
/**
|
|
158
|
-
*
|
|
149
|
+
* Retained so that existing references resolve.
|
|
150
|
+
* New references should avoid it.
|
|
159
151
|
*/
|
|
160
152
|
readonly Deprecated: "deprecated";
|
|
161
153
|
};
|
|
154
|
+
/**
|
|
155
|
+
* A {@link ConceptStatus} value.
|
|
156
|
+
*/
|
|
162
157
|
export type ConceptStatus = (typeof ConceptStatus)[keyof typeof ConceptStatus];
|
|
163
158
|
/**
|
|
164
|
-
*
|
|
165
|
-
*
|
|
159
|
+
* External vocabularies that concepts can map to.
|
|
160
|
+
*
|
|
161
|
+
* {@link ExternalMappingRecord} assumes a single vocabulary.
|
|
162
|
+
* A second vocabulary would require a union discriminated on `vocabulary`.
|
|
166
163
|
*/
|
|
167
164
|
export declare const ExternalVocabulary: {
|
|
168
165
|
/**
|
|
169
|
-
* `@mailwoman/poi-taxonomy
|
|
166
|
+
* Category identifiers from `@mailwoman/poi-taxonomy`.
|
|
170
167
|
*/
|
|
171
168
|
readonly POITaxonomy: "poi-taxonomy";
|
|
172
169
|
};
|
|
170
|
+
/**
|
|
171
|
+
* An {@link ExternalVocabulary} value.
|
|
172
|
+
*/
|
|
173
173
|
export type ExternalVocabulary = (typeof ExternalVocabulary)[keyof typeof ExternalVocabulary];
|
|
174
174
|
/**
|
|
175
|
-
*
|
|
176
|
-
* source
|
|
175
|
+
* The origin of a record.
|
|
176
|
+
* `source` must be non-empty.
|
|
177
177
|
*/
|
|
178
178
|
export interface SourceProvenance {
|
|
179
179
|
/**
|
|
180
|
-
* The
|
|
180
|
+
* The authority, dataset, publication or curator, such as `overture-places` or `mailwoman-curated`.
|
|
181
181
|
*/
|
|
182
182
|
source: string;
|
|
183
183
|
/**
|
|
184
|
-
* The source's
|
|
184
|
+
* The source's version or release string, such as an Overture release.
|
|
185
185
|
*/
|
|
186
186
|
sourceVersion?: string;
|
|
187
187
|
/**
|
|
188
|
-
* The identifier of the specific record
|
|
188
|
+
* The identifier of the specific source record that supports the claim.
|
|
189
189
|
*/
|
|
190
190
|
sourceRecord?: string;
|
|
191
191
|
sourceURL?: string;
|
|
192
192
|
/**
|
|
193
|
-
* ISO 8601
|
|
193
|
+
* ISO 8601 date on which the record was authored, as `YYYY-MM-DD`.
|
|
194
194
|
*/
|
|
195
195
|
authoredAt?: string;
|
|
196
196
|
notes?: string;
|
|
197
197
|
}
|
|
198
198
|
/**
|
|
199
|
-
* One relation's definition.
|
|
200
|
-
*
|
|
199
|
+
* One relation's definition.
|
|
200
|
+
*
|
|
201
|
+
* A relation record defines meaning and the concept kinds allowed on each side.
|
|
202
|
+
* It makes no claim about any particular pair.
|
|
201
203
|
*/
|
|
202
204
|
export interface RelationRecord {
|
|
203
205
|
id: RelationID;
|
|
@@ -214,15 +216,15 @@ export interface RelationRecord {
|
|
|
214
216
|
transitive: boolean;
|
|
215
217
|
symmetric: boolean;
|
|
216
218
|
/**
|
|
217
|
-
* The relation
|
|
218
|
-
*
|
|
219
|
+
* The relation that reads the same edge in the opposite direction.
|
|
220
|
+
*
|
|
221
|
+
* When set, it must exist and declare this relation as its own inverse.
|
|
219
222
|
*/
|
|
220
223
|
inverse?: RelationID;
|
|
221
224
|
semantics: RelationSemantics;
|
|
222
225
|
}
|
|
223
226
|
/**
|
|
224
|
-
* One
|
|
225
|
-
* what a dataset was observed to contain.
|
|
227
|
+
* One curated claim, stored on the concept that it describes.
|
|
226
228
|
*/
|
|
227
229
|
export interface RelationAssertion {
|
|
228
230
|
id: RuleID;
|
|
@@ -230,14 +232,16 @@ export interface RelationAssertion {
|
|
|
230
232
|
target: ConceptID;
|
|
231
233
|
modality: Modality;
|
|
232
234
|
/**
|
|
233
|
-
* ISO 3166-1 alpha-2 codes the claim
|
|
234
|
-
*
|
|
235
|
+
* ISO 3166-1 alpha-2 codes that scope the claim.
|
|
236
|
+
*
|
|
237
|
+
* An absent list means the claim has no country scope.
|
|
238
|
+
* This is weaker than a claim about every country.
|
|
235
239
|
*/
|
|
236
240
|
countries?: string[];
|
|
237
241
|
provenance: SourceProvenance;
|
|
238
242
|
}
|
|
239
243
|
/**
|
|
240
|
-
* One concept
|
|
244
|
+
* One concept and its authored assertions.
|
|
241
245
|
*/
|
|
242
246
|
export interface ConceptRecord {
|
|
243
247
|
id: ConceptID;
|
|
@@ -245,7 +249,8 @@ export interface ConceptRecord {
|
|
|
245
249
|
description: string;
|
|
246
250
|
kind: ConceptKind;
|
|
247
251
|
/**
|
|
248
|
-
* Broader concepts this
|
|
252
|
+
* Broader concepts that this concept is a kind of.
|
|
253
|
+
* The list may be empty but must not form a cycle.
|
|
249
254
|
*/
|
|
250
255
|
isA: ConceptID[];
|
|
251
256
|
assertions: RelationAssertion[];
|
|
@@ -253,26 +258,26 @@ export interface ConceptRecord {
|
|
|
253
258
|
status: ConceptStatus;
|
|
254
259
|
}
|
|
255
260
|
/**
|
|
256
|
-
*
|
|
257
|
-
*
|
|
261
|
+
* Maps an external vocabulary identifier to a concept.
|
|
262
|
+
* The mapping adds no semantics.
|
|
258
263
|
*/
|
|
259
264
|
export interface ExternalMappingRecord {
|
|
260
265
|
id: MappingID;
|
|
261
266
|
concept: ConceptID;
|
|
262
267
|
vocabulary: ExternalVocabulary;
|
|
263
268
|
/**
|
|
264
|
-
* The identifier in the external vocabulary.
|
|
265
|
-
*
|
|
269
|
+
* The identifier in the external vocabulary.
|
|
270
|
+
*
|
|
271
|
+
* The type is `POICategoryID` because `poi-taxonomy` is the only external vocabulary.
|
|
266
272
|
*/
|
|
267
273
|
externalID: POICategoryID;
|
|
268
274
|
provenance: SourceProvenance;
|
|
269
275
|
}
|
|
270
276
|
/**
|
|
271
|
-
* A proposition
|
|
277
|
+
* A proposition stated by an identified external source, expressed in this model's vocabulary.
|
|
272
278
|
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
* explicitly, never by the record sitting in a convenient place.
|
|
279
|
+
* Observations stay out of the concept table.
|
|
280
|
+
* An authored assertion requires an explicit curation decision with its own provenance.
|
|
276
281
|
*/
|
|
277
282
|
export interface SourceObservationRecord {
|
|
278
283
|
id: ObservationID;
|
|
@@ -281,13 +286,13 @@ export interface SourceObservationRecord {
|
|
|
281
286
|
object: ConceptID;
|
|
282
287
|
modality: Modality;
|
|
283
288
|
/**
|
|
284
|
-
* ISO 3166-1 alpha-2 codes the source
|
|
289
|
+
* ISO 3166-1 alpha-2 codes that scope the source's statement.
|
|
285
290
|
*/
|
|
286
291
|
countries?: string[];
|
|
287
292
|
provenance: SourceProvenance;
|
|
288
293
|
}
|
|
289
294
|
/**
|
|
290
|
-
*
|
|
295
|
+
* The table that a {@link DerivationInput} refers to.
|
|
291
296
|
*/
|
|
292
297
|
export declare const DerivationInputKind: {
|
|
293
298
|
readonly Concept: "concept";
|
|
@@ -297,10 +302,13 @@ export declare const DerivationInputKind: {
|
|
|
297
302
|
readonly Observation: "observation";
|
|
298
303
|
readonly DerivedFact: "derived_fact";
|
|
299
304
|
};
|
|
305
|
+
/**
|
|
306
|
+
* A {@link DerivationInputKind} value.
|
|
307
|
+
*/
|
|
300
308
|
export type DerivationInputKind = (typeof DerivationInputKind)[keyof typeof DerivationInputKind];
|
|
301
309
|
/**
|
|
302
|
-
* One record a derivation read.
|
|
303
|
-
*
|
|
310
|
+
* One record that a derivation read.
|
|
311
|
+
* The `kind` discriminant fixes the identifier's brand.
|
|
304
312
|
*/
|
|
305
313
|
export type DerivationInput = {
|
|
306
314
|
kind: typeof DerivationInputKind.Concept;
|
|
@@ -322,21 +330,21 @@ export type DerivationInput = {
|
|
|
322
330
|
id: DerivedFactID;
|
|
323
331
|
};
|
|
324
332
|
/**
|
|
325
|
-
* A fact
|
|
326
|
-
* validator refuses a fact whose derivation is unnamed or whose inputs do not resolve.
|
|
333
|
+
* A fact that an identified procedure computed from specific input records.
|
|
327
334
|
*
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
335
|
+
* The record has no provenance field.
|
|
336
|
+
* Its `derivation` and `inputs` serve as provenance.
|
|
337
|
+
* The validator rejects a fact whose inputs do not resolve.
|
|
331
338
|
*/
|
|
332
339
|
export interface DerivedFactRecord {
|
|
333
340
|
id: DerivedFactID;
|
|
334
341
|
/**
|
|
335
|
-
* The deterministic procedure that produced this fact
|
|
342
|
+
* The name of the deterministic procedure that produced this fact.
|
|
336
343
|
*/
|
|
337
344
|
derivation: string;
|
|
338
345
|
/**
|
|
339
|
-
* Every record the derivation read.
|
|
346
|
+
* Every record that the derivation read.
|
|
347
|
+
* The list must be non-empty and every input must resolve.
|
|
340
348
|
*/
|
|
341
349
|
inputs: DerivationInput[];
|
|
342
350
|
subject: ConceptID;
|
|
@@ -346,15 +354,14 @@ export interface DerivedFactRecord {
|
|
|
346
354
|
countries?: string[];
|
|
347
355
|
}
|
|
348
356
|
/**
|
|
349
|
-
* One authored document
|
|
357
|
+
* One complete authored document.
|
|
350
358
|
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
* stand in for the second is the format where a dropped table reads as a world with no derived facts in it.
|
|
359
|
+
* Every field is required, including `derivedFacts`, so that a dropped table fails
|
|
360
|
+
* validation instead of reading as an empty one.
|
|
354
361
|
*/
|
|
355
362
|
export interface GeographicModelDocument {
|
|
356
363
|
/**
|
|
357
|
-
* The document's
|
|
364
|
+
* The document's data version.
|
|
358
365
|
*/
|
|
359
366
|
version: string;
|
|
360
367
|
relations: RelationRecord[];
|
package/out/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../lib/schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../lib/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAEvC;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAA;AAE7D;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,CAEjD;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAA;AAE/D;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,CAEnD;AAED;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAA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