vet-data-utils-ts 0.4.2 → 0.4.5

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 CHANGED
@@ -8,6 +8,25 @@ Current surfaces cover the canonical animal-card DID, veterinary summary
8
8
  sections, animal-only emergency data, pseudonymous DigitalTwin search input and
9
9
  veterinary assistant intents.
10
10
 
11
+ ## Active sector extension
12
+
13
+ `vet-data-utils-ts/sectors` extends the frozen CORE catalog without changing
14
+ `gdc-common-utils-ts` or GW CORE. It adds the product-neutral
15
+ `public-safety` value used by explicitly governed portal allowlists. Sector
16
+ selection classifies an organization service; it does not grant membership,
17
+ an occupation, an index role or access to any person or animal.
18
+
19
+ ```ts
20
+ import { ExtendedDataspaceSectors } from 'vet-data-utils-ts/sectors'
21
+
22
+ // The portal chooses its exact subset. Do not expose the complete catalog as
23
+ // an authorization decision or infer capabilities from this selection.
24
+ const allowedSectors = [
25
+ ExtendedDataspaceSectors.PublicSafety,
26
+ ExtendedDataspaceSectors.AnimalCare,
27
+ ] as const
28
+ ```
29
+
11
30
  `vet-data-utils-ts/organization-application` is the product-neutral application
12
31
  value used by UHC UNID, VetChain and SOSChain adapters. The host supplies the
13
32
  allowed sector list and translated labels. The value contains one official
@@ -17,6 +36,13 @@ controller and six independent index participation roles. It rejects a second
17
36
  `taxId` and every PIN field: profile protection happens immediately after
18
37
  login, before any application screen.
19
38
 
39
+ `organizationServiceTypeForParticipationRoles()` projects those explicit
40
+ business roles into the canonical GW `Service.serviceType` capability claim.
41
+ Index and Digital Twin providers receive the corresponding `cruds` capability;
42
+ consumers receive only `rs`. The application continues to retain the six roles
43
+ separately, so this operational projection never erases who provides the index
44
+ service and who merely provides or consumes its data.
45
+
20
46
  The financial surface defines provider-neutral flat claims for FHIR R5
21
47
  `Account`, `Invoice`, `PaymentNotice` and `PaymentReconciliation`. `Account`
22
48
  tracks charges and balances; the responsible party is represented through
package/dist/index.d.ts CHANGED
@@ -5,4 +5,5 @@ export * from './emergency.js';
5
5
  export * from './financial.js';
6
6
  export * from './iso-jurisdictions.js';
7
7
  export * from './organization-application.js';
8
+ export * from './sectors.js';
8
9
  export * from './veterinary-sections.js';
package/dist/index.js CHANGED
@@ -5,4 +5,5 @@ export * from './emergency.js';
5
5
  export * from './financial.js';
6
6
  export * from './iso-jurisdictions.js';
7
7
  export * from './organization-application.js';
8
+ export * from './sectors.js';
8
9
  export * from './veterinary-sections.js';
@@ -33,6 +33,13 @@ export type ReusableOrganizationApplication = Readonly<{
33
33
  }>;
34
34
  participationRoles: readonly OrganizationParticipationRole[];
35
35
  }>;
36
+ /**
37
+ * Converts the six explicit application roles into GW's canonical capability
38
+ * claim. Business roles remain distinct in the application and credential;
39
+ * this projection only grants their corresponding provider or reader runtime
40
+ * operations and removes duplicates.
41
+ */
42
+ export declare function organizationServiceTypeForParticipationRoles(roles: readonly OrganizationParticipationRole[]): string;
36
43
  /**
37
44
  * Validates only reusable organization-application business data.
38
45
  *
@@ -1,4 +1,5 @@
1
1
  import { isIso3166CountryCode, isIso3166SubdivisionForCountry } from './iso-jurisdictions.js';
2
+ import { serializeServiceCapabilityTokens, ServiceCapability, } from 'gdc-common-utils-ts/constants/service-capabilities';
2
3
  export const OrganizationOfficialIdTypes = Object.freeze({
3
4
  Tax: 'TAX',
4
5
  EmployerIdentificationNumber: 'EIN',
@@ -14,6 +15,32 @@ export const OrganizationParticipationRoles = Object.freeze({
14
15
  });
15
16
  const officialIdTypes = new Set(Object.values(OrganizationOfficialIdTypes));
16
17
  const participationRoles = new Set(Object.values(OrganizationParticipationRoles));
18
+ /**
19
+ * Converts the six explicit application roles into GW's canonical capability
20
+ * claim. Business roles remain distinct in the application and credential;
21
+ * this projection only grants their corresponding provider or reader runtime
22
+ * operations and removes duplicates.
23
+ */
24
+ export function organizationServiceTypeForParticipationRoles(roles) {
25
+ const capabilities = roles.map(role => {
26
+ switch (role) {
27
+ case OrganizationParticipationRoles.IndividualIndexServiceProvider:
28
+ case OrganizationParticipationRoles.IndividualIndexDataProvider:
29
+ return ServiceCapability.IndexProvider;
30
+ case OrganizationParticipationRoles.IndividualIndexDataConsumer:
31
+ return ServiceCapability.IndexReader;
32
+ case OrganizationParticipationRoles.DigitalTwinIndexServiceProvider:
33
+ case OrganizationParticipationRoles.DigitalTwinDataProvider:
34
+ return ServiceCapability.DigitalTwinProvider;
35
+ case OrganizationParticipationRoles.DigitalTwinDataConsumer:
36
+ return ServiceCapability.DigitalTwinReader;
37
+ }
38
+ });
39
+ const serviceType = serializeServiceCapabilityTokens(capabilities);
40
+ if (!serviceType)
41
+ throw new TypeError('organization_participation_role_required');
42
+ return serviceType;
43
+ }
17
44
  /**
18
45
  * Validates only reusable organization-application business data.
19
46
  *
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Active product extension of the frozen CORE sector vocabulary.
3
+ *
4
+ * CORE remains unchanged. Public safety is product-neutral and may be selected
5
+ * only by a consuming portal that explicitly includes it in its own allowlist;
6
+ * the value grants no organization role, membership or data capability.
7
+ */
8
+ export declare const ExtendedDataspaceSectors: Readonly<{
9
+ readonly PublicSafety: "public-safety";
10
+ readonly HealthCare: "health-care";
11
+ readonly HealthResearch: "health-research";
12
+ readonly HealthTech: "health-tech";
13
+ readonly HealthInsurance: "health-insurance";
14
+ readonly AnimalCare: "animal-care";
15
+ readonly AnimalResearch: "animal-research";
16
+ readonly AnimalInsurance: "animal-insurance";
17
+ readonly AnimalTech: "animal-tech";
18
+ readonly OneHealthResearch: "onehealth-research";
19
+ readonly OneHealthTech: "onehealth-tech";
20
+ }>;
21
+ export type ExtendedDataspaceSector = typeof ExtendedDataspaceSectors[keyof typeof ExtendedDataspaceSectors];
@@ -0,0 +1,12 @@
1
+ import { DataspaceSectors } from 'gdc-common-utils-ts/constants/sectors';
2
+ /**
3
+ * Active product extension of the frozen CORE sector vocabulary.
4
+ *
5
+ * CORE remains unchanged. Public safety is product-neutral and may be selected
6
+ * only by a consuming portal that explicitly includes it in its own allowlist;
7
+ * the value grants no organization role, membership or data capability.
8
+ */
9
+ export const ExtendedDataspaceSectors = Object.freeze({
10
+ ...DataspaceSectors,
11
+ PublicSafety: 'public-safety',
12
+ });
@@ -4,6 +4,18 @@ export type VeterinarySummarySection = Readonly<{
4
4
  value: `LOINC|${string}`;
5
5
  titleEn: string;
6
6
  }>;
7
+ /**
8
+ * Product-owned display concepts used by high-level veterinary workflows.
9
+ *
10
+ * They deliberately carry no invented terminology-system code. A deployment
11
+ * may add a governed coding later, while claims-first research projection can
12
+ * safely index the non-identifying `Coding.display` value today.
13
+ */
14
+ export declare const VeterinaryClinicalConcepts: Readonly<{
15
+ ClinicalNote: Readonly<{
16
+ display: "Veterinary clinical note";
17
+ }>;
18
+ }>;
7
19
  /** VetChain-owned clinical section catalog. It is not an alias of human IPS. */
8
20
  export declare const VeterinarySummarySections: Readonly<{
9
21
  Problems: Readonly<{
@@ -1,3 +1,13 @@
1
+ /**
2
+ * Product-owned display concepts used by high-level veterinary workflows.
3
+ *
4
+ * They deliberately carry no invented terminology-system code. A deployment
5
+ * may add a governed coding later, while claims-first research projection can
6
+ * safely index the non-identifying `Coding.display` value today.
7
+ */
8
+ export const VeterinaryClinicalConcepts = Object.freeze({
9
+ ClinicalNote: Object.freeze({ display: 'Veterinary clinical note' }),
10
+ });
1
11
  function loinc(code, titleEn) {
2
12
  return Object.freeze({ system: 'http://loinc.org', code, value: `LOINC|${code}`, titleEn });
3
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vet-data-utils-ts",
3
- "version": "0.4.2",
3
+ "version": "0.4.5",
4
4
  "description": "Browser-safe governed VetChain data contracts",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Connecting Solution & Applications Ltd",
@@ -36,6 +36,10 @@
36
36
  "types": "./dist/organization-application.d.ts",
37
37
  "default": "./dist/organization-application.js"
38
38
  },
39
+ "./sectors": {
40
+ "types": "./dist/sectors.d.ts",
41
+ "default": "./dist/sectors.js"
42
+ },
39
43
  "./veterinary-sections": {
40
44
  "types": "./dist/veterinary-sections.d.ts",
41
45
  "default": "./dist/veterinary-sections.js"
@@ -63,6 +67,9 @@
63
67
  "@types/node": "^22.0.0",
64
68
  "typescript": "^5.5.4"
65
69
  },
70
+ "dependencies": {
71
+ "gdc-common-utils-ts": "2.5.21"
72
+ },
66
73
  "engines": {
67
74
  "node": ">=20"
68
75
  }