Generic toolkit for server and web applications — Health Data Safe.
Full documentation: healthdatasafe.github.io/hds-lib-js
- HDS Data Model — Load and query the HDS data model: items, streams, authorizations, event types, datasources
- App Templates — Consent-based data collection and sharing (Manager, Collector, Invite, Client flows). Includes the AppTemplate JSON loader and custom-field declarations (template-private streams via
clientData.hdsCustomField). Seets/appTemplates/CUSTOM-FIELDS-AND-SYSTEM.mdfor the design reference. (System messaging now flows through the CMC per-collector channel — seeopen-pryv.io/components/cmc/IMPLEMENTERS-GUIDE.md.) - HDSSettings — Per-app user settings (locale, theme, timezone, date format, unit system)
- HDSProfile — Account-level profile (display name, avatar, date of birth, sex, country)
- Pryv extensions — Extends Pryv JS lib with Socket.io and Monitor support
- Toolkit — Stream auto-creation, reminders, duration parsing, event formatting (
eventToShortTexthandles{drug}/{regimen}/{procedure}payload shapes uniformly, with optional×count, procedure findings, and truncated notes)
import HDSLib from 'hds-lib';
HDSLib.settings.setServiceInfoURL('https://demo.datasafe.dev/reg/service/info');
await HDSLib.initHDSModel();
const model = HDSLib.getHDSModel();
const weight = model.itemsDefs.forKey('body-weight');
// Resolve the itemDef for an event — walks parent streams for context-via-substream cases
// (e.g. event on `treatment-fertility` resolves to `treatment-coded` registered at `treatment`).
const itemDef = model.itemsDefs.forEvent(event);Requires Node.js >= 24. Source code is TypeScript in ./ts/ — tests run directly from source (Node 24 type stripping).
npm test # Run tests (from ts/ source, no build needed)
npm run build # Webpack bundle (dist/)
npm run lint # ESLint
npm run test:coverage # Coverage reporttsc is only used by the prepare script for npm/git-dep consumers.
Browser test suite: build then run npx backloop.dev ./dist and open https://l.backloop.dev:4443/tests.html