@andes/fhir 1.12.1-beta.6 → 1.13.0-beta.1

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.
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.encode = void 0;
4
4
  const config_1 = require("./config");
5
+ const rankingMapping_1 = require("../utils/rankingMapping");
5
6
  /**
6
7
  * Encode an ANDES Organization to FHIR Organization
7
8
  */
@@ -13,25 +14,25 @@ function encode(organization) {
13
14
  const identificadores = [];
14
15
  if (data.codigo?.sisa) {
15
16
  identificadores.push({
16
- system: 'andes.gob.ar/sisa',
17
+ system: 'https://andes.gob.ar/sisa',
17
18
  value: data.codigo.sisa
18
19
  });
19
20
  }
20
21
  if (data.codigo?.cuie) {
21
22
  identificadores.push({
22
- system: 'andes.gob.ar/cuie',
23
+ system: 'https://andes.gob.ar/cuie',
23
24
  value: data.codigo.cuie
24
25
  });
25
26
  }
26
27
  if (data.codigo?.remediar) {
27
28
  identificadores.push({
28
- system: 'andes.gob.ar/remediar',
29
+ system: 'https://andes.gob.ar/remediar',
29
30
  value: data.codigo.remediar
30
31
  });
31
32
  }
32
33
  if (data.codigo?.sips) {
33
34
  identificadores.push({
34
- system: 'andes.gob.ar/sips',
35
+ system: 'https://andes.gob.ar/sips',
35
36
  value: data.codigo.sips
36
37
  });
37
38
  }
@@ -44,7 +45,7 @@ function encode(organization) {
44
45
  .map((item) => {
45
46
  const cp = {
46
47
  value: item.valor,
47
- rank: item.ranking
48
+ rank: (0, rankingMapping_1.mapAndesRankingToFhirRank)(item.ranking)
48
49
  };
49
50
  switch (item.tipo) {
50
51
  case 'fijo':
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.verify = exports.decode = exports.encode = void 0;
4
4
  const config_1 = require("./config");
5
+ const rankingMapping_1 = require("../utils/rankingMapping");
5
6
  /**
6
7
  * Helpers
7
8
  */
@@ -145,7 +146,7 @@ function encode(patient) {
145
146
  .map((unContacto) => {
146
147
  const cont = {
147
148
  value: unContacto.valor,
148
- rank: unContacto.ranking
149
+ rank: (0, rankingMapping_1.mapAndesRankingToFhirRank)(unContacto.ranking)
149
150
  };
150
151
  switch (unContacto.tipo) {
151
152
  case 'fijo':
@@ -240,7 +241,7 @@ function encode(patient) {
240
241
  }
241
242
  if (patient.createdBy?.organizacion) {
242
243
  const managingOrganization = {
243
- reference: patient.createdBy.organizacion.id,
244
+ reference: `Organization/${patient.createdBy.organizacion.id}`,
244
245
  display: patient.createdBy.organizacion.nombre
245
246
  };
246
247
  pacienteFHIR.managingOrganization = managingOrganization;
@@ -299,7 +300,7 @@ function decode(patient) {
299
300
  ? patient.telecom.map((unContacto) => {
300
301
  const cont = {
301
302
  valor: unContacto.value,
302
- ranking: unContacto.rank
303
+ ranking: (0, rankingMapping_1.mapFhirRankToAndesRanking)(unContacto.rank)
303
304
  };
304
305
  switch (unContacto.system) {
305
306
  case 'phone':
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Mapea ANDES ranking base 1 a FHIR rank base 1
3
+ */
4
+ export declare function mapAndesRankingToFhirRank(andesRanking?: number): number;
5
+ /**
6
+ * Mapea FHIR rank base 1 a ANDES ranking base 0
7
+ */
8
+ export declare function mapFhirRankToAndesRanking(fhirRank?: number): number;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapFhirRankToAndesRanking = exports.mapAndesRankingToFhirRank = void 0;
4
+ /**
5
+ * Mapea ANDES ranking base 1 a FHIR rank base 1
6
+ */
7
+ function mapAndesRankingToFhirRank(andesRanking) {
8
+ return typeof andesRanking === 'number' && Number.isInteger(andesRanking) && andesRanking >= 0
9
+ ? andesRanking + 1
10
+ : 1;
11
+ }
12
+ exports.mapAndesRankingToFhirRank = mapAndesRankingToFhirRank;
13
+ /**
14
+ * Mapea FHIR rank base 1 a ANDES ranking base 0
15
+ */
16
+ function mapFhirRankToAndesRanking(fhirRank) {
17
+ return typeof fhirRank === 'number' && Number.isInteger(fhirRank) && fhirRank > 0
18
+ ? fhirRank - 1
19
+ : 0;
20
+ }
21
+ exports.mapFhirRankToAndesRanking = mapFhirRankToAndesRanking;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andes/fhir",
3
- "version": "1.12.1-beta.6",
3
+ "version": "1.13.0-beta.1",
4
4
  "engines": {
5
5
  "node": ">=18.0.0"
6
6
  },