clinlib
v1.0.0
Published
Korean clinical EMR intake parsers (shared by the clinical artifact apps)
Readme
clinlib
Korean clinical EMR intake parsers shared by the clinical artifact apps (abx-protocol, clinical-flow, chemo, htn, glycemic,
periop, emdrug, tox, fluid, crrt, hd, vent, ecg, surg-safety, ward-rounds). Design: SPEC-SHARED-LIB.md.
lib/ is the source of truth. It is published to npm as clinlib (only lib/); the published artifact pages load it from
jsDelivr and fall back to their own bundled copy if the CDN fails. Local development and tests keep using each app's own lib/.
Files (lib/)
| file | global | role |
|---|---|---|
| labtime.js | LabTime | value date/time ("검사 시점") reading |
| intake_log.js | IntakeLog | intake record log model |
| labsheet.js | LabSheet | EMR lab-list (table) reader |
| facts_catalog.js / facts.js | FactsCatalog / Facts | record-facts layer (diagnoses, events, negation) |
| fileintake.js | FileIntake | Excel / PDF / Word / PPT text extraction in the browser (lazy-loads pdf_cmaps_ko.js next to its own src) |
| fileintake_hwp.js | FileIntake._hwp | HWP reader |
| fileintake_ui.js | FileIntake.mount | file-intake panel UI |
| intake_log_ui.js | IntakeLog.mount | intake card UI |
| feedback.js | FeedbackReport | problem-report window |
| pdf_cmaps_ko.js | FILEINTAKE_CMAPS | Korean PDF CMaps (never a <script> tag) |
Every file ends with a guarded window.CLINLIB_LOADED["<name>"] = true flag (SPEC §4.1); the CDN-fallback check in the
apps' dist pages tests that flag.
Layout
lib/ source files (byte-identical copies live in each app's lib/ as fallback)
tools/sync_fallback.py lib/ -> every app's lib/ (ward-rounds: 4 files); --check reports differences
tools/cdnify.py <app>/dist/index.html: lib <script> tags -> CDN tag + inline local fallback (idempotent, --verify)
tools/build_all.py sync -> each app's tools/build_artifact.py -> cdnify -> report (never publishes)
tools/test_all.sh each app's lib tests (default) or all tests (--all), summary table, exit 1 on new failures
tools/release.sh bump + npm publish + jsDelivr purge + CDN check (--dry-run = no publish/purge)
tests/test_cdnify.py python3 -m unittest discover -s testsVersion policy
Apps pin the major only (clinlib@1). Compatible changes (alias added, bug fix, new key) = patch/minor. A change that needs
app-side code (function signature or output shape) = major; then run cdnify.py <app> --major 2 per app and republish only that app.
Never put changes into the @1 line that would break an old app.
Release (after editing lib/*.js)
tools/release.sh patch(orminor/major): sync fallback copies -> tests ->npm version->npm publish --access public-> jsDelivr purge -> md5 check.npm loginis done by the user (COREPACK_ENABLE_DOWNLOAD_PROMPT=0 /Applications/ChatGPT.app/Contents/Resources/cua_node/bin/corepack npm login). Use--dry-runto rehearse.- No artifact republish is needed: the live pages read
@1from the CDN. The apps' bundled fallback copies are refreshed at the next app publish.
Converting an app's artifact (dist only)
python3 <app>/tools/build_artifact.py && python3 tools/cdnify.py <app> then publish dist/index.html (+ the fallback lib/ copies that differ from live).
The source index.html is never changed (offline development and tests stay deterministic).
