@andes/fhir 1.13.0-beta.10 → 1.13.0-beta.11

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.
@@ -19,6 +19,18 @@ export declare function encode(patientReference: any, alergiaIntolerancia: any):
19
19
  meta: {
20
20
  profile: string[];
21
21
  };
22
+ clinicalStatus: {
23
+ coding: {
24
+ system: string;
25
+ code: string;
26
+ }[];
27
+ };
28
+ verificationStatus: {
29
+ coding: {
30
+ system: string;
31
+ code: string;
32
+ }[];
33
+ };
22
34
  text: {
23
35
  status: string;
24
36
  div: string;
@@ -25,7 +25,23 @@ function encode(patientReference, alergiaIntolerancia) {
25
25
  ]
26
26
  },
27
27
  meta: {
28
- profile: ['http://hl7.org/fhir/uv/ips/StructureDefinition/allergyintolerance-uv-ips']
28
+ profile: ['http://hl7.org/fhir/uv/ips/StructureDefinition/AllergyIntolerance-uv-ips']
29
+ },
30
+ clinicalStatus: {
31
+ coding: [
32
+ {
33
+ system: 'http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical',
34
+ code: 'active'
35
+ }
36
+ ]
37
+ },
38
+ verificationStatus: {
39
+ coding: [
40
+ {
41
+ system: 'http://terminology.hl7.org/CodeSystem/allergyintolerance-verification',
42
+ code: 'confirmed'
43
+ }
44
+ ]
29
45
  },
30
46
  text: {
31
47
  status: 'generated',
@@ -4,9 +4,9 @@ export declare function encode(ID: any, resources: any): {
4
4
  meta: {
5
5
  lastUpdated: string;
6
6
  };
7
- language: string;
8
7
  entry: any;
9
8
  type: string;
9
+ timestamp: string;
10
10
  identifier: {
11
11
  system: string;
12
12
  value: any;
@@ -3,15 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.encode = encode;
4
4
  const config_1 = require("./config");
5
5
  function encode(ID, resources) {
6
+ const now = new Date().toISOString();
6
7
  return {
7
8
  resourceType: 'Bundle',
8
9
  id: ID,
9
10
  meta: {
10
- lastUpdated: new Date().toISOString()
11
+ lastUpdated: now
11
12
  },
12
- language: 'es-AR',
13
13
  entry: resources,
14
14
  type: 'document',
15
+ timestamp: now,
15
16
  identifier: {
16
17
  system: (0, config_1.makeUrl)('Bundle'),
17
18
  value: ID
@@ -6,16 +6,12 @@ export declare function encode(ID: any, patientReference: any, custodianReferenc
6
6
  section: any[];
7
7
  resourceType: string;
8
8
  author: {
9
- identifier: {
10
- system: string;
11
- value: any;
12
- };
9
+ reference: any;
13
10
  }[];
14
11
  confidentiality: string;
15
12
  type: {
16
13
  coding: {
17
14
  system: string;
18
- display: string;
19
15
  code: string;
20
16
  }[];
21
17
  };
@@ -25,15 +21,15 @@ export declare function encode(ID: any, patientReference: any, custodianReferenc
25
21
  value: any;
26
22
  };
27
23
  date: string;
24
+ meta: {
25
+ profile: string[];
26
+ };
28
27
  text: {
29
28
  status: string;
30
29
  div: string;
31
30
  };
32
31
  custodian: {
33
- identifier: {
34
- system: string;
35
- value: any;
36
- };
32
+ reference: any;
37
33
  };
38
34
  attester: {
39
35
  mode: string;
@@ -15,74 +15,182 @@ function encode(ID, patientReference, custodianReference, deviceReference, medic
15
15
  let conditions = [];
16
16
  let medications = [];
17
17
  let allergyIntolerance = [];
18
- Immunization = [{
19
- title: 'Vacunas',
20
- text: {
21
- status: 'generated',
22
- div: '<div xmlns="http://www.w3.org/1999/xhtml">Sección referida a la vacunación del paciente </div>'
23
- },
24
- code: {
25
- coding: [
26
- {
27
- system: 'http://loinc.org',
28
- display: 'Immunization record',
29
- code: '60484-3'
30
- }
31
- ]
32
- },
33
- entry: ImmunizationReferences ? ImmunizationReferences.map(getReference) : []
34
- }];
35
- medications = [{
36
- title: 'Medicamentos',
37
- text: {
38
- status: 'generated',
39
- div: '<div xmlns="http://www.w3.org/1999/xhtml">Registro de medicamentos</div>'
40
- },
41
- code: {
42
- coding: [
43
- {
44
- system: 'http://loinc.org',
45
- display: 'Medication use',
46
- code: '10160-0'
47
- }
48
- ]
49
- },
50
- entry: medicationStatementReference ? medicationStatementReference.map(getReference) : [],
51
- }];
52
- allergyIntolerance = [{
53
- title: 'Alergias o Intolerancias',
54
- text: {
55
- status: 'generated',
56
- div: '<div xmlns="http://www.w3.org/1999/xhtml">Registro de Alergias</div>'
57
- },
58
- code: {
59
- coding: [
60
- {
61
- system: 'http://loinc.org',
62
- display: 'Allergies and/or adverse reactions',
63
- code: '48765-2'
64
- }
65
- ]
66
- },
67
- entry: AllergyIntoleranceReferences ? AllergyIntoleranceReferences.map(getReference) : [],
68
- }];
69
- conditions = [{
70
- code: {
71
- coding: [
72
- {
73
- system: 'http://loinc.org',
74
- display: 'Problem list',
75
- code: '11450-4'
76
- }
77
- ]
78
- },
79
- entry: ConditionReferences ? ConditionReferences.map(getReference) : [],
80
- title: 'Problemas activos',
81
- text: {
82
- status: 'generated',
83
- div: '<div xmlns="http://www.w3.org/1999/xhtml">Lista de problemas activos (trastornos)</div>'
84
- }
85
- }];
18
+ if (ImmunizationReferences && ImmunizationReferences.length > 0) {
19
+ Immunization = [{
20
+ title: 'Vacunas',
21
+ text: {
22
+ status: 'generated',
23
+ div: '<div xmlns="http://www.w3.org/1999/xhtml">Sección referida a la vacunación del paciente </div>'
24
+ },
25
+ code: {
26
+ coding: [
27
+ {
28
+ system: 'http://loinc.org',
29
+ code: '60484-3'
30
+ }
31
+ ]
32
+ },
33
+ entry: ImmunizationReferences.map(getReference)
34
+ }];
35
+ }
36
+ else {
37
+ Immunization = [{
38
+ title: 'Vacunas',
39
+ text: {
40
+ status: 'generated',
41
+ div: '<div xmlns="http://www.w3.org/1999/xhtml">No hay vacunas registradas</div>'
42
+ },
43
+ code: {
44
+ coding: [
45
+ {
46
+ system: 'http://loinc.org',
47
+ code: '60484-3'
48
+ }
49
+ ]
50
+ },
51
+ emptyReason: {
52
+ coding: [
53
+ {
54
+ system: 'http://terminology.hl7.org/CodeSystem/list-empty-reason',
55
+ code: 'nilknown',
56
+ display: 'Nil Known'
57
+ }
58
+ ]
59
+ }
60
+ }];
61
+ }
62
+ if (medicationStatementReference && medicationStatementReference.length > 0) {
63
+ medications = [{
64
+ title: 'Medicamentos',
65
+ text: {
66
+ status: 'generated',
67
+ div: '<div xmlns="http://www.w3.org/1999/xhtml">Registro de medicamentos</div>'
68
+ },
69
+ code: {
70
+ coding: [
71
+ {
72
+ system: 'http://loinc.org',
73
+ code: '10160-0'
74
+ }
75
+ ]
76
+ },
77
+ entry: medicationStatementReference.map(getReference)
78
+ }];
79
+ }
80
+ else {
81
+ medications = [{
82
+ title: 'Medicamentos',
83
+ text: {
84
+ status: 'generated',
85
+ div: '<div xmlns="http://www.w3.org/1999/xhtml">No hay medicamentos registrados</div>'
86
+ },
87
+ code: {
88
+ coding: [
89
+ {
90
+ system: 'http://loinc.org',
91
+ code: '10160-0'
92
+ }
93
+ ]
94
+ },
95
+ emptyReason: {
96
+ coding: [
97
+ {
98
+ system: 'http://terminology.hl7.org/CodeSystem/list-empty-reason',
99
+ code: 'nilknown',
100
+ display: 'Nil Known'
101
+ }
102
+ ]
103
+ }
104
+ }];
105
+ }
106
+ if (AllergyIntoleranceReferences && AllergyIntoleranceReferences.length > 0) {
107
+ allergyIntolerance = [{
108
+ title: 'Alergias o Intolerancias',
109
+ text: {
110
+ status: 'generated',
111
+ div: '<div xmlns="http://www.w3.org/1999/xhtml">Registro de Alergias</div>'
112
+ },
113
+ code: {
114
+ coding: [
115
+ {
116
+ system: 'http://loinc.org',
117
+ code: '48765-2'
118
+ }
119
+ ]
120
+ },
121
+ entry: AllergyIntoleranceReferences.map(getReference)
122
+ }];
123
+ }
124
+ else {
125
+ allergyIntolerance = [{
126
+ title: 'Alergias o Intolerancias',
127
+ text: {
128
+ status: 'generated',
129
+ div: '<div xmlns="http://www.w3.org/1999/xhtml">No hay registro de alergias</div>'
130
+ },
131
+ code: {
132
+ coding: [
133
+ {
134
+ system: 'http://loinc.org',
135
+ code: '48765-2'
136
+ }
137
+ ]
138
+ },
139
+ emptyReason: {
140
+ coding: [
141
+ {
142
+ system: 'http://terminology.hl7.org/CodeSystem/list-empty-reason',
143
+ code: 'nilknown',
144
+ display: 'Nil Known'
145
+ }
146
+ ]
147
+ }
148
+ }];
149
+ }
150
+ if (ConditionReferences && ConditionReferences.length > 0) {
151
+ conditions = [{
152
+ code: {
153
+ coding: [
154
+ {
155
+ system: 'http://loinc.org',
156
+ code: '11450-4'
157
+ }
158
+ ]
159
+ },
160
+ entry: ConditionReferences.map(getReference),
161
+ title: 'Problemas activos',
162
+ text: {
163
+ status: 'generated',
164
+ div: '<div xmlns="http://www.w3.org/1999/xhtml">Lista de problemas activos (trastornos)</div>'
165
+ }
166
+ }];
167
+ }
168
+ else {
169
+ conditions = [{
170
+ code: {
171
+ coding: [
172
+ {
173
+ system: 'http://loinc.org',
174
+ code: '11450-4'
175
+ }
176
+ ]
177
+ },
178
+ title: 'Problemas activos',
179
+ text: {
180
+ status: 'generated',
181
+ div: '<div xmlns="http://www.w3.org/1999/xhtml">No hay problemas activos registrados</div>'
182
+ },
183
+ emptyReason: {
184
+ coding: [
185
+ {
186
+ system: 'http://terminology.hl7.org/CodeSystem/list-empty-reason',
187
+ code: 'nilknown',
188
+ display: 'Nil Known'
189
+ }
190
+ ]
191
+ }
192
+ }];
193
+ }
86
194
  return {
87
195
  id: ID,
88
196
  subject: {
@@ -97,10 +205,7 @@ function encode(ID, patientReference, custodianReference, deviceReference, medic
97
205
  resourceType: 'Composition',
98
206
  author: [
99
207
  {
100
- identifier: {
101
- system: 'https://federador.msal.gob.ar/uri',
102
- value: deviceReference
103
- }
208
+ reference: deviceReference
104
209
  }
105
210
  ],
106
211
  confidentiality: 'N',
@@ -108,7 +213,6 @@ function encode(ID, patientReference, custodianReference, deviceReference, medic
108
213
  coding: [
109
214
  {
110
215
  system: 'http://loinc.org',
111
- display: 'Patient Summary',
112
216
  code: '60591-5'
113
217
  }
114
218
  ]
@@ -119,20 +223,17 @@ function encode(ID, patientReference, custodianReference, deviceReference, medic
119
223
  value: ID
120
224
  },
121
225
  date: nowIso,
122
- // meta: {
123
- // profile: [
124
- // 'http:\/\/hl7.org\/fhir\/uv\/ips\/StructureDefinition\/composition-uv-ips'
125
- // ]
126
- // },
226
+ meta: {
227
+ profile: [
228
+ 'http://hl7.org/fhir/uv/ips/StructureDefinition/Composition-uv-ips'
229
+ ]
230
+ },
127
231
  text: {
128
232
  status: 'generated',
129
233
  div: '<div xmlns="http://www.w3.org/1999/xhtml">IPS Neuquen</div>'
130
234
  },
131
235
  custodian: {
132
- identifier: {
133
- system: 'https://federador.msal.gob.ar/uri',
134
- value: custodianReference
135
- }
236
+ reference: custodianReference
136
237
  },
137
238
  attester: [
138
239
  {
@@ -2,52 +2,4 @@
2
2
  *
3
3
  * @param registro Registro RUP a transformar a FHIR
4
4
  */
5
- export declare function encode(patientReference: any, registro: any): {
6
- id: any;
7
- category: {
8
- coding: {
9
- system: string;
10
- display: string;
11
- code: string;
12
- }[];
13
- }[];
14
- subject: {
15
- reference: any;
16
- };
17
- onsetDateTime: any;
18
- resourceType: string;
19
- verificationStatus: {
20
- coding: {
21
- system: string;
22
- code: string;
23
- }[];
24
- };
25
- code: {
26
- coding: {
27
- code: any;
28
- system: string;
29
- display: any;
30
- }[];
31
- };
32
- recordedDate: any;
33
- meta: {
34
- profile: string[];
35
- };
36
- text: {
37
- status: string;
38
- div: string;
39
- };
40
- severity: {
41
- coding: {
42
- system: string;
43
- display: string;
44
- code: string;
45
- }[];
46
- };
47
- clinicalStatus: {
48
- coding: {
49
- system: string;
50
- code: any;
51
- }[];
52
- };
53
- };
5
+ export declare function encode(patientReference: any, registro: any): any;
@@ -6,14 +6,32 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.encode = encode;
8
8
  function encode(patientReference, registro) {
9
- return {
9
+ const estado = registro.valor?.estado;
10
+ let clinicalStatusCode = 'active';
11
+ if (estado === 'inactivo' || estado === 'inactive') {
12
+ clinicalStatusCode = 'inactive';
13
+ }
14
+ else if (estado === 'resuelto' || estado === 'resolved') {
15
+ clinicalStatusCode = 'resolved';
16
+ }
17
+ const condition = {
18
+ resourceType: 'Condition',
10
19
  id: registro._id,
20
+ meta: {
21
+ profile: [
22
+ 'http://hl7.org/fhir/uv/ips/StructureDefinition/Condition-uv-ips'
23
+ ]
24
+ },
11
25
  category: [
12
26
  {
13
27
  coding: [
28
+ {
29
+ system: 'http://terminology.hl7.org/CodeSystem/condition-category',
30
+ code: 'problem-list-item',
31
+ display: 'Problem List Item'
32
+ },
14
33
  {
15
34
  system: 'http://loinc.org',
16
- display: 'Problem',
17
35
  code: '75326-9'
18
36
  }
19
37
  ]
@@ -22,57 +40,44 @@ function encode(patientReference, registro) {
22
40
  subject: {
23
41
  reference: patientReference
24
42
  },
25
- onsetDateTime: registro.createdAt.getFullYear(), // [TODO] No va solo el año
26
- resourceType: 'Condition',
27
- // Por el momento ponemos 'confirmed'
43
+ onsetDateTime: registro.createdAt ? new Date(registro.createdAt).toISOString() : new Date().toISOString(),
28
44
  verificationStatus: {
29
45
  coding: [
30
46
  {
31
- system: 'http://terminology.hl7.org//CodeSystem//condition-ver-status',
47
+ system: 'http://terminology.hl7.org/CodeSystem/condition-ver-status',
32
48
  code: 'confirmed'
33
49
  }
34
50
  ]
35
51
  },
36
- code: {
52
+ clinicalStatus: {
37
53
  coding: [
38
54
  {
39
- code: registro.concepto.conceptId,
40
- system: 'http://snomed.info/sct',
41
- display: registro.concepto.fsn
55
+ system: 'http://terminology.hl7.org/CodeSystem/condition-clinical',
56
+ code: clinicalStatusCode
42
57
  }
43
58
  ]
44
59
  },
45
- recordedDate: registro.createdAt,
46
- meta: {
47
- profile: [
48
- 'http://hl7.org/fhir/uv/ips/StructureDefinition/condition-uv-ips'
49
- ]
50
- },
51
- text: {
52
- status: 'generated',
53
- div: `<div xmlns="http://www.w3.org/1999/xhtml"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: Problema: </p><p>${registro.nombre}</p></div>`
54
- },
55
- severity: {
60
+ code: {
56
61
  coding: [
57
62
  {
58
- system: 'http://loinc.org',
59
- display: 'Moderate',
60
- code: 'LA6751-7'
63
+ system: 'http://snomed.info/sct',
64
+ code: String(registro.concepto.conceptId)
61
65
  }
62
- ]
66
+ ],
67
+ text: registro.concepto.term || registro.concepto.fsn
63
68
  },
64
- clinicalStatus: {
65
- coding: [
66
- {
67
- system: 'http://terminology.hl7.org/CodeSystem/condition-clinical',
68
- code: registro.valor.estado // [TODO] Tenemos este dato.
69
- },
70
- {
71
- system: 'http://terminology.hl7.org/CodeSystem/evolution',
72
- // code: registro.valor.evolucion.replace('<p>','').replace('</p>','') // [TODO] Tenemos este dato.
73
- code: registro.valor.evolucion // [TODO] Tenemos este dato.
74
- }
75
- ]
69
+ recordedDate: registro.createdAt ? new Date(registro.createdAt).toISOString() : undefined,
70
+ text: {
71
+ status: 'generated',
72
+ div: `<div xmlns="http://www.w3.org/1999/xhtml"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: Problema: </p><p>${registro.nombre || registro.concepto?.term || ''}</p></div>`
76
73
  }
77
74
  };
75
+ if (registro.valor?.evolucion) {
76
+ condition.note = [
77
+ {
78
+ text: String(registro.valor.evolucion)
79
+ }
80
+ ];
81
+ }
82
+ return condition;
78
83
  }
@@ -1,6 +1,10 @@
1
1
  export declare function encode(): {
2
2
  resourceType: string;
3
3
  id: string;
4
+ text: {
5
+ status: string;
6
+ div: string;
7
+ };
4
8
  identifier: {
5
9
  system: string;
6
10
  value: string;
@@ -9,8 +13,8 @@ export declare function encode(): {
9
13
  coding: {
10
14
  system: string;
11
15
  code: string;
12
- display: string;
13
16
  }[];
17
+ text: string;
14
18
  };
15
19
  owner: {
16
20
  reference: string;
@@ -9,6 +9,10 @@ function encode() {
9
9
  return {
10
10
  resourceType: 'Device',
11
11
  id: 'device-01',
12
+ text: {
13
+ status: 'generated',
14
+ div: '<div xmlns="http://www.w3.org/1999/xhtml"><p>Sistema de Aplicaciones Neuquinas de Salud (ANDES)</p></div>'
15
+ },
12
16
  identifier: [
13
17
  {
14
18
  system: (0, config_1.makeUrl)('Device'),
@@ -19,10 +23,10 @@ function encode() {
19
23
  coding: [
20
24
  {
21
25
  system: 'http://snomed.info/sct',
22
- code: '462894001',
23
- display: 'software de aplicación de sistema de información de historias clínicas de pacientes (objeto físico)'
26
+ code: '462894001'
24
27
  }
25
- ]
28
+ ],
29
+ text: 'software de aplicación de sistema de información de historias clínicas de pacientes (objeto físico)'
26
30
  },
27
31
  owner: {
28
32
  reference: 'http://argentina.gob.ar/salud/refes/14999912399913'
@@ -4,41 +4,4 @@
4
4
  * [ASK] El code de extension puede ir en vaccineCode?
5
5
  * [ASk] Location no se sabe. Solo esta el texto
6
6
  */
7
- export declare function encode(patientReference: any, nomivac: any): {
8
- resourceType: string;
9
- id: any;
10
- extension: {
11
- url: string;
12
- valueCoding: {
13
- system: string;
14
- code: string;
15
- display: any;
16
- };
17
- }[];
18
- status: string;
19
- notGiven: boolean;
20
- vaccineCode: {
21
- coding: {
22
- system: string;
23
- code: any;
24
- display: any;
25
- }[];
26
- };
27
- patient: {
28
- reference: any;
29
- };
30
- date: any;
31
- primarySource: boolean;
32
- location: {
33
- reference: string;
34
- };
35
- vaccinationProtocol: {
36
- doseSequence: number;
37
- doseStatus: {
38
- coding: {
39
- system: string;
40
- code: any;
41
- }[];
42
- };
43
- }[];
44
- };
7
+ export declare function encode(patientReference: any, nomivac: any): any;
@@ -8,59 +8,72 @@ exports.encode = encode;
8
8
  * [ASk] Location no se sabe. Solo esta el texto
9
9
  */
10
10
  function encode(patientReference, nomivac) {
11
- return {
11
+ const occurrenceDate = nomivac.fechaAplicacion
12
+ ? new Date(nomivac.fechaAplicacion).toISOString()
13
+ : new Date().toISOString();
14
+ const immunization = {
12
15
  resourceType: 'Immunization',
13
- id: nomivac.idvacuna,
14
- extension: [
15
- {
16
- url: 'http://sisa/fhir/esquema',
17
- valueCoding: {
18
- system: 'http://argentina.gob.ar/salud/NOMIVAC-esquemas',
19
- code: '0', // [TODO] Ver que code ponemos acá
20
- display: nomivac.vacuna
21
- }
22
- },
23
- {
24
- url: 'http://sisa/fhir/condicionAplicacion',
25
- valueCoding: {
26
- system: 'http://argentina.gob.ar/salud/NOMIVAC-condicion',
27
- code: '17',
28
- display: 'Personal de Salud'
29
- }
30
- }
31
- ],
16
+ id: String(nomivac.idvacuna),
17
+ meta: {
18
+ profile: [
19
+ 'http://hl7.org/fhir/uv/ips/StructureDefinition/Immunization-uv-ips'
20
+ ]
21
+ },
22
+ text: {
23
+ status: 'generated',
24
+ div: `<div xmlns="http://www.w3.org/1999/xhtml"><p>${nomivac.vacuna || 'Vacuna'}</p></div>`
25
+ },
32
26
  status: 'completed',
33
- notGiven: false,
34
27
  vaccineCode: {
35
28
  coding: [
36
29
  {
37
30
  system: 'https://snomed.info/sct/11000221109/id/228100022110',
38
- code: nomivac.idvacuna,
31
+ code: String(nomivac.idvacuna),
39
32
  display: nomivac.vacuna
40
33
  }
41
- ]
34
+ ],
35
+ text: nomivac.vacuna
42
36
  },
43
37
  patient: {
44
38
  reference: patientReference
45
39
  },
46
- date: nomivac.fechaAplicacion,
47
- primarySource: false,
48
- location: {
40
+ occurrenceDateTime: occurrenceDate,
41
+ primarySource: false
42
+ };
43
+ if (nomivac.vacuna || nomivac.condicion) {
44
+ immunization.extension = [];
45
+ if (nomivac.vacuna) {
46
+ immunization.extension.push({
47
+ url: 'http://sisa/fhir/esquema',
48
+ valueCoding: {
49
+ system: 'http://argentina.gob.ar/salud/NOMIVAC-esquemas',
50
+ code: '0',
51
+ display: nomivac.vacuna
52
+ }
53
+ });
54
+ }
55
+ if (nomivac.condicion) {
56
+ immunization.extension.push({
57
+ url: 'http://sisa/fhir/condicionAplicacion',
58
+ valueCoding: {
59
+ system: 'http://argentina.gob.ar/salud/NOMIVAC-condicion',
60
+ code: '17',
61
+ display: 'Personal de Salud'
62
+ }
63
+ });
64
+ }
65
+ }
66
+ if (nomivac.location) {
67
+ immunization.location = {
49
68
  reference: 'http://argentina.gob.ar/salud/refes/14999912399913'
50
- },
51
- // lotNumber: null,
52
- vaccinationProtocol: [
69
+ };
70
+ }
71
+ if (nomivac.dosis) {
72
+ immunization.protocolApplied = [
53
73
  {
54
- doseSequence: 1,
55
- doseStatus: {
56
- coding: [
57
- {
58
- system: 'http://hl7.org/fhir/vaccination-protocol-dose-status',
59
- code: nomivac.dosis
60
- }
61
- ]
62
- }
74
+ doseNumberString: String(nomivac.dosis)
63
75
  }
64
- ]
65
- };
76
+ ];
77
+ }
78
+ return immunization;
66
79
  }
@@ -23,7 +23,7 @@ function encode(patientReference, medicationReference, prestacionMedicamento) {
23
23
  },
24
24
  meta: {
25
25
  profile: [
26
- 'http://hl7.org/fhir/uv/ips/StructureDefinition/medication-ips'
26
+ 'http://hl7.org/fhir/uv/ips/StructureDefinition/MedicationStatement-uv-ips'
27
27
  ]
28
28
  },
29
29
  // extension: null,
@@ -63,18 +63,35 @@ function encode(organization) {
63
63
  const direcciones = [];
64
64
  if (data.direccion) {
65
65
  const dir = data.direccion;
66
- direcciones.push({
67
- postalCode: dir.codigoPostal ?? '',
68
- line: [dir.valor],
69
- city: dir.ubicacion?.localidad?.nombre ?? '',
70
- state: dir.ubicacion?.provincia?.nombre ?? '',
71
- country: dir.ubicacion?.pais?.nombre ?? ''
72
- });
66
+ const address = {};
67
+ const city = dir.ubicacion?.localidad?.nombre;
68
+ const state = dir.ubicacion?.provincia?.nombre;
69
+ const country = dir.ubicacion?.pais?.nombre;
70
+ if (dir.valor?.trim()) {
71
+ address.line = [dir.valor.trim()];
72
+ }
73
+ if (dir.codigoPostal && String(dir.codigoPostal).trim()) {
74
+ address.postalCode = String(dir.codigoPostal).trim();
75
+ }
76
+ if (city?.trim()) {
77
+ address.city = city.trim();
78
+ }
79
+ if (state?.trim()) {
80
+ address.state = state.trim();
81
+ }
82
+ if (country?.trim()) {
83
+ address.country = country.trim();
84
+ }
85
+ direcciones.push(address);
73
86
  }
74
87
  // Organización FHIR
75
88
  const organizacionFHIR = {
76
89
  resourceType: 'Organization',
77
90
  id: data._id ?? data.id,
91
+ text: {
92
+ status: 'generated',
93
+ div: `<div xmlns="http://www.w3.org/1999/xhtml"><p>${data.nombre || 'Organización'}</p></div>`
94
+ },
78
95
  identifier: identificadores,
79
96
  active: data.activo ?? undefined,
80
97
  name: data.nombre ?? undefined,
@@ -175,13 +175,23 @@ function encode(patient) {
175
175
  const country = typeof unaDireccion.ubicacion.pais === 'object'
176
176
  ? unaDireccion.ubicacion.pais?.nombre
177
177
  : unaDireccion.ubicacion.pais;
178
- return {
179
- postalCode: unaDireccion.codigoPostal ?? '',
180
- line: [unaDireccion.valor],
181
- city: city ?? '',
182
- state: state ?? '',
183
- country: country ?? ''
184
- };
178
+ const address = {};
179
+ if (unaDireccion.valor?.trim()) {
180
+ address.line = [unaDireccion.valor.trim()];
181
+ }
182
+ if (unaDireccion.codigoPostal && String(unaDireccion.codigoPostal).trim()) {
183
+ address.postalCode = String(unaDireccion.codigoPostal).trim();
184
+ }
185
+ if (city?.trim()) {
186
+ address.city = city.trim();
187
+ }
188
+ if (state?.trim()) {
189
+ address.state = state.trim();
190
+ }
191
+ if (country?.trim()) {
192
+ address.country = country.trim();
193
+ }
194
+ return address;
185
195
  });
186
196
  // Relaciones → contact
187
197
  const relacionesFHIR = (patient.relaciones ?? [])
@@ -207,6 +217,10 @@ function encode(patient) {
207
217
  const pacienteFHIR = {
208
218
  resourceType: 'Patient',
209
219
  id: patient._id ?? patient.id,
220
+ text: {
221
+ status: 'generated',
222
+ div: `<div xmlns="http://www.w3.org/1999/xhtml"><p>${`${patient.nombre || ''} ${patient.apellido || ''}`.trim()}</p></div>`
223
+ },
210
224
  identifier: identificadores,
211
225
  active: patient.activo ?? undefined,
212
226
  name: [{
@@ -52,13 +52,26 @@ function encode(practitioner) {
52
52
  // Direcciones → address
53
53
  // -----------------------------
54
54
  const direcciones = (data.domicilios ?? []).map((unDomicilio) => {
55
- return {
56
- postalCode: unDomicilio.codigoPostal ?? '',
57
- line: [unDomicilio.valor],
58
- city: unDomicilio.ubicacion?.localidad?.nombre ?? '',
59
- state: unDomicilio.ubicacion?.provincia?.nombre ?? '',
60
- country: unDomicilio.ubicacion?.pais?.nombre ?? ''
61
- };
55
+ const address = {};
56
+ const city = unDomicilio.ubicacion?.localidad?.nombre;
57
+ const state = unDomicilio.ubicacion?.provincia?.nombre;
58
+ const country = unDomicilio.ubicacion?.pais?.nombre;
59
+ if (unDomicilio.valor?.trim()) {
60
+ address.line = [unDomicilio.valor.trim()];
61
+ }
62
+ if (unDomicilio.codigoPostal && String(unDomicilio.codigoPostal).trim()) {
63
+ address.postalCode = String(unDomicilio.codigoPostal).trim();
64
+ }
65
+ if (city?.trim()) {
66
+ address.city = city.trim();
67
+ }
68
+ if (state?.trim()) {
69
+ address.state = state.trim();
70
+ }
71
+ if (country?.trim()) {
72
+ address.country = country.trim();
73
+ }
74
+ return address;
62
75
  });
63
76
  // -----------------------------
64
77
  // Relaciones (hoy no se usan en Practitioner)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andes/fhir",
3
- "version": "1.13.0-beta.10",
3
+ "version": "1.13.0-beta.11",
4
4
  "engines": {
5
5
  "node": ">=24.0.0"
6
6
  },