react-advanced-odontogram 2.0.2
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/LICENSE +21 -0
- package/README.md +1382 -0
- package/dist/App.d.ts +148 -0
- package/dist/DualStateConfirm.d.ts +25 -0
- package/dist/ExportOptionsModal.d.ts +26 -0
- package/dist/PerioChart.d.ts +67 -0
- package/dist/PerioSidebar.d.ts +1 -0
- package/dist/SettingsModal.d.ts +84 -0
- package/dist/bridgeOverlay.d.ts +116 -0
- package/dist/fhir/codesystems.d.ts +51 -0
- package/dist/fhir/fieldMappings.d.ts +35 -0
- package/dist/fhir/fromFhir.d.ts +7 -0
- package/dist/fhir/primitives.d.ts +16 -0
- package/dist/fhir/toFhir.d.ts +20 -0
- package/dist/fhir/toFhirPerio.d.ts +70 -0
- package/dist/fhir/types.d.ts +108 -0
- package/dist/i18n/translations.d.ts +27 -0
- package/dist/i18n/useI18n.d.ts +39 -0
- package/dist/index.d.ts +4 -0
- package/dist/odontogram.d.ts +1214 -0
- package/dist/odontogram.js +20645 -0
- package/dist/odontogram.js.map +1 -0
- package/dist/perioClassification.d.ts +90 -0
- package/dist/perioExport.d.ts +13 -0
- package/dist/perioGraphic.d.ts +496 -0
- package/dist/perioIndexNames.d.ts +29 -0
- package/dist/perioPdf.d.ts +77 -0
- package/dist/plugin.d.ts +63 -0
- package/dist/registry/axes.d.ts +9 -0
- package/dist/registry/fhir.d.ts +3 -0
- package/dist/registry/fromFhir.d.ts +3 -0
- package/dist/registry/restorations.d.ts +26 -0
- package/dist/registry/svgActivate.d.ts +15 -0
- package/dist/registry/svgLayers.d.ts +14 -0
- package/dist/registry/types.d.ts +70 -0
- package/dist/registry/uiOptions.d.ts +17 -0
- package/dist/registry/validate.d.ts +4 -0
- package/dist/status_extras.d.ts +58 -0
- package/dist/style.css +1 -0
- package/dist/theme.d.ts +51 -0
- package/dist/tour.d.ts +9 -0
- package/dist/utils/numbering.d.ts +23 -0
- package/package.json +99 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { Bundle, OdontogramExportPayload, FhirExportOptions } from "./types";
|
|
2
|
+
import { type PerioDerivationInput } from "../perioClassification";
|
|
3
|
+
/**
|
|
4
|
+
* Append one periodontal-panel Observation per tooth with charted perio
|
|
5
|
+
* sites to `bundle.entry`, mutating it in place. Called from
|
|
6
|
+
* `buildFhirBundle` (toFhir.ts) AFTER the registry-driven per-tooth
|
|
7
|
+
* Observations. A tooth with no charted perio sites (the common case —
|
|
8
|
+
* `rec.perio` is omitted entirely by serializeState() unless at least one
|
|
9
|
+
* site is charted) contributes NO entry, which is what keeps the existing
|
|
10
|
+
* `fhir-golden.json` fixture (built from payloads with no perio data at
|
|
11
|
+
* all) byte-identical after this task.
|
|
12
|
+
*
|
|
13
|
+
* Pure aside from the `bundle.entry` mutation; tolerant of malformed
|
|
14
|
+
* `payload` (never throws), matching `buildFhirBundle`'s own contract.
|
|
15
|
+
*/
|
|
16
|
+
export declare function appendPerioObservations(bundle: Bundle, payload: OdontogramExportPayload, options?: FhirExportOptions): void;
|
|
17
|
+
/**
|
|
18
|
+
* Payload-side adapter for {@link derivePerioClassification} — reduces a
|
|
19
|
+
* SERIALIZED `OdontogramExportPayload` (not live module state) into the pure
|
|
20
|
+
* {@link PerioDerivationInput} struct. Mirrors `buildDerivationInputFromState`
|
|
21
|
+
* in odontogram.ts field-for-field: per tooth, `interdentalCal`/
|
|
22
|
+
* `buccalOralCal` are the worst (max) derived CAL (`pd + gm`) over the
|
|
23
|
+
* approximal/mid site groups; `maxPd` is the worst raw PD over any of the 6
|
|
24
|
+
* sites; `present` via {@link presentFromSelection}. `bopPercent` is the
|
|
25
|
+
* whole-payload %BOP over every charted site across every tooth;
|
|
26
|
+
* `maxFurcation` the highest graded furcation entrance anywhere. `meta`
|
|
27
|
+
* comes straight from `payload.case` (the SAME shape `CaseMeta` serializes
|
|
28
|
+
* to), defaulting exactly like `defaultCaseMeta()` when a field is absent.
|
|
29
|
+
*
|
|
30
|
+
* Pure; tolerant of malformed/missing `payload`/`payload.teeth`/`payload.case`
|
|
31
|
+
* (never throws) — unrecognized sites, non-numeric values, and foreign enum
|
|
32
|
+
* strings are silently treated as "not charted"/"unknown", the same
|
|
33
|
+
* tolerance policy {@link buildToothPerioObservation} follows.
|
|
34
|
+
*/
|
|
35
|
+
export declare function buildDerivationInputFromPayload(payload: OdontogramExportPayload): PerioDerivationInput;
|
|
36
|
+
/**
|
|
37
|
+
* Append the engine's FIRST FHIR Condition — the 2017 World Workshop
|
|
38
|
+
* periodontitis/gingivitis diagnosis (ICD-10/BNO K05) — to `bundle.entry`
|
|
39
|
+
* when the FINAL classification (override ?? derived, see
|
|
40
|
+
* {@link computeFinalClassification}) is gingivitis or periodontitis.
|
|
41
|
+
* Emits NOTHING (no Condition, no evidence Observations) for a "health"
|
|
42
|
+
* diagnosis. Called from `buildFhirBundle` (toFhir.ts) AFTER
|
|
43
|
+
* `appendPerioObservations`.
|
|
44
|
+
*
|
|
45
|
+
* `code`: K05.3 periodontitis, K05.2 when the final `extent` is
|
|
46
|
+
* "molar-incisor" (checked BEFORE the generic periodontitis code — mirrors
|
|
47
|
+
* `derivePerioClassification`'s own molar-incisor-first precedence), K05.1
|
|
48
|
+
* gingivitis.
|
|
49
|
+
*
|
|
50
|
+
* `stage[]`: one type-differentiated entry per APPLICABLE axis only — a
|
|
51
|
+
* stage entry iff diagnosis is periodontitis AND `stage` is neither "na" nor
|
|
52
|
+
* "indeterminate"; a grade entry iff `grade` is not "indeterminate"
|
|
53
|
+
* (evaluated regardless of diagnosis, since `derivePerioClassification`
|
|
54
|
+
* itself computes grade independently of diagnosis); an extent entry iff
|
|
55
|
+
* `extent` is not "na". Each entry's `type`/`summary` are engine-local
|
|
56
|
+
* CodeableConcepts (`periodontal-stage`/`-grade`/`-extent` type codes,
|
|
57
|
+
* `stage-<I..IV>`/`grade-<A..C>`/`extent-<value>` summary codes) — SNOMED is
|
|
58
|
+
* deferred per task-3-brief.md.
|
|
59
|
+
*
|
|
60
|
+
* `evidence[]`: references the smoking-status Observation (emitted only
|
|
61
|
+
* when `payload.case.smokingStatus` is a concrete non-"unknown" value) and
|
|
62
|
+
* the HbA1c Observation (emitted only when `payload.case.hba1c` is set) —
|
|
63
|
+
* both pushed to `bundle.entry` alongside the Condition, never on their own.
|
|
64
|
+
*
|
|
65
|
+
* Pure aside from the `bundle.entry` mutation; tolerant of malformed
|
|
66
|
+
* `payload` (never throws, via {@link buildDerivationInputFromPayload}'s own
|
|
67
|
+
* tolerance); deterministic (fixed ids, no Date/random) — the same payload
|
|
68
|
+
* always produces a byte-identical Condition/evidence block.
|
|
69
|
+
*/
|
|
70
|
+
export declare function appendPerioCondition(bundle: Bundle, payload: OdontogramExportPayload, options?: FhirExportOptions): void;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { Bundle, Observation, Patient, Condition, CodeableConcept, Coding } from "fhir/r4";
|
|
2
|
+
export type { Bundle, Observation, Patient, Condition, CodeableConcept, Coding };
|
|
3
|
+
/** Per-tooth record as produced by the engine's serializeState(). */
|
|
4
|
+
export interface ToothRecord {
|
|
5
|
+
toothSelection?: string;
|
|
6
|
+
endoResection?: boolean;
|
|
7
|
+
mods?: string[];
|
|
8
|
+
periapicalType?: string;
|
|
9
|
+
endo?: string;
|
|
10
|
+
caries?: string[];
|
|
11
|
+
cariesActiveDepth?: number;
|
|
12
|
+
cariesSeverity?: Record<string, number>;
|
|
13
|
+
cariesDepths?: Record<string, number>;
|
|
14
|
+
calculus?: boolean;
|
|
15
|
+
fillingMaterial?: string;
|
|
16
|
+
fillingSurfaces?: string[];
|
|
17
|
+
fillingSurfaceMaterials?: Record<string, string>;
|
|
18
|
+
fissureSealing?: boolean;
|
|
19
|
+
contactMesial?: boolean;
|
|
20
|
+
contactDistal?: boolean;
|
|
21
|
+
wearEdge?: string;
|
|
22
|
+
wearCervical?: string;
|
|
23
|
+
discoloration?: string;
|
|
24
|
+
periImplant?: string;
|
|
25
|
+
cejVisibility?: string;
|
|
26
|
+
rootConcavity?: string;
|
|
27
|
+
orthoAppliance?: string;
|
|
28
|
+
orthoDrift?: string;
|
|
29
|
+
orthoVertical?: string;
|
|
30
|
+
orthoRotation?: boolean;
|
|
31
|
+
brokenMesial?: boolean;
|
|
32
|
+
brokenIncisal?: boolean;
|
|
33
|
+
brokenDistal?: boolean;
|
|
34
|
+
extractionWound?: boolean;
|
|
35
|
+
extractionPlan?: boolean;
|
|
36
|
+
parapulpalPin?: boolean;
|
|
37
|
+
crownReplace?: boolean;
|
|
38
|
+
crownNeeded?: boolean;
|
|
39
|
+
missingClosed?: boolean;
|
|
40
|
+
bridgePillar?: boolean;
|
|
41
|
+
prosthesis?: string;
|
|
42
|
+
mobility?: string;
|
|
43
|
+
toothSubstrate?: string;
|
|
44
|
+
restorationType?: string;
|
|
45
|
+
restorationMaterial?: string;
|
|
46
|
+
crownLeakage?: boolean;
|
|
47
|
+
pulpDx?: string;
|
|
48
|
+
pulpLatin?: string;
|
|
49
|
+
apicalDx?: string;
|
|
50
|
+
resorptionType?: string;
|
|
51
|
+
rootCaries?: string;
|
|
52
|
+
secondaryCaries?: Record<string, number>;
|
|
53
|
+
radiographicDepth?: Record<string, string>;
|
|
54
|
+
fillingDefect?: Record<string, string>;
|
|
55
|
+
perio?: {
|
|
56
|
+
pd: Record<string, number>;
|
|
57
|
+
gm: Record<string, number>;
|
|
58
|
+
bop: string[];
|
|
59
|
+
sup: string[];
|
|
60
|
+
};
|
|
61
|
+
furcation?: Record<string, number>;
|
|
62
|
+
plaque?: string[];
|
|
63
|
+
pi?: Record<string, number>;
|
|
64
|
+
gi?: Record<string, number>;
|
|
65
|
+
kg?: number;
|
|
66
|
+
mpi?: Record<string, number>;
|
|
67
|
+
mbi?: Record<string, number>;
|
|
68
|
+
customStates?: Record<string, unknown>;
|
|
69
|
+
note?: string;
|
|
70
|
+
}
|
|
71
|
+
/** The serialized odontogram export payload (matches exportStatus()'s object).
|
|
72
|
+
* `plan` (R2-A Task 2, payload >=2.11) is additive: present only when the
|
|
73
|
+
* PLAN chart has been initialized and differs from `teeth` (the STATUS
|
|
74
|
+
* chart, always the primary/required field). FHIR export/import (toFhir.ts/
|
|
75
|
+
* fromFhir.ts) reads only `teeth`/`globals` and ignores `plan` — the plan
|
|
76
|
+
* layer round-trips through the JSON payload only, not FHIR. */
|
|
77
|
+
export interface OdontogramExportPayload {
|
|
78
|
+
version: string;
|
|
79
|
+
globals?: Record<string, boolean>;
|
|
80
|
+
teeth: Record<string, ToothRecord>;
|
|
81
|
+
plan?: Record<string, ToothRecord>;
|
|
82
|
+
case?: {
|
|
83
|
+
age?: number;
|
|
84
|
+
smokingStatus?: string;
|
|
85
|
+
cigarettesPerDay?: number;
|
|
86
|
+
diabetesStatus?: string;
|
|
87
|
+
hba1c?: number;
|
|
88
|
+
toothLossPerio?: number;
|
|
89
|
+
maxRblPercent?: number;
|
|
90
|
+
/** P4b Task 2: per-axis clinician overrides for the 2017 World Workshop
|
|
91
|
+
* periodontal classification (see `getPerioClassification()` in
|
|
92
|
+
* odontogram.ts) — one of the concrete enum values for that axis, or
|
|
93
|
+
* omitted when not overridden. */
|
|
94
|
+
diagnosisOverride?: string;
|
|
95
|
+
stageOverride?: string;
|
|
96
|
+
gradeOverride?: string;
|
|
97
|
+
extentOverride?: string;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/** Options for buildFhirBundle / exportFhir. */
|
|
101
|
+
export interface FhirExportOptions {
|
|
102
|
+
/**
|
|
103
|
+
* FHIR reference string for the subject, e.g. "Patient/123".
|
|
104
|
+
* When omitted, a placeholder Patient resource is added to the Bundle and
|
|
105
|
+
* referenced by every Observation.
|
|
106
|
+
*/
|
|
107
|
+
subject?: string;
|
|
108
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported UI languages.
|
|
3
|
+
*
|
|
4
|
+
* | Code | Language |
|
|
5
|
+
* |-------|-----------------------|
|
|
6
|
+
* | hu | Hungarian |
|
|
7
|
+
* | en | English |
|
|
8
|
+
* | de | German |
|
|
9
|
+
* | es | Spanish |
|
|
10
|
+
* | it | Italian |
|
|
11
|
+
* | sk | Slovak |
|
|
12
|
+
* | pl | Polish |
|
|
13
|
+
* | ru | Russian |
|
|
14
|
+
* | pt-br | Portuguese (Brazil) |
|
|
15
|
+
* | zh | Chinese (Simplified) |
|
|
16
|
+
* | ar | Arabic (RTL — UI mirrors, dental/perio charts pinned LTR) |
|
|
17
|
+
*/
|
|
18
|
+
export type Language = "hu" | "en" | "de" | "es" | "it" | "sk" | "pl" | "ru" | "pt-br" | "zh" | "ar";
|
|
19
|
+
/**
|
|
20
|
+
* Master translation table keyed by {@link Language}.
|
|
21
|
+
* Hungarian (`hu`) is the authoritative source — all other languages must
|
|
22
|
+
* contain exactly the same set of keys.
|
|
23
|
+
*
|
|
24
|
+
* Template placeholders use `{{name}}` syntax and are resolved at runtime
|
|
25
|
+
* by the `t()` function in `useI18n.ts`.
|
|
26
|
+
*/
|
|
27
|
+
export declare const translations: Record<Language, Record<string, string>>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type Language } from "./translations";
|
|
2
|
+
/** Parameter map for template placeholders (`{{key}}`). */
|
|
3
|
+
type Params = Record<string, string | number>;
|
|
4
|
+
/**
|
|
5
|
+
* Resolve a translation key to a localised string.
|
|
6
|
+
*
|
|
7
|
+
* @param key - Dot-delimited translation key (e.g. `"app.title"`).
|
|
8
|
+
* @param langOverride - Explicit {@link Language} code **or** a {@link Params} object
|
|
9
|
+
* (when called with two arguments where the second is an object, it is treated as params).
|
|
10
|
+
* @param params - Optional template parameters that replace `{{placeholder}}` tokens.
|
|
11
|
+
* @returns The resolved string, or the key itself if no translation is found.
|
|
12
|
+
*/
|
|
13
|
+
export declare function t(key: string, langOverride?: Language | Params, params?: Params): string;
|
|
14
|
+
/** Get the current global language. */
|
|
15
|
+
export declare function getI18nLanguage(): Language;
|
|
16
|
+
/** Set the global language and notify all listeners. No-op if the language is unchanged. */
|
|
17
|
+
export declare function setI18nLanguage(lang: Language): void;
|
|
18
|
+
/**
|
|
19
|
+
* Subscribe to language changes.
|
|
20
|
+
* @returns An unsubscribe function.
|
|
21
|
+
*/
|
|
22
|
+
export declare function onI18nChange(listener: (lang: Language) => void): () => void;
|
|
23
|
+
type UseI18nOptions = {
|
|
24
|
+
language?: Language;
|
|
25
|
+
onLanguageChange?: (lang: Language) => void;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* React hook for i18n. Supports both **controlled** mode (parent provides
|
|
29
|
+
* `language` prop) and **standalone** mode (internal state).
|
|
30
|
+
*
|
|
31
|
+
* @param options - Optional controlled-mode props.
|
|
32
|
+
* @returns `{ lang, setLang, t }` — current language, setter, and scoped translate function.
|
|
33
|
+
*/
|
|
34
|
+
export declare function useI18n(options?: UseI18nOptions): {
|
|
35
|
+
lang: Language;
|
|
36
|
+
setLang: (next: Language) => void;
|
|
37
|
+
t: (key: string, params?: Params) => string;
|
|
38
|
+
};
|
|
39
|
+
export {};
|
package/dist/index.d.ts
ADDED