gdc-common-utils-ts 1.0.7 → 1.0.8
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/dist/models/comm.d.ts +1 -1
- package/dist/models/fhir-documents.d.ts +101 -0
- package/dist/models/fhir-documents.js +3 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +2 -0
- package/dist/models/interoperable-claims.d.ts +68 -0
- package/dist/models/interoperable-claims.js +105 -0
- package/package.json +1 -1
package/dist/models/comm.d.ts
CHANGED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal strict-FHIR typing for Composition, DocumentReference, and Communication.
|
|
3
|
+
* These interfaces intentionally cover the subset used by frontend/backend flows today.
|
|
4
|
+
*/
|
|
5
|
+
export type FhirReference = {
|
|
6
|
+
reference?: string;
|
|
7
|
+
type?: string;
|
|
8
|
+
display?: string;
|
|
9
|
+
};
|
|
10
|
+
export type FhirCoding = {
|
|
11
|
+
system?: string;
|
|
12
|
+
code?: string;
|
|
13
|
+
display?: string;
|
|
14
|
+
};
|
|
15
|
+
export type FhirCodeableConcept = {
|
|
16
|
+
coding?: FhirCoding[];
|
|
17
|
+
text?: string;
|
|
18
|
+
};
|
|
19
|
+
export type FhirAttachment = {
|
|
20
|
+
contentType?: string;
|
|
21
|
+
language?: string;
|
|
22
|
+
data?: string;
|
|
23
|
+
url?: string;
|
|
24
|
+
title?: string;
|
|
25
|
+
creation?: string;
|
|
26
|
+
};
|
|
27
|
+
export interface FhirCompositionResource {
|
|
28
|
+
resourceType: 'Composition';
|
|
29
|
+
id?: string;
|
|
30
|
+
status?: string;
|
|
31
|
+
type?: FhirCodeableConcept;
|
|
32
|
+
subject?: FhirReference;
|
|
33
|
+
date?: string;
|
|
34
|
+
author?: FhirReference[];
|
|
35
|
+
title?: string;
|
|
36
|
+
section?: Array<{
|
|
37
|
+
title?: string;
|
|
38
|
+
code?: FhirCodeableConcept;
|
|
39
|
+
text?: {
|
|
40
|
+
status?: string;
|
|
41
|
+
div?: string;
|
|
42
|
+
};
|
|
43
|
+
entry?: FhirReference[];
|
|
44
|
+
}>;
|
|
45
|
+
}
|
|
46
|
+
export interface FhirDocumentReferenceResource {
|
|
47
|
+
resourceType: 'DocumentReference';
|
|
48
|
+
id?: string;
|
|
49
|
+
status?: string;
|
|
50
|
+
identifier?: Array<{
|
|
51
|
+
system?: string;
|
|
52
|
+
value?: string;
|
|
53
|
+
}>;
|
|
54
|
+
type?: FhirCodeableConcept;
|
|
55
|
+
category?: FhirCodeableConcept[];
|
|
56
|
+
subject?: FhirReference;
|
|
57
|
+
date?: string;
|
|
58
|
+
author?: FhirReference[];
|
|
59
|
+
attester?: Array<{
|
|
60
|
+
mode?: string;
|
|
61
|
+
party?: FhirReference;
|
|
62
|
+
time?: string;
|
|
63
|
+
}>;
|
|
64
|
+
description?: string;
|
|
65
|
+
context?: {
|
|
66
|
+
encounter?: FhirReference[];
|
|
67
|
+
event?: FhirCodeableConcept[];
|
|
68
|
+
period?: {
|
|
69
|
+
start?: string;
|
|
70
|
+
end?: string;
|
|
71
|
+
};
|
|
72
|
+
related?: FhirReference[];
|
|
73
|
+
};
|
|
74
|
+
basedOn?: FhirReference[];
|
|
75
|
+
relatesTo?: Array<{
|
|
76
|
+
code?: string;
|
|
77
|
+
target?: FhirReference;
|
|
78
|
+
}>;
|
|
79
|
+
content?: Array<{
|
|
80
|
+
attachment?: FhirAttachment;
|
|
81
|
+
format?: FhirCoding;
|
|
82
|
+
}>;
|
|
83
|
+
}
|
|
84
|
+
export interface FhirCommunicationResource {
|
|
85
|
+
resourceType: 'Communication';
|
|
86
|
+
id?: string;
|
|
87
|
+
status?: string;
|
|
88
|
+
category?: FhirCodeableConcept[];
|
|
89
|
+
subject?: FhirReference;
|
|
90
|
+
recipient?: FhirReference[];
|
|
91
|
+
sender?: FhirReference;
|
|
92
|
+
sent?: string;
|
|
93
|
+
payload?: Array<{
|
|
94
|
+
contentAttachment?: FhirAttachment;
|
|
95
|
+
contentReference?: FhirReference;
|
|
96
|
+
}>;
|
|
97
|
+
partOf?: FhirReference[];
|
|
98
|
+
note?: Array<{
|
|
99
|
+
text?: string;
|
|
100
|
+
}>;
|
|
101
|
+
}
|
package/dist/models/index.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export * from './consent-rule';
|
|
|
11
11
|
export * from './crypto';
|
|
12
12
|
export * from './device-license';
|
|
13
13
|
export * from './did';
|
|
14
|
+
export * from './fhir-documents';
|
|
15
|
+
export * from './interoperable-claims';
|
|
14
16
|
export * from './indexing';
|
|
15
17
|
export * from './issue';
|
|
16
18
|
export * from './jsonapi';
|
package/dist/models/index.js
CHANGED
|
@@ -11,6 +11,8 @@ export * from './consent-rule.js';
|
|
|
11
11
|
export * from './crypto.js';
|
|
12
12
|
export * from './device-license.js';
|
|
13
13
|
export * from './did.js';
|
|
14
|
+
export * from './fhir-documents.js';
|
|
15
|
+
export * from './interoperable-claims.js';
|
|
14
16
|
export * from './indexing.js';
|
|
15
17
|
export * from './issue.js';
|
|
16
18
|
export * from './jsonapi.js';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical interoperable-claims keys used by claims-first payloads.
|
|
3
|
+
* Keep this separated from strict FHIR resource typings.
|
|
4
|
+
*/
|
|
5
|
+
export type ClaimSpec = {
|
|
6
|
+
key: string;
|
|
7
|
+
meaning: string;
|
|
8
|
+
example: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const CompositionClaim: {
|
|
11
|
+
readonly Subject: "Composition.subject";
|
|
12
|
+
readonly Section: "Composition.section";
|
|
13
|
+
readonly Author: "Composition.author";
|
|
14
|
+
readonly Date: "Composition.date";
|
|
15
|
+
readonly Entry: "Composition.entry";
|
|
16
|
+
readonly Type: "Composition.type";
|
|
17
|
+
readonly Identifier: "Composition.identifier";
|
|
18
|
+
readonly Title: "Composition.title";
|
|
19
|
+
};
|
|
20
|
+
export declare const DocumentReferenceClaim: {
|
|
21
|
+
readonly Attester: "DocumentReference.attester";
|
|
22
|
+
readonly Author: "DocumentReference.author";
|
|
23
|
+
readonly BasedOn: "DocumentReference.basedOn";
|
|
24
|
+
readonly Category: "DocumentReference.category";
|
|
25
|
+
readonly ContentData: "DocumentReference.contentdata";
|
|
26
|
+
readonly ContentType: "DocumentReference.contenttype";
|
|
27
|
+
readonly Context: "DocumentReference.context";
|
|
28
|
+
readonly Creation: "DocumentReference.creation";
|
|
29
|
+
readonly Date: "DocumentReference.date";
|
|
30
|
+
readonly Description: "DocumentReference.description";
|
|
31
|
+
readonly EventCode: "DocumentReference.event-code";
|
|
32
|
+
readonly EventReference: "DocumentReference.event-reference";
|
|
33
|
+
readonly FormatUri: "DocumentReference.format-uri";
|
|
34
|
+
readonly Identifier: "DocumentReference.identifier";
|
|
35
|
+
readonly Language: "DocumentReference.language";
|
|
36
|
+
readonly Location: "DocumentReference.location";
|
|
37
|
+
readonly Modality: "DocumentReference.modality";
|
|
38
|
+
readonly RelatesTo: "DocumentReference.relatesto";
|
|
39
|
+
readonly Relation: "DocumentReference.relation";
|
|
40
|
+
readonly Subject: "DocumentReference.subject";
|
|
41
|
+
readonly Type: "DocumentReference.type";
|
|
42
|
+
};
|
|
43
|
+
export declare const CommunicationClaim: {
|
|
44
|
+
readonly Identifier: "Communication.identifier";
|
|
45
|
+
readonly Subject: "Communication.subject";
|
|
46
|
+
readonly Recipient: "Communication.recipient";
|
|
47
|
+
readonly Sender: "Communication.sender";
|
|
48
|
+
readonly Sent: "Communication.sent";
|
|
49
|
+
readonly Text: "Communication.text";
|
|
50
|
+
readonly ContentReference: "Communication.content-reference";
|
|
51
|
+
readonly ContentAttachmentData: "Communication.content-attachment-data";
|
|
52
|
+
readonly ContentAttachmentType: "Communication.content-attachment-type";
|
|
53
|
+
readonly ContentAttachmentTitle: "Communication.content-attachment-title";
|
|
54
|
+
readonly PartOf: "Communication.partOf";
|
|
55
|
+
};
|
|
56
|
+
export type CompositionClaimKey = typeof CompositionClaim[keyof typeof CompositionClaim];
|
|
57
|
+
export type DocumentReferenceClaimKey = typeof DocumentReferenceClaim[keyof typeof DocumentReferenceClaim];
|
|
58
|
+
export type CommunicationClaimKey = typeof CommunicationClaim[keyof typeof CommunicationClaim];
|
|
59
|
+
/**
|
|
60
|
+
* Human-readable reference for UI/docs generators.
|
|
61
|
+
* This is intentionally claims-first metadata and not a FHIR structure.
|
|
62
|
+
*/
|
|
63
|
+
export declare const DocumentReferenceClaimSpecs: ClaimSpec[];
|
|
64
|
+
/**
|
|
65
|
+
* Optional mapping helper when converting claims-first payloads to strict FHIR JSON.
|
|
66
|
+
* Not used as canonical claim naming.
|
|
67
|
+
*/
|
|
68
|
+
export declare const DocumentReferenceClaimToFhirPath: Record<string, string | string[]>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// Copyright 2026 Conéctate Soluciones y Aplicaciones SL under the Apache License, Version 2.0.
|
|
2
|
+
// File: src/models/interoperable-claims.ts
|
|
3
|
+
export const CompositionClaim = {
|
|
4
|
+
Subject: 'Composition.subject',
|
|
5
|
+
Section: 'Composition.section',
|
|
6
|
+
Author: 'Composition.author',
|
|
7
|
+
Date: 'Composition.date',
|
|
8
|
+
Entry: 'Composition.entry',
|
|
9
|
+
Type: 'Composition.type',
|
|
10
|
+
Identifier: 'Composition.identifier',
|
|
11
|
+
Title: 'Composition.title',
|
|
12
|
+
};
|
|
13
|
+
export const DocumentReferenceClaim = {
|
|
14
|
+
Attester: 'DocumentReference.attester',
|
|
15
|
+
Author: 'DocumentReference.author',
|
|
16
|
+
BasedOn: 'DocumentReference.basedOn',
|
|
17
|
+
Category: 'DocumentReference.category',
|
|
18
|
+
ContentData: 'DocumentReference.contentdata',
|
|
19
|
+
ContentType: 'DocumentReference.contenttype',
|
|
20
|
+
Context: 'DocumentReference.context',
|
|
21
|
+
Creation: 'DocumentReference.creation',
|
|
22
|
+
Date: 'DocumentReference.date',
|
|
23
|
+
Description: 'DocumentReference.description',
|
|
24
|
+
EventCode: 'DocumentReference.event-code',
|
|
25
|
+
EventReference: 'DocumentReference.event-reference',
|
|
26
|
+
FormatUri: 'DocumentReference.format-uri',
|
|
27
|
+
Identifier: 'DocumentReference.identifier',
|
|
28
|
+
Language: 'DocumentReference.language',
|
|
29
|
+
Location: 'DocumentReference.location',
|
|
30
|
+
Modality: 'DocumentReference.modality',
|
|
31
|
+
RelatesTo: 'DocumentReference.relatesto',
|
|
32
|
+
Relation: 'DocumentReference.relation',
|
|
33
|
+
Subject: 'DocumentReference.subject',
|
|
34
|
+
Type: 'DocumentReference.type',
|
|
35
|
+
};
|
|
36
|
+
export const CommunicationClaim = {
|
|
37
|
+
Identifier: 'Communication.identifier',
|
|
38
|
+
Subject: 'Communication.subject',
|
|
39
|
+
Recipient: 'Communication.recipient',
|
|
40
|
+
Sender: 'Communication.sender',
|
|
41
|
+
Sent: 'Communication.sent',
|
|
42
|
+
Text: 'Communication.text',
|
|
43
|
+
ContentReference: 'Communication.content-reference',
|
|
44
|
+
ContentAttachmentData: 'Communication.content-attachment-data',
|
|
45
|
+
ContentAttachmentType: 'Communication.content-attachment-type',
|
|
46
|
+
ContentAttachmentTitle: 'Communication.content-attachment-title',
|
|
47
|
+
PartOf: 'Communication.partOf',
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Human-readable reference for UI/docs generators.
|
|
51
|
+
* This is intentionally claims-first metadata and not a FHIR structure.
|
|
52
|
+
*/
|
|
53
|
+
export const DocumentReferenceClaimSpecs = [
|
|
54
|
+
{ key: DocumentReferenceClaim.Attester, meaning: 'Attester value (DID or role: personal | professional | legal | official).', example: 'did:web:hospital.example.com:employee:adm-332' },
|
|
55
|
+
{ key: DocumentReferenceClaim.Author, meaning: 'DID of the source author.', example: 'did:web:lab.example.com:system:lisin' },
|
|
56
|
+
{ key: DocumentReferenceClaim.BasedOn, meaning: 'URL of the source FHIR resource.', example: 'https://ehr.example.com/fhir/ServiceRequest/sr-991' },
|
|
57
|
+
{ key: DocumentReferenceClaim.Category, meaning: 'Higher-level document grouping.', example: 'http://hl7.org/fhir/ValueSet/document-classcodes|LP173418-7' },
|
|
58
|
+
{ key: DocumentReferenceClaim.ContentData, meaning: 'Embedded attachment as base64.', example: 'JVBERi0xLjc...' },
|
|
59
|
+
{ key: DocumentReferenceClaim.ContentType, meaning: 'Attachment MIME type.', example: 'application/pdf' },
|
|
60
|
+
{ key: DocumentReferenceClaim.Context, meaning: 'Context such as Appointment | Encounter | EpisodeOfCare.', example: 'Encounter/enc-123' },
|
|
61
|
+
{ key: DocumentReferenceClaim.Creation, meaning: 'When source information was created.', example: '2026-02-10T08:20:00Z' },
|
|
62
|
+
{ key: DocumentReferenceClaim.Date, meaning: 'When this registration was attested.', example: '2026-02-10T10:05:33Z' },
|
|
63
|
+
{ key: DocumentReferenceClaim.Description, meaning: 'Human-readable summary.', example: 'Vital signs report from home device' },
|
|
64
|
+
{ key: DocumentReferenceClaim.EventCode, meaning: 'Main code for the source FHIR resource.', example: 'http://loinc.org|85354-9' },
|
|
65
|
+
{ key: DocumentReferenceClaim.EventReference, meaning: 'URL of the source FHIR resource.', example: 'https://ehr.example.com/fhir/Observation/obs-778' },
|
|
66
|
+
{ key: DocumentReferenceClaim.FormatUri, meaning: 'Attachment format URI.', example: 'urn:ihe:dent:PDF' },
|
|
67
|
+
{ key: DocumentReferenceClaim.Identifier, meaning: 'Document identifier used for correlation.', example: 'docref-2026-00042' },
|
|
68
|
+
{ key: DocumentReferenceClaim.Language, meaning: 'Language of attachment content.', example: 'en' },
|
|
69
|
+
{ key: DocumentReferenceClaim.Location, meaning: 'Remote URL of attachment.', example: 'https://ehr.example.com/fhir/Binary/bin-123' },
|
|
70
|
+
{ key: DocumentReferenceClaim.Modality, meaning: 'Imaging modality/equipment function.', example: 'http://dicom.nema.org/resources/ontology/DCM|CT' },
|
|
71
|
+
{ key: DocumentReferenceClaim.RelatesTo, meaning: 'Reference to related/prior document.', example: 'DocumentReference/docref-00041' },
|
|
72
|
+
{ key: DocumentReferenceClaim.Relation, meaning: 'Relation type to related document.', example: 'appends' },
|
|
73
|
+
{ key: DocumentReferenceClaim.Subject, meaning: 'URN for the section in the individual index.', example: 'urn:uhix:section:vitals' },
|
|
74
|
+
{ key: DocumentReferenceClaim.Type, meaning: 'Lower-level, sector-specific type.', example: 'http://hl7.org/fhir/ValueSet/c80-doc-typecodes|34133-9' },
|
|
75
|
+
];
|
|
76
|
+
/**
|
|
77
|
+
* Optional mapping helper when converting claims-first payloads to strict FHIR JSON.
|
|
78
|
+
* Not used as canonical claim naming.
|
|
79
|
+
*/
|
|
80
|
+
export const DocumentReferenceClaimToFhirPath = {
|
|
81
|
+
[DocumentReferenceClaim.Attester]: [
|
|
82
|
+
'DocumentReference.attester.party.reference',
|
|
83
|
+
'DocumentReference.attester.mode',
|
|
84
|
+
],
|
|
85
|
+
[DocumentReferenceClaim.Author]: 'DocumentReference.author.reference',
|
|
86
|
+
[DocumentReferenceClaim.BasedOn]: 'DocumentReference.basedOn.reference',
|
|
87
|
+
[DocumentReferenceClaim.Category]: 'DocumentReference.category.coding',
|
|
88
|
+
[DocumentReferenceClaim.ContentData]: 'DocumentReference.content.attachment.data',
|
|
89
|
+
[DocumentReferenceClaim.ContentType]: 'DocumentReference.content.attachment.contentType',
|
|
90
|
+
[DocumentReferenceClaim.Context]: 'DocumentReference.context',
|
|
91
|
+
[DocumentReferenceClaim.Creation]: 'DocumentReference.content.attachment.creation',
|
|
92
|
+
[DocumentReferenceClaim.Date]: 'DocumentReference.date',
|
|
93
|
+
[DocumentReferenceClaim.Description]: 'DocumentReference.description',
|
|
94
|
+
[DocumentReferenceClaim.EventCode]: 'DocumentReference.context.event.coding',
|
|
95
|
+
[DocumentReferenceClaim.EventReference]: 'DocumentReference.context.related.reference',
|
|
96
|
+
[DocumentReferenceClaim.FormatUri]: 'DocumentReference.content.format.code',
|
|
97
|
+
[DocumentReferenceClaim.Identifier]: 'DocumentReference.identifier.value',
|
|
98
|
+
[DocumentReferenceClaim.Language]: 'DocumentReference.content.attachment.language',
|
|
99
|
+
[DocumentReferenceClaim.Location]: 'DocumentReference.content.attachment.url',
|
|
100
|
+
[DocumentReferenceClaim.Modality]: 'DocumentReference.modality',
|
|
101
|
+
[DocumentReferenceClaim.RelatesTo]: 'DocumentReference.relatesTo.target.reference',
|
|
102
|
+
[DocumentReferenceClaim.Relation]: 'DocumentReference.relatesTo.code',
|
|
103
|
+
[DocumentReferenceClaim.Subject]: 'DocumentReference.subject.reference',
|
|
104
|
+
[DocumentReferenceClaim.Type]: 'DocumentReference.type.coding',
|
|
105
|
+
};
|