xoev-codelists 0.1.0-alpha.1 → 1.2610.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 +71 -0
- package/codelists/ags.json +1 -0
- package/codelists/art-entnahmearmatur.json +1 -0
- package/codelists/art-objekt.json +1 -0
- package/codelists/art-probennahmestelle.json +1 -0
- package/codelists/artgesetzlichervertreter.json +1 -0
- package/codelists/aufbereitungsstoffe-desinfektionsverfahren.json +1 -0
- package/codelists/bezirk.json +1 -0
- package/codelists/desinfektionsart.json +1 -0
- package/codelists/dvdv-praefix.json +1 -0
- package/codelists/format-alternative-id.json +1 -0
- package/codelists/kreis.json +1 -0
- package/codelists/massnahmen.json +1 -0
- package/codelists/medium.json +1 -0
- package/codelists/parameterauspraegung.json +1 -0
- package/codelists/pass-und-ausweisdokumente.json +1 -0
- package/codelists/probenentnahmegeraet.json +1 -0
- package/codelists/probengefaess.json +1 -0
- package/codelists/probennahmeverfahren.json +1 -0
- package/codelists/rechtsformen.json +1 -0
- package/codelists/rs.json +1 -0
- package/codelists/shapth-parameter-einheit.json +1 -0
- package/codelists/shapth-parameter.json +1 -0
- package/codelists/sprachenkatalog.json +1 -0
- package/codelists/staat.json +1 -0
- package/codelists/staatsangehoerigkeit.json +1 -0
- package/codelists/unterkategorie-probennahmestelle.json +1 -0
- package/codelists/untersuchung-anlass.json +1 -0
- package/codelists/untersuchungsverfahren.json +1 -0
- package/codes/ags.json +1 -0
- package/codes/art-entnahmearmatur.json +1 -0
- package/codes/art-objekt.json +1 -0
- package/codes/art-probennahmestelle.json +1 -0
- package/codes/artgesetzlichervertreter.json +1 -0
- package/codes/aufbereitungsstoffe-desinfektionsverfahren.json +1 -0
- package/codes/bezirk.json +1 -0
- package/codes/desinfektionsart.json +1 -0
- package/codes/dvdv-praefix.json +1 -0
- package/codes/format-alternative-id.json +1 -0
- package/codes/kreis.json +1 -0
- package/codes/massnahmen.json +1 -0
- package/codes/medium.json +1 -0
- package/codes/parameterauspraegung.json +1 -0
- package/codes/pass-und-ausweisdokumente.json +1 -0
- package/codes/probenentnahmegeraet.json +1 -0
- package/codes/probengefaess.json +1 -0
- package/codes/probennahmeverfahren.json +1 -0
- package/codes/rechtsformen.json +1 -0
- package/codes/rs.json +1 -0
- package/codes/shapth-parameter-einheit.json +1 -0
- package/codes/shapth-parameter.json +1 -0
- package/codes/sprachenkatalog.json +1 -0
- package/codes/staat.json +1 -0
- package/codes/staatsangehoerigkeit.json +1 -0
- package/codes/unterkategorie-probennahmestelle.json +1 -0
- package/codes/untersuchung-anlass.json +1 -0
- package/codes/untersuchungsverfahren.json +1 -0
- package/index.json +556 -2
- package/package.json +12 -2
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# xoev-codelists
|
|
2
|
+
|
|
3
|
+
Versioned codelists referenced by XÖV standards, addressable as **URN + version**.
|
|
4
|
+
|
|
5
|
+
For XÖV **code type 3** (`http://xoev.de/schemata/code/1_0`, datatype `Code`) the
|
|
6
|
+
codelist URI is fixed by the standard while the version is chosen by the sender
|
|
7
|
+
(`listVersionID`), so a receiver must be able to resolve **any published
|
|
8
|
+
version**, not only the one that was current at release time.
|
|
9
|
+
|
|
10
|
+
27 codelists, 272 versions — XWasser, Destatis, XUnternehmen, DSMeld,
|
|
11
|
+
XAusländer and BMI/BIT.
|
|
12
|
+
|
|
13
|
+
## Layout
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
index.json all codelists with their published versions
|
|
17
|
+
codelists/<slug>.json full dataset: all rows and columns per version
|
|
18
|
+
labels/<slug>.json key + label column per version (dropdowns, display)
|
|
19
|
+
codes/<slug>.json key column per version (validation only)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
A dataset is one snapshot of the newest version plus reverse deltas towards older
|
|
23
|
+
versions (`{"base": …, "steps": [{"delta": …} | {"snapshot": …}]}`) — small
|
|
24
|
+
enough to ship, exact enough to rebuild every version.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
import index from 'xoev-codelists/index.json';
|
|
30
|
+
|
|
31
|
+
const urn = 'urn:xoev-de:xwasser:codeliste:untersuchungsverfahren';
|
|
32
|
+
const entry = index.codelists.find((codelist) => codelist.urn === urn);
|
|
33
|
+
// entry.current -> newest published version
|
|
34
|
+
// entry.versions -> all published versions, newest first
|
|
35
|
+
// entry.codes -> path to the code-only dataset
|
|
36
|
+
// entry.labels -> path to the full dataset
|
|
37
|
+
|
|
38
|
+
// only load what you need
|
|
39
|
+
const dataset = (await import(`xoev-codelists/${entry.labels}`)).default;
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Rebuild a version by folding the deltas, or precompute the few versions the
|
|
43
|
+
application supports:
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
function resolve(dataset, version) {
|
|
47
|
+
let current = structuredClone(dataset.base);
|
|
48
|
+
if (current.version === version) return current;
|
|
49
|
+
for (const step of dataset.steps ?? []) {
|
|
50
|
+
current = step.snapshot ? structuredClone(step.snapshot) : apply(current, step.delta);
|
|
51
|
+
if (current.version === version) return current;
|
|
52
|
+
}
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`apply(snapshot, delta)` removes `delta.removed_rows`, restores
|
|
58
|
+
`delta.restored_cells` (`{key, column, value}`, column as index into
|
|
59
|
+
`delta.columns`), maps the remaining columns (`delta.renamed_columns` allows for
|
|
60
|
+
renamed columns) and appends `delta.added_rows`. The Rust reference
|
|
61
|
+
implementation is `xoev_codelists::apply`.
|
|
62
|
+
|
|
63
|
+
For validation only, `codes/<slug>.json` is enough: it holds the key column per
|
|
64
|
+
version, which is all you need to check a transmitted code (17 KiB gzipped for all
|
|
65
|
+
27 codelists and 272 versions). For dropdowns and display, `labels/<slug>.json`
|
|
66
|
+
adds the label column (46 KiB gzipped for the 15 codelists the XWasser frontend
|
|
67
|
+
uses, all versions included).
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
MIT
|