@andes/fhir 1.12.0-beta.4 → 1.12.1-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.
Files changed (104) hide show
  1. package/{src → dist}/data/patient.json +192 -191
  2. package/dist/{src/helpers → helpers}/patientFactory.js +35 -31
  3. package/dist/{src/lib → lib}/allergyIntolerance.js +39 -40
  4. package/dist/{src/lib → lib}/bundle.js +25 -26
  5. package/dist/{src/lib → lib}/composition.js +152 -152
  6. package/dist/{src/lib → lib}/condition.js +79 -80
  7. package/dist/{src/lib → lib}/config.js +27 -21
  8. package/dist/lib/config.test.js +19 -0
  9. package/dist/{src/lib → lib}/device.js +38 -39
  10. package/dist/lib/device.test.js +9 -0
  11. package/dist/{src/lib → lib}/document-reference.js +106 -107
  12. package/dist/{src/lib → lib}/immunization.js +67 -68
  13. package/{src/lib/medication.ts → dist/lib/medication.js} +64 -61
  14. package/{src/lib/medicationRequest.ts → dist/lib/medicationRequest.js} +103 -100
  15. package/dist/{src/lib → lib}/medicationStatement.js +55 -56
  16. package/dist/lib/organization.js +93 -0
  17. package/dist/lib/patient.js +465 -0
  18. package/dist/lib/patient.test.js +132 -0
  19. package/dist/lib/practitioner.js +186 -0
  20. package/dist/types/andes/organization.types.js +2 -0
  21. package/dist/types/andes/patient.types.js +2 -0
  22. package/dist/types/andes/practitioner.types.js +3 -0
  23. package/package.json +52 -43
  24. package/.circleci/config.yml +0 -72
  25. package/.editorconfig +0 -14
  26. package/.env.example +0 -2
  27. package/.gitattributes +0 -1
  28. package/.github/CODEOWNERS +0 -1
  29. package/.github/labeler.yml +0 -11
  30. package/.github/pull_request_template.md +0 -28
  31. package/.github/workflows/build_test.yml +0 -14
  32. package/.github/workflows/has_conflicts.yml +0 -13
  33. package/.vscode/settings.json +0 -2
  34. package/CHANGELOG.md +0 -335
  35. package/coverage/clover.xml +0 -198
  36. package/coverage/coverage-final.json +0 -5
  37. package/coverage/lcov-report/base.css +0 -224
  38. package/coverage/lcov-report/block-navigation.js +0 -87
  39. package/coverage/lcov-report/config.ts.html +0 -136
  40. package/coverage/lcov-report/device.ts.html +0 -193
  41. package/coverage/lcov-report/favicon.png +0 -0
  42. package/coverage/lcov-report/helpers/index.html +0 -116
  43. package/coverage/lcov-report/helpers/patientFactory.ts.html +0 -124
  44. package/coverage/lcov-report/index.html +0 -131
  45. package/coverage/lcov-report/lib/config.ts.html +0 -136
  46. package/coverage/lcov-report/lib/device.ts.html +0 -193
  47. package/coverage/lcov-report/lib/index.html +0 -146
  48. package/coverage/lcov-report/lib/patient.ts.html +0 -1240
  49. package/coverage/lcov-report/patient.ts.html +0 -1207
  50. package/coverage/lcov-report/prettify.css +0 -1
  51. package/coverage/lcov-report/prettify.js +0 -2
  52. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  53. package/coverage/lcov-report/sorter.js +0 -210
  54. package/coverage/lcov.info +0 -410
  55. package/dist/index.js +0 -52
  56. package/dist/index.js.map +0 -1
  57. package/dist/src/data/patient.json +0 -191
  58. package/dist/src/helpers/patientFactory.js.map +0 -1
  59. package/dist/src/lib/allergyIntolerance.js.map +0 -1
  60. package/dist/src/lib/bundle.js.map +0 -1
  61. package/dist/src/lib/composition.js.map +0 -1
  62. package/dist/src/lib/condition.js.map +0 -1
  63. package/dist/src/lib/config.js.map +0 -1
  64. package/dist/src/lib/config.test.js +0 -13
  65. package/dist/src/lib/config.test.js.map +0 -1
  66. package/dist/src/lib/device.js.map +0 -1
  67. package/dist/src/lib/device.test.js +0 -10
  68. package/dist/src/lib/device.test.js.map +0 -1
  69. package/dist/src/lib/document-reference.js.map +0 -1
  70. package/dist/src/lib/immunization.js.map +0 -1
  71. package/dist/src/lib/medication.js +0 -65
  72. package/dist/src/lib/medication.js.map +0 -1
  73. package/dist/src/lib/medicationRequest.js +0 -103
  74. package/dist/src/lib/medicationRequest.js.map +0 -1
  75. package/dist/src/lib/medicationStatement.js.map +0 -1
  76. package/dist/src/lib/organization.js +0 -91
  77. package/dist/src/lib/organization.js.map +0 -1
  78. package/dist/src/lib/patient.js +0 -371
  79. package/dist/src/lib/patient.js.map +0 -1
  80. package/dist/src/lib/patient.test.js +0 -79
  81. package/dist/src/lib/patient.test.js.map +0 -1
  82. package/dist/src/lib/practitioner.js +0 -161
  83. package/dist/src/lib/practitioner.js.map +0 -1
  84. package/index.ts +0 -30
  85. package/jest.config.js +0 -12
  86. package/release.config.js +0 -74
  87. package/src/helpers/patientFactory.ts +0 -13
  88. package/src/lib/allergyIntolerance.ts +0 -36
  89. package/src/lib/bundle.ts +0 -19
  90. package/src/lib/composition.ts +0 -153
  91. package/src/lib/condition.ts +0 -80
  92. package/src/lib/config.test.ts +0 -13
  93. package/src/lib/config.ts +0 -17
  94. package/src/lib/device.test.ts +0 -9
  95. package/src/lib/device.ts +0 -36
  96. package/src/lib/document-reference.ts +0 -102
  97. package/src/lib/immunization.ts +0 -64
  98. package/src/lib/medicationStatement.ts +0 -52
  99. package/src/lib/organization.ts +0 -89
  100. package/src/lib/patient.test.ts +0 -62
  101. package/src/lib/patient.ts +0 -385
  102. package/src/lib/practitioner.ts +0 -157
  103. package/tsconfig.test.json +0 -18
  104. package/tslint.json +0 -139
@@ -0,0 +1,186 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.encode = void 0;
4
+ const config_1 = require("./config");
5
+ /**
6
+ * Encode a practitioner from ANDES to FHIR
7
+ */
8
+ function encode(practitioner) {
9
+ const data = practitioner;
10
+ if (!data) {
11
+ return null;
12
+ }
13
+ // -----------------------------
14
+ // Identificadores
15
+ // -----------------------------
16
+ const identificadores = [];
17
+ if (data.documento) {
18
+ identificadores.push({
19
+ system: 'http://www.renaper.gob.ar/dni',
20
+ value: data.documento
21
+ });
22
+ }
23
+ if (data.cuit) {
24
+ identificadores.push({
25
+ system: 'https://seti.afip.gob.ar/padron-puc-constancia-internet/ConsultaConstanciaAction.do',
26
+ value: data.cuit
27
+ });
28
+ }
29
+ identificadores.push({
30
+ system: (0, config_1.getDominio)(),
31
+ value: data._id
32
+ });
33
+ // -----------------------------
34
+ // Contactos → telecom
35
+ // -----------------------------
36
+ const contactos = (data.contacto ?? []).map((unContacto) => {
37
+ const cont = {
38
+ value: unContacto.valor,
39
+ rank: unContacto.ranking
40
+ };
41
+ switch (unContacto.tipo) {
42
+ case 'fijo':
43
+ case 'celular':
44
+ cont.system = 'phone';
45
+ break;
46
+ case 'email':
47
+ cont.system = 'email';
48
+ break;
49
+ }
50
+ return cont;
51
+ });
52
+ // -----------------------------
53
+ // Direcciones → address
54
+ // -----------------------------
55
+ const direcciones = (data.domicilios ?? []).map((unDomicilio) => {
56
+ return {
57
+ postalCode: unDomicilio.codigoPostal ?? '',
58
+ line: [unDomicilio.valor],
59
+ city: unDomicilio.ubicacion?.localidad?.nombre ?? '',
60
+ state: unDomicilio.ubicacion?.provincia?.nombre ?? '',
61
+ country: unDomicilio.ubicacion?.pais?.nombre ?? ''
62
+ };
63
+ });
64
+ // -----------------------------
65
+ // Relaciones (hoy no se usan en Practitioner)
66
+ // Si en algún momento van a Communication o a otro resource, ya está tipado.
67
+ // -----------------------------
68
+ const relaciones = data.relaciones ?? [];
69
+ // -----------------------------
70
+ // Matriculación de grado
71
+ // -----------------------------
72
+ const matriculas = (data.formacionGrado ?? []).map((datosGrado) => {
73
+ const cantMatriculaciones = datosGrado.matriculacion?.length ?? 0;
74
+ const ultima = cantMatriculaciones > 0
75
+ ? datosGrado.matriculacion[cantMatriculaciones - 1]
76
+ : undefined;
77
+ const unaMatricula = {
78
+ identifier: datosGrado.profesion.nombre
79
+ ? [{
80
+ system: 'https://www.saludneuquen.gob.ar/matriculacionGrado',
81
+ value: datosGrado.profesion.nombre
82
+ }]
83
+ : []
84
+ };
85
+ if (ultima) {
86
+ unaMatricula.code = {
87
+ coding: [{
88
+ system: 'http://www.saludneuquen.gob.ar/fiscalizacion.html',
89
+ code: datosGrado.profesion.codigo,
90
+ display: datosGrado.profesion.tipoDeFormacion
91
+ }],
92
+ text: ultima.matriculaNumero
93
+ };
94
+ unaMatricula.period = {
95
+ start: ultima.inicio ?? null,
96
+ end: ultima.fin ?? null
97
+ };
98
+ }
99
+ return unaMatricula;
100
+ });
101
+ // -----------------------------
102
+ // Matriculación de posgrado / especialidad
103
+ // -----------------------------
104
+ const matriculasEspecialidad = (data.formacionPosgrado ?? []).map((datosPosgrado) => {
105
+ const cantMatriculacionesEsp = datosPosgrado.matriculacion?.length ?? 0;
106
+ const ultima = cantMatriculacionesEsp > 0
107
+ ? datosPosgrado.matriculacion[cantMatriculacionesEsp - 1]
108
+ : undefined;
109
+ const unaMatricula = {
110
+ identifier: datosPosgrado.especialidad.nombre
111
+ ? [{
112
+ system: 'https://www.saludneuquen.gob.ar/matriculacionEspecialidad/',
113
+ value: datosPosgrado.especialidad.nombre
114
+ }]
115
+ : []
116
+ };
117
+ if (ultima) {
118
+ unaMatricula.code = {
119
+ coding: [{
120
+ system: 'http://www.saludneuquen.gob.ar/fiscalizacion.html',
121
+ code: datosPosgrado.especialidad.codigo,
122
+ display: datosPosgrado.especialidad.tipo
123
+ }],
124
+ text: ultima.matriculaNumero
125
+ };
126
+ unaMatricula.period = {
127
+ start: ultima.inicio ?? null,
128
+ end: ultima.fin ?? null
129
+ };
130
+ }
131
+ return unaMatricula;
132
+ });
133
+ // -----------------------------
134
+ // Género
135
+ // -----------------------------
136
+ let genero;
137
+ if (data.sexo) {
138
+ switch (data.sexo.toLowerCase()) {
139
+ case 'femenino':
140
+ genero = 'female';
141
+ break;
142
+ case 'masculino':
143
+ genero = 'male';
144
+ break;
145
+ case 'otro':
146
+ genero = 'other';
147
+ break;
148
+ default:
149
+ genero = undefined;
150
+ break;
151
+ }
152
+ }
153
+ // -----------------------------
154
+ // Practitioner FHIR
155
+ // -----------------------------
156
+ const profesionalFHIR = {
157
+ resourceType: 'Practitioner',
158
+ identifier: identificadores,
159
+ active: data.habilitado ?? undefined,
160
+ name: [{
161
+ family: data.apellido,
162
+ given: data.nombre?.split(' ') ?? []
163
+ }],
164
+ gender: genero,
165
+ birthDate: data.fechaNacimiento,
166
+ };
167
+ if (contactos.length > 0) {
168
+ profesionalFHIR.telecom = contactos;
169
+ }
170
+ if (direcciones.length > 0) {
171
+ profesionalFHIR.address = direcciones;
172
+ }
173
+ const todasLasMatriculas = [...matriculas, ...matriculasEspecialidad].filter(m => m);
174
+ if (todasLasMatriculas.length > 0) {
175
+ // usamos any porque la definición de qualification en fhir/r4
176
+ // es más estricta que lo que trae Andes (code requerido, etc.)
177
+ profesionalFHIR.qualification = todasLasMatriculas;
178
+ }
179
+ if (data.foto) {
180
+ profesionalFHIR.photo = [{
181
+ data: data.foto
182
+ }];
183
+ }
184
+ return profesionalFHIR;
185
+ }
186
+ exports.encode = encode;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // Tipos de apoyo para PRACTITIONER de ANDES
3
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,45 +1,54 @@
1
1
  {
2
- "name": "@andes/fhir",
3
- "version": "1.12.0-beta.4",
4
- "repository": {
5
- "type": "git",
6
- "url": "https://github.com/andes/fhir.git"
7
- },
8
- "author": "Red TICs",
9
- "license": "GPL-3.0",
10
- "jest": {
11
- "verbose": true
12
- },
13
- "scripts": {
14
- "lint": "tslint --project .",
15
- "start": "node index.js",
16
- "tsc": "tsc",
17
- "test": "npx jest --coverage",
18
- "tsc:w": "tsc -w",
19
- "prepublishOnly": "rimraf dist && tsc -p ./ --outDir dist/",
20
- "semantic-release": "semantic-release"
21
- },
22
- "main": "./dist/index.js",
23
- "devDependencies": {
24
- "@semantic-release/changelog": "^6.0.3",
25
- "@semantic-release/git": "^10.0.1",
26
- "@types/jest": "^26.0.24",
27
- "@types/node": "^6.0.117",
28
- "conventional-changelog-conventionalcommits": "^9.1.0",
29
- "dotenv-cli": "^11.0.0",
30
- "jasmine-core": "~2.6.2",
31
- "jasmine-spec-reporter": "~4.1.0",
32
- "jest": "^26.6.3",
33
- "rimraf": "^6.1.0",
34
- "semantic-release": "^24.2.9",
35
- "ts-jest": "^26.5.4",
36
- "ts-node": "~3.0.4",
37
- "tslint": "^5.20.1",
38
- "tslint-eslint-rules": "^5.4.0",
39
- "typescript": "^3.9.9"
40
- },
41
- "dependencies": {
42
- "@jest/types": "^26.6.2",
43
- "moment": ">=2.29.4"
44
- }
2
+ "name": "@andes/fhir",
3
+ "version": "1.12.1-beta.1",
4
+ "engines": {
5
+ "node": ">=18.0.0"
6
+ },
7
+ "engineStrict": true,
8
+ "scripts": {
9
+ "lint": "eslint \"src/**/*.ts\"",
10
+ "tsc": "tsc",
11
+ "tsc:w": "tsc -w",
12
+ "test": "jest --coverage",
13
+ "prepublishOnly": "rimraf dist && tsc -p ./ --outDir dist/",
14
+ "build": "tsc -p ./ --outDir dist",
15
+ "semantic-release": "semantic-release",
16
+ "release:beta": "dotenv -e .env -- semantic-release --branches develop",
17
+ "release:beta:dry": "dotenv -e .env -- semantic-release --no-ci --branches develop --dry-run",
18
+ "release:prod": "dotenv -e .env -- semantic-release --branches master",
19
+ "release:prod:dry": "dotenv -e .env -- semantic-release --no-ci --branches master --dry-run"
20
+ },
21
+ "devDependencies": {
22
+ "@types/jest": "29.5.14",
23
+ "@types/node": "^18.19.0",
24
+ "@typescript-eslint/eslint-plugin": "^6.21.0",
25
+ "@typescript-eslint/parser": "^6.21.0",
26
+ "dotenv-cli": "^11.0.0",
27
+ "eslint": "^8.57.0",
28
+ "jest": "29.7.0",
29
+ "rimraf": "^5.0.7",
30
+ "semantic-release": "^20.1.0",
31
+ "ts-jest": "29.2.5",
32
+ "ts-node": "^10.9.2",
33
+ "typescript": "5.3.3"
34
+ },
35
+ "dependencies": {
36
+ "@types/fhir": "^0.0.41",
37
+ "moment": "2.29.4"
38
+ },
39
+ "files": [
40
+ "dist/**/*"
41
+ ],
42
+ "release": {
43
+ "branches": [
44
+ {
45
+ "name": "master"
46
+ },
47
+ {
48
+ "name": "develop",
49
+ "channel": "beta",
50
+ "prerelease": "beta"
51
+ }
52
+ ]
53
+ }
45
54
  }
@@ -1,72 +0,0 @@
1
- version: 2
2
- jobs:
3
- install:
4
- working_directory: ~/fhir
5
- docker:
6
- - image: 'cimg/node:22.11'
7
- steps:
8
- - run:
9
- name: Use HTTPS for GitHub
10
- command: git config --global url."https://github.com/".insteadOf "git@github.com:"
11
- - checkout
12
- - restore_cache:
13
- keys:
14
- - v2-deps-{{ .Branch }}-{{ checksum "package-lock.json" }}
15
- - v2-deps-{{ .Branch }}-
16
- - v2-deps-
17
- - run:
18
- name: Install dependencies
19
- command: npm ci
20
- - save_cache:
21
- key: v2-deps-{{ .Branch }}-{{ checksum "package-lock.json" }}
22
- paths:
23
- - ~/.npm
24
- - ~/.cache
25
- - persist_to_workspace:
26
- root: ~/
27
- paths:
28
- - .cache
29
- - fhir
30
- build:
31
- working_directory: ~/fhir
32
- docker:
33
- - image: cimg/node:22.11
34
- steps:
35
- - attach_workspace:
36
- at: ~/
37
- - run:
38
- name: lint
39
- command: npm run lint
40
- - run:
41
- name: npm-install
42
- command: npm install
43
- deploy:
44
- working_directory: ~/fhir
45
- docker:
46
- - image: 'cimg/node:22.11'
47
- steps:
48
- - attach_workspace:
49
- at: ~/
50
- - run: npx semantic-release
51
-
52
- workflows:
53
- version: 2
54
- prepare_and_release:
55
- jobs:
56
- - install
57
- - build:
58
- requires:
59
- - install
60
- - request-deploy:
61
- type: approval
62
- requires:
63
- - build
64
- filters:
65
- branches:
66
- only: master
67
- - deploy:
68
- requires:
69
- - request-deploy
70
- filters:
71
- branches:
72
- only: master
package/.editorconfig DELETED
@@ -1,14 +0,0 @@
1
- # Editor configuration, see http://editorconfig.org
2
- root = true
3
-
4
- [*]
5
- charset = utf-8
6
- indent_style = space
7
- indent_size = 2
8
- end_of_line = lf
9
- insert_final_newline = true
10
- trim_trailing_whitespace = true
11
-
12
- [*.md]
13
- max_line_length = 0
14
- trim_trailing_whitespace = false
package/.env.example DELETED
@@ -1,2 +0,0 @@
1
- GITHUB_TOKEN=
2
- NPM_TOKEN=
package/.gitattributes DELETED
@@ -1 +0,0 @@
1
- *.js linguist-language=TypeScript
@@ -1 +0,0 @@
1
- * @andes/testing @andes/code-review
@@ -1,11 +0,0 @@
1
- name: "Pull Request Labeler"
2
- on:
3
- - pull_request
4
-
5
- jobs:
6
- triage:
7
- runs-on: ubuntu-latest
8
- steps:
9
- - uses: actions/labeler@v2
10
- with:
11
- repo-token: "${{ secrets.GITHUB_TOKEN }}"
@@ -1,28 +0,0 @@
1
- <!--
2
-
3
- PASOS PARA REGISTRAR UN PULL REQUEST
4
- ____________________________________
5
- -->
6
- ### Requerimiento
7
- <!-- URL de la User Story, referencia al issue (#1111) o breve descripcion del requerimiento -->
8
-
9
- ### Funcionalidad desarrollada
10
- <!-- Describir que se desarrollo -->
11
- 1.
12
- 2.
13
- 3.
14
-
15
-
16
- ### UserStories llegó a completarse
17
- <!-- Marca con una X la casilla correcta-->
18
- - [ ] Si
19
- - [ ] No
20
-
21
- <!-- Agregar captura de pantalla, si fuera relevante -->
22
-
23
-
24
- <!-- Código relevante
25
- ```
26
- (pegar código aquí)
27
- ```
28
- -->
@@ -1,14 +0,0 @@
1
- name: BUILD AND TEST
2
- on: [push]
3
- jobs:
4
- build:
5
- runs-on: ubuntu-22.04
6
- steps:
7
- - uses: actions/checkout@v1
8
- - name: Use Node.js
9
- uses: actions/setup-node@v1
10
- with:
11
- node-version: '22.x'
12
- - run: npm ci
13
- - run: npm run lint
14
- - run: npm test
@@ -1,13 +0,0 @@
1
- on:
2
- workflow_dispatch:
3
- push:
4
- branches:
5
- - master
6
- jobs:
7
- triage:
8
- runs-on: ubuntu-latest
9
- steps:
10
- - uses: mschilde/auto-label-merge-conflicts@master
11
- with:
12
- CONFLICT_LABEL_NAME: "has conflicts"
13
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -1,2 +0,0 @@
1
- {
2
- }