@andes/fhir 1.11.1 → 1.12.0-beta.2
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/.circleci/config.yml +71 -68
- package/.editorconfig +13 -13
- package/.env.example +2 -0
- package/.github/labeler.yml +10 -10
- package/.github/pull_request_template.md +28 -28
- package/.github/workflows/build_test.yml +14 -14
- package/.github/workflows/has_conflicts.yml +13 -13
- package/.vscode/settings.json +2 -0
- package/CHANGELOG.md +312 -291
- package/LICENSE +674 -674
- package/README.md +2 -2
- package/coverage/clover.xml +198 -0
- package/coverage/coverage-final.json +5 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/config.ts.html +136 -0
- package/coverage/lcov-report/device.ts.html +193 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/helpers/index.html +116 -0
- package/coverage/lcov-report/helpers/patientFactory.ts.html +124 -0
- package/coverage/lcov-report/index.html +131 -0
- package/coverage/lcov-report/lib/config.ts.html +136 -0
- package/coverage/lcov-report/lib/device.ts.html +193 -0
- package/coverage/lcov-report/lib/index.html +146 -0
- package/coverage/lcov-report/lib/patient.ts.html +1267 -0
- package/coverage/lcov-report/patient.ts.html +1207 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov.info +410 -0
- package/dist/index.js +51 -32
- package/dist/index.js.map +1 -1
- package/dist/src/data/patient.json +191 -185
- package/dist/src/helpers/patientFactory.js +31 -0
- package/dist/src/helpers/patientFactory.js.map +1 -0
- package/dist/src/lib/allergyIntolerance.js +39 -39
- package/dist/src/lib/allergyIntolerance.js.map +1 -1
- package/dist/src/lib/bundle.js +25 -22
- package/dist/src/lib/bundle.js.map +1 -1
- package/dist/src/lib/composition.js +151 -150
- package/dist/src/lib/composition.js.map +1 -1
- package/dist/src/lib/condition.js +79 -79
- package/dist/src/lib/condition.js.map +1 -1
- package/dist/src/lib/config.js +20 -22
- package/dist/src/lib/config.js.map +1 -1
- package/dist/src/lib/config.test.js +12 -12
- package/dist/src/lib/config.test.js.map +1 -1
- package/dist/src/lib/device.js +38 -38
- package/dist/src/lib/device.js.map +1 -1
- package/dist/src/lib/device.test.js +9 -9
- package/dist/src/lib/device.test.js.map +1 -1
- package/dist/src/lib/document-reference.js +106 -103
- package/dist/src/lib/document-reference.js.map +1 -1
- package/dist/src/lib/immunization.js +67 -67
- package/dist/src/lib/medication.js +64 -64
- package/dist/src/lib/medication.js.map +1 -1
- package/dist/src/lib/medicationRequest.js +102 -99
- package/dist/src/lib/medicationRequest.js.map +1 -1
- package/dist/src/lib/medicationStatement.js +55 -55
- package/dist/src/lib/medicationStatement.js.map +1 -1
- package/dist/src/lib/organization.js +90 -90
- package/dist/src/lib/organization.js.map +1 -1
- package/dist/src/lib/patient.js +378 -360
- package/dist/src/lib/patient.js.map +1 -1
- package/dist/src/lib/patient.test.js +78 -39
- package/dist/src/lib/patient.test.js.map +1 -1
- package/dist/src/lib/practitioner.js +160 -160
- package/dist/src/lib/practitioner.js.map +1 -1
- package/index.ts +31 -31
- package/jest.config.js +11 -11
- package/package.json +45 -54
- package/release.config.js +74 -0
- package/src/data/patient.json +190 -184
- package/src/helpers/patientFactory.ts +13 -0
- package/src/lib/allergyIntolerance.ts +36 -36
- package/src/lib/bundle.ts +19 -19
- package/src/lib/composition.ts +153 -153
- package/src/lib/condition.ts +80 -80
- package/src/lib/config.test.ts +13 -13
- package/src/lib/config.ts +17 -17
- package/src/lib/device.test.ts +9 -9
- package/src/lib/device.ts +36 -36
- package/src/lib/document-reference.ts +102 -102
- package/src/lib/immunization.ts +64 -64
- package/src/lib/medication.ts +61 -61
- package/src/lib/medicationRequest.ts +100 -100
- package/src/lib/medicationStatement.ts +52 -52
- package/src/lib/organization.ts +89 -89
- package/src/lib/patient.test.ts +62 -38
- package/src/lib/patient.ts +394 -374
- package/src/lib/practitioner.ts +157 -157
- package/tsconfig.test.json +17 -17
- package/tslint.json +138 -138
package/src/lib/bundle.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { makeUrl } from './config';
|
|
3
|
-
|
|
4
|
-
export function encode(ID, resources) {
|
|
5
|
-
return {
|
|
6
|
-
resourceType: 'Bundle',
|
|
7
|
-
id: ID,
|
|
8
|
-
meta: {
|
|
9
|
-
lastUpdated: moment().format()
|
|
10
|
-
},
|
|
11
|
-
language: 'es-AR',
|
|
12
|
-
entry: resources,
|
|
13
|
-
type: 'document',
|
|
14
|
-
identifier: {
|
|
15
|
-
system: makeUrl('Bundle'),
|
|
16
|
-
value: ID
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
}
|
|
1
|
+
import moment from 'moment';
|
|
2
|
+
import { makeUrl } from './config';
|
|
3
|
+
|
|
4
|
+
export function encode(ID, resources) {
|
|
5
|
+
return {
|
|
6
|
+
resourceType: 'Bundle',
|
|
7
|
+
id: ID,
|
|
8
|
+
meta: {
|
|
9
|
+
lastUpdated: moment().format()
|
|
10
|
+
},
|
|
11
|
+
language: 'es-AR',
|
|
12
|
+
entry: resources,
|
|
13
|
+
type: 'document',
|
|
14
|
+
identifier: {
|
|
15
|
+
system: makeUrl('Bundle'),
|
|
16
|
+
value: ID
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
package/src/lib/composition.ts
CHANGED
|
@@ -1,153 +1,153 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { makeUrl } from './config';
|
|
4
|
-
|
|
5
|
-
function getReference(url) {
|
|
6
|
-
return {
|
|
7
|
-
reference: url
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function encode(ID, patientReference, custodianReference, deviceReference, medicationStatementReference, ImmunizationReferences, AllergyIntoleranceReferences, ConditionReferences) {
|
|
12
|
-
const now = moment();
|
|
13
|
-
let Immunization: any = [];
|
|
14
|
-
let conditions: any = [];
|
|
15
|
-
let medications: any = [];
|
|
16
|
-
let allergyIntolerance = [];
|
|
17
|
-
|
|
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
|
-
|
|
36
|
-
medications = [{
|
|
37
|
-
title: 'Medicamentos',
|
|
38
|
-
text: {
|
|
39
|
-
status: 'generated',
|
|
40
|
-
div: '<div xmlns="http:\/\/www.w3.org\/1999\/xhtml">Registro de medicamentos<\/div>'
|
|
41
|
-
},
|
|
42
|
-
code: {
|
|
43
|
-
coding: [
|
|
44
|
-
{
|
|
45
|
-
system: 'http:\/\/loinc.org',
|
|
46
|
-
display: 'Medication use',
|
|
47
|
-
code: '10160-0'
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
},
|
|
51
|
-
entry: medicationStatementReference ? medicationStatementReference.map(getReference) : [],
|
|
52
|
-
}];
|
|
53
|
-
|
|
54
|
-
allergyIntolerance = [{
|
|
55
|
-
title: 'Alergias o Intolerancias',
|
|
56
|
-
text: {
|
|
57
|
-
status: 'generated',
|
|
58
|
-
div: '<div xmlns="http:\/\/www.w3.org\/1999\/xhtml">Registro de Alergias<\/div>'
|
|
59
|
-
},
|
|
60
|
-
code: {
|
|
61
|
-
coding: [
|
|
62
|
-
{
|
|
63
|
-
system: 'http:\/\/loinc.org',
|
|
64
|
-
display: 'Allergies and/or adverse reactions',
|
|
65
|
-
code: '48765-2'
|
|
66
|
-
}
|
|
67
|
-
]
|
|
68
|
-
},
|
|
69
|
-
entry: AllergyIntoleranceReferences ? AllergyIntoleranceReferences.map(getReference) : [],
|
|
70
|
-
}];
|
|
71
|
-
|
|
72
|
-
conditions = [{
|
|
73
|
-
code: {
|
|
74
|
-
coding: [
|
|
75
|
-
{
|
|
76
|
-
system: 'http:\/\/loinc.org',
|
|
77
|
-
display: 'Problem list',
|
|
78
|
-
code: '11450-4'
|
|
79
|
-
}
|
|
80
|
-
]
|
|
81
|
-
},
|
|
82
|
-
entry: ConditionReferences ? ConditionReferences.map(getReference) : [],
|
|
83
|
-
title: 'Problemas activos',
|
|
84
|
-
text: {
|
|
85
|
-
status: 'generated',
|
|
86
|
-
div: '<div xmlns="http:\/\/www.w3.org\/1999\/xhtml">Lista de problemas activos (trastornos)<\/div>'
|
|
87
|
-
}
|
|
88
|
-
}];
|
|
89
|
-
|
|
90
|
-
return {
|
|
91
|
-
id: ID,
|
|
92
|
-
subject: {
|
|
93
|
-
reference: patientReference
|
|
94
|
-
},
|
|
95
|
-
section: [
|
|
96
|
-
...conditions,
|
|
97
|
-
...medications,
|
|
98
|
-
...Immunization,
|
|
99
|
-
...allergyIntolerance
|
|
100
|
-
|
|
101
|
-
],
|
|
102
|
-
resourceType: 'Composition',
|
|
103
|
-
author: [
|
|
104
|
-
{
|
|
105
|
-
identifier: {
|
|
106
|
-
system: 'https://federador.msal.gob.ar/uri',
|
|
107
|
-
value: deviceReference
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
],
|
|
111
|
-
confidentiality: 'N',
|
|
112
|
-
type: {
|
|
113
|
-
coding: [
|
|
114
|
-
{
|
|
115
|
-
system: 'http:\/\/loinc.org',
|
|
116
|
-
display: 'Patient Summary',
|
|
117
|
-
code: '60591-5'
|
|
118
|
-
}
|
|
119
|
-
]
|
|
120
|
-
},
|
|
121
|
-
title: 'Resumen del paciente al ' + now.format('DD/MM/YYYY, HH:mm'),
|
|
122
|
-
identifier: {
|
|
123
|
-
system: makeUrl('Composition'),
|
|
124
|
-
value: ID
|
|
125
|
-
},
|
|
126
|
-
date: now,
|
|
127
|
-
// meta: {
|
|
128
|
-
// profile: [
|
|
129
|
-
// 'http:\/\/hl7.org\/fhir\/uv\/ips\/StructureDefinition\/composition-uv-ips'
|
|
130
|
-
// ]
|
|
131
|
-
// },
|
|
132
|
-
text: {
|
|
133
|
-
status: 'generated',
|
|
134
|
-
div: '<div xmlns=\"http://www.w3.org/1999/xhtml\">IPS Neuquen</div>'
|
|
135
|
-
},
|
|
136
|
-
custodian: {
|
|
137
|
-
identifier: {
|
|
138
|
-
system: 'https://federador.msal.gob.ar/uri',
|
|
139
|
-
value: custodianReference
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
attester: [
|
|
143
|
-
{
|
|
144
|
-
mode: 'legal',
|
|
145
|
-
time: now,
|
|
146
|
-
party: {
|
|
147
|
-
reference: custodianReference
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
],
|
|
151
|
-
status: 'final'
|
|
152
|
-
};
|
|
153
|
-
}
|
|
1
|
+
|
|
2
|
+
import moment from 'moment';
|
|
3
|
+
import { makeUrl } from './config';
|
|
4
|
+
|
|
5
|
+
function getReference(url) {
|
|
6
|
+
return {
|
|
7
|
+
reference: url
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function encode(ID, patientReference, custodianReference, deviceReference, medicationStatementReference, ImmunizationReferences, AllergyIntoleranceReferences, ConditionReferences) {
|
|
12
|
+
const now = moment();
|
|
13
|
+
let Immunization: any = [];
|
|
14
|
+
let conditions: any = [];
|
|
15
|
+
let medications: any = [];
|
|
16
|
+
let allergyIntolerance = [];
|
|
17
|
+
|
|
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
|
+
|
|
36
|
+
medications = [{
|
|
37
|
+
title: 'Medicamentos',
|
|
38
|
+
text: {
|
|
39
|
+
status: 'generated',
|
|
40
|
+
div: '<div xmlns="http:\/\/www.w3.org\/1999\/xhtml">Registro de medicamentos<\/div>'
|
|
41
|
+
},
|
|
42
|
+
code: {
|
|
43
|
+
coding: [
|
|
44
|
+
{
|
|
45
|
+
system: 'http:\/\/loinc.org',
|
|
46
|
+
display: 'Medication use',
|
|
47
|
+
code: '10160-0'
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
entry: medicationStatementReference ? medicationStatementReference.map(getReference) : [],
|
|
52
|
+
}];
|
|
53
|
+
|
|
54
|
+
allergyIntolerance = [{
|
|
55
|
+
title: 'Alergias o Intolerancias',
|
|
56
|
+
text: {
|
|
57
|
+
status: 'generated',
|
|
58
|
+
div: '<div xmlns="http:\/\/www.w3.org\/1999\/xhtml">Registro de Alergias<\/div>'
|
|
59
|
+
},
|
|
60
|
+
code: {
|
|
61
|
+
coding: [
|
|
62
|
+
{
|
|
63
|
+
system: 'http:\/\/loinc.org',
|
|
64
|
+
display: 'Allergies and/or adverse reactions',
|
|
65
|
+
code: '48765-2'
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
entry: AllergyIntoleranceReferences ? AllergyIntoleranceReferences.map(getReference) : [],
|
|
70
|
+
}];
|
|
71
|
+
|
|
72
|
+
conditions = [{
|
|
73
|
+
code: {
|
|
74
|
+
coding: [
|
|
75
|
+
{
|
|
76
|
+
system: 'http:\/\/loinc.org',
|
|
77
|
+
display: 'Problem list',
|
|
78
|
+
code: '11450-4'
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
entry: ConditionReferences ? ConditionReferences.map(getReference) : [],
|
|
83
|
+
title: 'Problemas activos',
|
|
84
|
+
text: {
|
|
85
|
+
status: 'generated',
|
|
86
|
+
div: '<div xmlns="http:\/\/www.w3.org\/1999\/xhtml">Lista de problemas activos (trastornos)<\/div>'
|
|
87
|
+
}
|
|
88
|
+
}];
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
id: ID,
|
|
92
|
+
subject: {
|
|
93
|
+
reference: patientReference
|
|
94
|
+
},
|
|
95
|
+
section: [
|
|
96
|
+
...conditions,
|
|
97
|
+
...medications,
|
|
98
|
+
...Immunization,
|
|
99
|
+
...allergyIntolerance
|
|
100
|
+
|
|
101
|
+
],
|
|
102
|
+
resourceType: 'Composition',
|
|
103
|
+
author: [
|
|
104
|
+
{
|
|
105
|
+
identifier: {
|
|
106
|
+
system: 'https://federador.msal.gob.ar/uri',
|
|
107
|
+
value: deviceReference
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
confidentiality: 'N',
|
|
112
|
+
type: {
|
|
113
|
+
coding: [
|
|
114
|
+
{
|
|
115
|
+
system: 'http:\/\/loinc.org',
|
|
116
|
+
display: 'Patient Summary',
|
|
117
|
+
code: '60591-5'
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
title: 'Resumen del paciente al ' + now.format('DD/MM/YYYY, HH:mm'),
|
|
122
|
+
identifier: {
|
|
123
|
+
system: makeUrl('Composition'),
|
|
124
|
+
value: ID
|
|
125
|
+
},
|
|
126
|
+
date: now,
|
|
127
|
+
// meta: {
|
|
128
|
+
// profile: [
|
|
129
|
+
// 'http:\/\/hl7.org\/fhir\/uv\/ips\/StructureDefinition\/composition-uv-ips'
|
|
130
|
+
// ]
|
|
131
|
+
// },
|
|
132
|
+
text: {
|
|
133
|
+
status: 'generated',
|
|
134
|
+
div: '<div xmlns=\"http://www.w3.org/1999/xhtml\">IPS Neuquen</div>'
|
|
135
|
+
},
|
|
136
|
+
custodian: {
|
|
137
|
+
identifier: {
|
|
138
|
+
system: 'https://federador.msal.gob.ar/uri',
|
|
139
|
+
value: custodianReference
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
attester: [
|
|
143
|
+
{
|
|
144
|
+
mode: 'legal',
|
|
145
|
+
time: now,
|
|
146
|
+
party: {
|
|
147
|
+
reference: custodianReference
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
],
|
|
151
|
+
status: 'final'
|
|
152
|
+
};
|
|
153
|
+
}
|
package/src/lib/condition.ts
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import { makeUrl } from './config';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @param registro Registro RUP a transformar a FHIR
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export function encode(patientReference, registro) {
|
|
10
|
-
return {
|
|
11
|
-
id : registro._id,
|
|
12
|
-
category : [
|
|
13
|
-
{
|
|
14
|
-
coding : [
|
|
15
|
-
{
|
|
16
|
-
system : 'http://loinc.org',
|
|
17
|
-
display : 'Problem',
|
|
18
|
-
code : '75326-9'
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
|
-
subject : {
|
|
24
|
-
reference : patientReference
|
|
25
|
-
},
|
|
26
|
-
onsetDateTime : registro.createdAt.getFullYear(), // [TODO] No va solo el año
|
|
27
|
-
resourceType : 'Condition',
|
|
28
|
-
// Por el momento ponemos 'confirmed'
|
|
29
|
-
verificationStatus : {
|
|
30
|
-
coding : [
|
|
31
|
-
{
|
|
32
|
-
system : 'http://terminology.hl7.org//CodeSystem//condition-ver-status',
|
|
33
|
-
code : 'confirmed'
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
},
|
|
37
|
-
code : {
|
|
38
|
-
coding : [
|
|
39
|
-
{
|
|
40
|
-
code : registro.concepto.conceptId,
|
|
41
|
-
system : 'http://snomed.info/sct',
|
|
42
|
-
display : registro.concepto.fsn
|
|
43
|
-
}
|
|
44
|
-
]
|
|
45
|
-
},
|
|
46
|
-
recordedDate : registro.createdAt,
|
|
47
|
-
meta : {
|
|
48
|
-
profile : [
|
|
49
|
-
'http://hl7.org/fhir/uv/ips/StructureDefinition/condition-uv-ips'
|
|
50
|
-
]
|
|
51
|
-
},
|
|
52
|
-
text : {
|
|
53
|
-
status : 'generated',
|
|
54
|
-
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>`
|
|
55
|
-
},
|
|
56
|
-
severity : { // [TODO] Sacar esto porque no lo tenemos todavía. No hay un campo de severidad.
|
|
57
|
-
coding : [
|
|
58
|
-
{
|
|
59
|
-
system : 'http://loinc.org',
|
|
60
|
-
display : 'Moderate',
|
|
61
|
-
code : 'LA6751-7'
|
|
62
|
-
}
|
|
63
|
-
]
|
|
64
|
-
},
|
|
65
|
-
clinicalStatus : {
|
|
66
|
-
coding : [
|
|
67
|
-
{
|
|
68
|
-
system: 'http://terminology.hl7.org/CodeSystem/condition-clinical',
|
|
69
|
-
code: registro.valor.estado // [TODO] Tenemos este dato.
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
system: 'http://terminology.hl7.org/CodeSystem/evolution',
|
|
73
|
-
// code: registro.valor.evolucion.replace('<p>','').replace('</p>','') // [TODO] Tenemos este dato.
|
|
74
|
-
code: registro.valor.evolucion // [TODO] Tenemos este dato.
|
|
75
|
-
}
|
|
76
|
-
]
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
1
|
+
import { makeUrl } from './config';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param registro Registro RUP a transformar a FHIR
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export function encode(patientReference, registro) {
|
|
10
|
+
return {
|
|
11
|
+
id : registro._id,
|
|
12
|
+
category : [
|
|
13
|
+
{
|
|
14
|
+
coding : [
|
|
15
|
+
{
|
|
16
|
+
system : 'http://loinc.org',
|
|
17
|
+
display : 'Problem',
|
|
18
|
+
code : '75326-9'
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
subject : {
|
|
24
|
+
reference : patientReference
|
|
25
|
+
},
|
|
26
|
+
onsetDateTime : registro.createdAt.getFullYear(), // [TODO] No va solo el año
|
|
27
|
+
resourceType : 'Condition',
|
|
28
|
+
// Por el momento ponemos 'confirmed'
|
|
29
|
+
verificationStatus : {
|
|
30
|
+
coding : [
|
|
31
|
+
{
|
|
32
|
+
system : 'http://terminology.hl7.org//CodeSystem//condition-ver-status',
|
|
33
|
+
code : 'confirmed'
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
code : {
|
|
38
|
+
coding : [
|
|
39
|
+
{
|
|
40
|
+
code : registro.concepto.conceptId,
|
|
41
|
+
system : 'http://snomed.info/sct',
|
|
42
|
+
display : registro.concepto.fsn
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
recordedDate : registro.createdAt,
|
|
47
|
+
meta : {
|
|
48
|
+
profile : [
|
|
49
|
+
'http://hl7.org/fhir/uv/ips/StructureDefinition/condition-uv-ips'
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
text : {
|
|
53
|
+
status : 'generated',
|
|
54
|
+
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>`
|
|
55
|
+
},
|
|
56
|
+
severity : { // [TODO] Sacar esto porque no lo tenemos todavía. No hay un campo de severidad.
|
|
57
|
+
coding : [
|
|
58
|
+
{
|
|
59
|
+
system : 'http://loinc.org',
|
|
60
|
+
display : 'Moderate',
|
|
61
|
+
code : 'LA6751-7'
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
clinicalStatus : {
|
|
66
|
+
coding : [
|
|
67
|
+
{
|
|
68
|
+
system: 'http://terminology.hl7.org/CodeSystem/condition-clinical',
|
|
69
|
+
code: registro.valor.estado // [TODO] Tenemos este dato.
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
system: 'http://terminology.hl7.org/CodeSystem/evolution',
|
|
73
|
+
// code: registro.valor.evolucion.replace('<p>','').replace('</p>','') // [TODO] Tenemos este dato.
|
|
74
|
+
code: registro.valor.evolucion // [TODO] Tenemos este dato.
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
package/src/lib/config.test.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { getDominio, makeUrl } from './config';
|
|
2
|
-
|
|
3
|
-
test('Get default domain', () => {
|
|
4
|
-
expect(getDominio()).toBe('andes.gob.ar');
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
test('Get default URL without id', () => {
|
|
8
|
-
expect(makeUrl('patient')).toBe('andes.gob.ar/patient');
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
test('Get default URL with id', () => {
|
|
12
|
-
expect(makeUrl('patient', '123456')).toBe('andes.gob.ar/patient/123456');
|
|
13
|
-
});
|
|
1
|
+
import { getDominio, makeUrl } from './config';
|
|
2
|
+
|
|
3
|
+
test('Get default domain', () => {
|
|
4
|
+
expect(getDominio()).toBe('andes.gob.ar');
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
test('Get default URL without id', () => {
|
|
8
|
+
expect(makeUrl('patient')).toBe('andes.gob.ar/patient');
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('Get default URL with id', () => {
|
|
12
|
+
expect(makeUrl('patient', '123456')).toBe('andes.gob.ar/patient/123456');
|
|
13
|
+
});
|
package/src/lib/config.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
let DOMINIO = 'andes.gob.ar';
|
|
2
|
-
|
|
3
|
-
export function initialize({ dominio }) {
|
|
4
|
-
DOMINIO = dominio;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function getDominio() {
|
|
8
|
-
return DOMINIO;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function makeUrl(resource, id = null) {
|
|
12
|
-
let url = `${DOMINIO}/${resource}`;
|
|
13
|
-
if (id) {
|
|
14
|
-
url += `/${id}`;
|
|
15
|
-
}
|
|
16
|
-
return url;
|
|
17
|
-
}
|
|
1
|
+
let DOMINIO = 'andes.gob.ar';
|
|
2
|
+
|
|
3
|
+
export function initialize({ dominio }) {
|
|
4
|
+
DOMINIO = dominio;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function getDominio() {
|
|
8
|
+
return DOMINIO;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function makeUrl(resource, id = null) {
|
|
12
|
+
let url = `${DOMINIO}/${resource}`;
|
|
13
|
+
if (id) {
|
|
14
|
+
url += `/${id}`;
|
|
15
|
+
}
|
|
16
|
+
return url;
|
|
17
|
+
}
|
package/src/lib/device.test.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { encode } from './device';
|
|
2
|
-
|
|
3
|
-
test('Device type 1', () => {
|
|
4
|
-
expect(encode().id).toBe('device-01');
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
test('Device Name', () => {
|
|
8
|
-
expect(encode().deviceName[0].name).toBe('Sistema de Aplicaciones Neuquinas de Salud (ANDES)');
|
|
9
|
-
});
|
|
1
|
+
import { encode } from './device';
|
|
2
|
+
|
|
3
|
+
test('Device type 1', () => {
|
|
4
|
+
expect(encode().id).toBe('device-01');
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
test('Device Name', () => {
|
|
8
|
+
expect(encode().deviceName[0].name).toBe('Sistema de Aplicaciones Neuquinas de Salud (ANDES)');
|
|
9
|
+
});
|
package/src/lib/device.ts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { makeUrl } from './config';
|
|
2
|
-
|
|
3
|
-
export function encode() {
|
|
4
|
-
/**
|
|
5
|
-
* HARDCODE DEVICE
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
return {
|
|
9
|
-
resourceType: 'Device',
|
|
10
|
-
id: 'device-01',
|
|
11
|
-
identifier: [
|
|
12
|
-
{
|
|
13
|
-
system: makeUrl('Device'),
|
|
14
|
-
value: 'device-01'
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
type: {
|
|
18
|
-
coding: [
|
|
19
|
-
{
|
|
20
|
-
system: 'http://snomed.info/sct',
|
|
21
|
-
code: '462894001',
|
|
22
|
-
display: 'software de aplicación de sistema de información de historias clínicas de pacientes (objeto físico)'
|
|
23
|
-
}
|
|
24
|
-
]
|
|
25
|
-
},
|
|
26
|
-
owner: {
|
|
27
|
-
reference: 'http://argentina.gob.ar/salud/refes/14999912399913'
|
|
28
|
-
},
|
|
29
|
-
deviceName: [
|
|
30
|
-
{
|
|
31
|
-
name: 'Sistema de Aplicaciones Neuquinas de Salud (ANDES)',
|
|
32
|
-
type: 'manufacturer-name'
|
|
33
|
-
}
|
|
34
|
-
]
|
|
35
|
-
};
|
|
36
|
-
}
|
|
1
|
+
import { makeUrl } from './config';
|
|
2
|
+
|
|
3
|
+
export function encode() {
|
|
4
|
+
/**
|
|
5
|
+
* HARDCODE DEVICE
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
return {
|
|
9
|
+
resourceType: 'Device',
|
|
10
|
+
id: 'device-01',
|
|
11
|
+
identifier: [
|
|
12
|
+
{
|
|
13
|
+
system: makeUrl('Device'),
|
|
14
|
+
value: 'device-01'
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
type: {
|
|
18
|
+
coding: [
|
|
19
|
+
{
|
|
20
|
+
system: 'http://snomed.info/sct',
|
|
21
|
+
code: '462894001',
|
|
22
|
+
display: 'software de aplicación de sistema de información de historias clínicas de pacientes (objeto físico)'
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
owner: {
|
|
27
|
+
reference: 'http://argentina.gob.ar/salud/refes/14999912399913'
|
|
28
|
+
},
|
|
29
|
+
deviceName: [
|
|
30
|
+
{
|
|
31
|
+
name: 'Sistema de Aplicaciones Neuquinas de Salud (ANDES)',
|
|
32
|
+
type: 'manufacturer-name'
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
};
|
|
36
|
+
}
|