@andes/fhir 1.12.1-beta.7 → 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
  */
@@ -99,16 +100,6 @@ function mapEstadoCivilFHIRToAndes(estadoCivil) {
99
100
  return 'otro';
100
101
  }
101
102
  }
102
- function mapAndesRankingToFhirRank(andesRanking) {
103
- return typeof andesRanking === 'number' && Number.isInteger(andesRanking) && andesRanking >= 0
104
- ? andesRanking + 1
105
- : 1;
106
- }
107
- function mapFhirRankToAndesRanking(fhirRank) {
108
- return typeof fhirRank === 'number' && Number.isInteger(fhirRank) && fhirRank > 0
109
- ? fhirRank - 1
110
- : 0;
111
- }
112
103
  /**
113
104
  * Encode a patient from ANDES to FHIR
114
105
  */
@@ -155,7 +146,7 @@ function encode(patient) {
155
146
  .map((unContacto) => {
156
147
  const cont = {
157
148
  value: unContacto.valor,
158
- rank: mapAndesRankingToFhirRank(unContacto.ranking)
149
+ rank: (0, rankingMapping_1.mapAndesRankingToFhirRank)(unContacto.ranking)
159
150
  };
160
151
  switch (unContacto.tipo) {
161
152
  case 'fijo':
@@ -309,7 +300,7 @@ function decode(patient) {
309
300
  ? patient.telecom.map((unContacto) => {
310
301
  const cont = {
311
302
  valor: unContacto.value,
312
- ranking: mapFhirRankToAndesRanking(unContacto.rank)
303
+ ranking: (0, rankingMapping_1.mapFhirRankToAndesRanking)(unContacto.rank)
313
304
  };
314
305
  switch (unContacto.system) {
315
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.7",
3
+ "version": "1.13.0-beta.1",
4
4
  "engines": {
5
5
  "node": ">=18.0.0"
6
6
  },