@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.
Files changed (94) hide show
  1. package/.circleci/config.yml +71 -68
  2. package/.editorconfig +13 -13
  3. package/.env.example +2 -0
  4. package/.github/labeler.yml +10 -10
  5. package/.github/pull_request_template.md +28 -28
  6. package/.github/workflows/build_test.yml +14 -14
  7. package/.github/workflows/has_conflicts.yml +13 -13
  8. package/.vscode/settings.json +2 -0
  9. package/CHANGELOG.md +312 -291
  10. package/LICENSE +674 -674
  11. package/README.md +2 -2
  12. package/coverage/clover.xml +198 -0
  13. package/coverage/coverage-final.json +5 -0
  14. package/coverage/lcov-report/base.css +224 -0
  15. package/coverage/lcov-report/block-navigation.js +87 -0
  16. package/coverage/lcov-report/config.ts.html +136 -0
  17. package/coverage/lcov-report/device.ts.html +193 -0
  18. package/coverage/lcov-report/favicon.png +0 -0
  19. package/coverage/lcov-report/helpers/index.html +116 -0
  20. package/coverage/lcov-report/helpers/patientFactory.ts.html +124 -0
  21. package/coverage/lcov-report/index.html +131 -0
  22. package/coverage/lcov-report/lib/config.ts.html +136 -0
  23. package/coverage/lcov-report/lib/device.ts.html +193 -0
  24. package/coverage/lcov-report/lib/index.html +146 -0
  25. package/coverage/lcov-report/lib/patient.ts.html +1267 -0
  26. package/coverage/lcov-report/patient.ts.html +1207 -0
  27. package/coverage/lcov-report/prettify.css +1 -0
  28. package/coverage/lcov-report/prettify.js +2 -0
  29. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  30. package/coverage/lcov-report/sorter.js +210 -0
  31. package/coverage/lcov.info +410 -0
  32. package/dist/index.js +51 -32
  33. package/dist/index.js.map +1 -1
  34. package/dist/src/data/patient.json +191 -185
  35. package/dist/src/helpers/patientFactory.js +31 -0
  36. package/dist/src/helpers/patientFactory.js.map +1 -0
  37. package/dist/src/lib/allergyIntolerance.js +39 -39
  38. package/dist/src/lib/allergyIntolerance.js.map +1 -1
  39. package/dist/src/lib/bundle.js +25 -22
  40. package/dist/src/lib/bundle.js.map +1 -1
  41. package/dist/src/lib/composition.js +151 -150
  42. package/dist/src/lib/composition.js.map +1 -1
  43. package/dist/src/lib/condition.js +79 -79
  44. package/dist/src/lib/condition.js.map +1 -1
  45. package/dist/src/lib/config.js +20 -22
  46. package/dist/src/lib/config.js.map +1 -1
  47. package/dist/src/lib/config.test.js +12 -12
  48. package/dist/src/lib/config.test.js.map +1 -1
  49. package/dist/src/lib/device.js +38 -38
  50. package/dist/src/lib/device.js.map +1 -1
  51. package/dist/src/lib/device.test.js +9 -9
  52. package/dist/src/lib/device.test.js.map +1 -1
  53. package/dist/src/lib/document-reference.js +106 -103
  54. package/dist/src/lib/document-reference.js.map +1 -1
  55. package/dist/src/lib/immunization.js +67 -67
  56. package/dist/src/lib/medication.js +64 -64
  57. package/dist/src/lib/medication.js.map +1 -1
  58. package/dist/src/lib/medicationRequest.js +102 -99
  59. package/dist/src/lib/medicationRequest.js.map +1 -1
  60. package/dist/src/lib/medicationStatement.js +55 -55
  61. package/dist/src/lib/medicationStatement.js.map +1 -1
  62. package/dist/src/lib/organization.js +90 -90
  63. package/dist/src/lib/organization.js.map +1 -1
  64. package/dist/src/lib/patient.js +378 -360
  65. package/dist/src/lib/patient.js.map +1 -1
  66. package/dist/src/lib/patient.test.js +78 -39
  67. package/dist/src/lib/patient.test.js.map +1 -1
  68. package/dist/src/lib/practitioner.js +160 -160
  69. package/dist/src/lib/practitioner.js.map +1 -1
  70. package/index.ts +31 -31
  71. package/jest.config.js +11 -11
  72. package/package.json +45 -54
  73. package/release.config.js +74 -0
  74. package/src/data/patient.json +190 -184
  75. package/src/helpers/patientFactory.ts +13 -0
  76. package/src/lib/allergyIntolerance.ts +36 -36
  77. package/src/lib/bundle.ts +19 -19
  78. package/src/lib/composition.ts +153 -153
  79. package/src/lib/condition.ts +80 -80
  80. package/src/lib/config.test.ts +13 -13
  81. package/src/lib/config.ts +17 -17
  82. package/src/lib/device.test.ts +9 -9
  83. package/src/lib/device.ts +36 -36
  84. package/src/lib/document-reference.ts +102 -102
  85. package/src/lib/immunization.ts +64 -64
  86. package/src/lib/medication.ts +61 -61
  87. package/src/lib/medicationRequest.ts +100 -100
  88. package/src/lib/medicationStatement.ts +52 -52
  89. package/src/lib/organization.ts +89 -89
  90. package/src/lib/patient.test.ts +62 -38
  91. package/src/lib/patient.ts +394 -374
  92. package/src/lib/practitioner.ts +157 -157
  93. package/tsconfig.test.json +17 -17
  94. package/tslint.json +138 -138
@@ -1,102 +1,102 @@
1
- import * as moment from 'moment';
2
- import { makeUrl } from './config';
3
-
4
- export function encode(ID, author, organization, patient, binaryURL) {
5
- return {
6
- resourceType: 'DocumentReference',
7
- id: ID,
8
- meta: {
9
- lastUpdated: moment().format()
10
- },
11
- contained: [
12
- {
13
- resourceType: 'Practitioner',
14
- id: author.id,
15
- identifier: [{
16
- system: makeUrl('Device'),
17
- value: author.id
18
- }]
19
- },
20
- {
21
- resourceType: 'Organization',
22
- id: organization.id,
23
- identifier: [{
24
- system: makeUrl('Organization'),
25
- value: organization.id
26
- }]
27
- }
28
- ],
29
- custodian: {
30
- identifier: {
31
- system: 'https://federador.msal.gob.ar/uri',
32
- value: makeUrl('Organization', organization.id)
33
- }
34
- },
35
- masterIdentifier: {
36
- system: makeUrl('documentos_versiones'),
37
- value: ID
38
- },
39
- identifier: [{
40
- system: makeUrl('documentos'),
41
- value: ID
42
- }],
43
- status: 'current',
44
- type: {
45
- coding: [
46
- {
47
- system: 'http://loinc.org',
48
- code: '60591-5'
49
- }
50
- ]
51
- },
52
- subject: {
53
- reference: makeUrl('Patient', patient.id),
54
- },
55
- // author: [
56
- // {
57
- // reference: makeUrl('Device', author.id),
58
- // },
59
- // {
60
- // reference: makeUrl('Organization', organization.id),
61
- // }
62
- // ],
63
- securityLabel: [{
64
- coding: [{
65
- system: 'https://saludddigital.gob.ar/nivelesconfidencialidad',
66
- code: 'N'
67
- }]
68
- }],
69
- content: [{
70
- attachment: {
71
- id: 'PRINCIPAL',
72
- url: binaryURL
73
- }
74
- }],
75
- context: {
76
- event: [{
77
- coding: [{
78
- system: 'https://saludddigital.gob.ar/tiposevento',
79
- code: 'CIR'
80
- }]
81
- }],
82
- // period: {
83
- // start: '2019-04-03T10:30:00+03:00',
84
- // end: '2019-04-05T10:30:00+03:00'
85
-
86
- // },
87
- facilityType: {
88
- coding: [{
89
- system: 'https://saludddigital.gob.ar/tipoprestador',
90
- code: 'INI'
91
- }]
92
- },
93
- practiceSetting: {
94
- coding: [{
95
- system: 'https://saludddigital.gob.ar/especialidades',
96
- code: 'CLM'
97
- }]
98
- }
99
- }
100
-
101
- };
102
- }
1
+ import moment from 'moment';
2
+ import { makeUrl } from './config';
3
+
4
+ export function encode(ID, author, organization, patient, binaryURL) {
5
+ return {
6
+ resourceType: 'DocumentReference',
7
+ id: ID,
8
+ meta: {
9
+ lastUpdated: moment().format()
10
+ },
11
+ contained: [
12
+ {
13
+ resourceType: 'Practitioner',
14
+ id: author.id,
15
+ identifier: [{
16
+ system: makeUrl('Device'),
17
+ value: author.id
18
+ }]
19
+ },
20
+ {
21
+ resourceType: 'Organization',
22
+ id: organization.id,
23
+ identifier: [{
24
+ system: makeUrl('Organization'),
25
+ value: organization.id
26
+ }]
27
+ }
28
+ ],
29
+ custodian: {
30
+ identifier: {
31
+ system: 'https://federador.msal.gob.ar/uri',
32
+ value: makeUrl('Organization', organization.id)
33
+ }
34
+ },
35
+ masterIdentifier: {
36
+ system: makeUrl('documentos_versiones'),
37
+ value: ID
38
+ },
39
+ identifier: [{
40
+ system: makeUrl('documentos'),
41
+ value: ID
42
+ }],
43
+ status: 'current',
44
+ type: {
45
+ coding: [
46
+ {
47
+ system: 'http://loinc.org',
48
+ code: '60591-5'
49
+ }
50
+ ]
51
+ },
52
+ subject: {
53
+ reference: makeUrl('Patient', patient.id),
54
+ },
55
+ // author: [
56
+ // {
57
+ // reference: makeUrl('Device', author.id),
58
+ // },
59
+ // {
60
+ // reference: makeUrl('Organization', organization.id),
61
+ // }
62
+ // ],
63
+ securityLabel: [{
64
+ coding: [{
65
+ system: 'https://saludddigital.gob.ar/nivelesconfidencialidad',
66
+ code: 'N'
67
+ }]
68
+ }],
69
+ content: [{
70
+ attachment: {
71
+ id: 'PRINCIPAL',
72
+ url: binaryURL
73
+ }
74
+ }],
75
+ context: {
76
+ event: [{
77
+ coding: [{
78
+ system: 'https://saludddigital.gob.ar/tiposevento',
79
+ code: 'CIR'
80
+ }]
81
+ }],
82
+ // period: {
83
+ // start: '2019-04-03T10:30:00+03:00',
84
+ // end: '2019-04-05T10:30:00+03:00'
85
+
86
+ // },
87
+ facilityType: {
88
+ coding: [{
89
+ system: 'https://saludddigital.gob.ar/tipoprestador',
90
+ code: 'INI'
91
+ }]
92
+ },
93
+ practiceSetting: {
94
+ coding: [{
95
+ system: 'https://saludddigital.gob.ar/especialidades',
96
+ code: 'CLM'
97
+ }]
98
+ }
99
+ }
100
+
101
+ };
102
+ }
@@ -1,64 +1,64 @@
1
-
2
- /**
3
- * Encode de Vacunas Nomivac from ANDES to FHIR
4
- * @param {} nomivac
5
- * [ASK] El code de extension puede ir en vaccineCode?
6
- * [ASk] Location no se sabe. Solo esta el texto
7
- */
8
- export function encode(patientReference, nomivac) {
9
- return {
10
- resourceType: 'Immunization',
11
- id: nomivac.idvacuna,
12
- extension: [
13
- {
14
- url: 'http://sisa/fhir/esquema',
15
- valueCoding: {
16
- system: 'http://argentina.gob.ar/salud/NOMIVAC-esquemas',
17
- code: '0', // [TODO] Ver que code ponemos acá
18
- display: nomivac.vacuna
19
- }
20
- },
21
- {
22
- url: 'http://sisa/fhir/condicionAplicacion',
23
- valueCoding: {
24
- system: 'http://argentina.gob.ar/salud/NOMIVAC-condicion',
25
- code: '17',
26
- display: 'Personal de Salud'
27
- }
28
- }
29
- ],
30
- status: 'completed',
31
- notGiven: false,
32
- vaccineCode: {
33
- coding: [
34
- {
35
- system: 'https://snomed.info/sct/11000221109/id/228100022110',
36
- code: nomivac.idvacuna,
37
- display: nomivac.vacuna
38
- }
39
- ]
40
- },
41
- patient: {
42
- reference: patientReference
43
- },
44
- date: nomivac.fechaAplicacion,
45
- primarySource: false,
46
- location: {
47
- reference: 'http://argentina.gob.ar/salud/refes/14999912399913'
48
- },
49
- // lotNumber: null,
50
- vaccinationProtocol: [
51
- {
52
- doseSequence: 1,
53
- doseStatus: {
54
- coding: [
55
- {
56
- system: 'http://hl7.org/fhir/vaccination-protocol-dose-status',
57
- code: nomivac.dosis
58
- }
59
- ]
60
- }
61
- }
62
- ]
63
- };
64
- }
1
+
2
+ /**
3
+ * Encode de Vacunas Nomivac from ANDES to FHIR
4
+ * @param {} nomivac
5
+ * [ASK] El code de extension puede ir en vaccineCode?
6
+ * [ASk] Location no se sabe. Solo esta el texto
7
+ */
8
+ export function encode(patientReference, nomivac) {
9
+ return {
10
+ resourceType: 'Immunization',
11
+ id: nomivac.idvacuna,
12
+ extension: [
13
+ {
14
+ url: 'http://sisa/fhir/esquema',
15
+ valueCoding: {
16
+ system: 'http://argentina.gob.ar/salud/NOMIVAC-esquemas',
17
+ code: '0', // [TODO] Ver que code ponemos acá
18
+ display: nomivac.vacuna
19
+ }
20
+ },
21
+ {
22
+ url: 'http://sisa/fhir/condicionAplicacion',
23
+ valueCoding: {
24
+ system: 'http://argentina.gob.ar/salud/NOMIVAC-condicion',
25
+ code: '17',
26
+ display: 'Personal de Salud'
27
+ }
28
+ }
29
+ ],
30
+ status: 'completed',
31
+ notGiven: false,
32
+ vaccineCode: {
33
+ coding: [
34
+ {
35
+ system: 'https://snomed.info/sct/11000221109/id/228100022110',
36
+ code: nomivac.idvacuna,
37
+ display: nomivac.vacuna
38
+ }
39
+ ]
40
+ },
41
+ patient: {
42
+ reference: patientReference
43
+ },
44
+ date: nomivac.fechaAplicacion,
45
+ primarySource: false,
46
+ location: {
47
+ reference: 'http://argentina.gob.ar/salud/refes/14999912399913'
48
+ },
49
+ // lotNumber: null,
50
+ vaccinationProtocol: [
51
+ {
52
+ doseSequence: 1,
53
+ doseStatus: {
54
+ coding: [
55
+ {
56
+ system: 'http://hl7.org/fhir/vaccination-protocol-dose-status',
57
+ code: nomivac.dosis
58
+ }
59
+ ]
60
+ }
61
+ }
62
+ ]
63
+ };
64
+ }
@@ -1,61 +1,61 @@
1
- /**
2
- * Encode de Medicamentos from ANDES to FHIR
3
- * @param {} medication
4
- */
5
- export function encode(medication) {
6
- // Falta completar con más detalle
7
- return {
8
- resourceType: 'Medication',
9
- id: medication.conceptId, // Es el id del medicamento, en este caso usamos el código de snomed (ver si sería correcto)
10
- meta: {
11
- profile: [
12
- 'http://hl7.org/fhir/uv/ips/StructureDefinition/medication-ips'
13
- ]
14
- },
15
- identifier: medication.moduleId, // Acá va el serial number del medicamento.
16
- code: {
17
- coding: [
18
- {
19
- system: 'http://snomed.info/sct',
20
- display: medication.term,
21
- code: medication.conceptId
22
- }
23
- ],
24
- text: medication.fsn
25
- },
26
- status: medication.active === true ? 'active' : 'inactive',
27
- // manufacturer: null,
28
- // form: null,
29
- // amount: null,
30
- // ingredient: null,
31
- // ingredient: [ // ejemplo
32
- // {
33
- // code: {
34
- // coding: [
35
- // {
36
- // system: "http://snomed.info/sct",
37
- // display: "salbutamol (sustancia)",
38
- // code: "372897005"
39
- // }
40
- // ]
41
- // },
42
- // isActive: true,
43
- // strength: {
44
- // numerator: {
45
- // value: 200,
46
- // unit: "mcg"
47
- // },
48
- // denominator: {
49
- // value: 1,
50
- // unit: "disparo"
51
- // }
52
- // }
53
- // }
54
- // ],
55
- text: {
56
- status: 'generated',
57
- div: `<div xmlns="http://www.w3.org/1999/xhtml"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: Medicacion</p><p><b>meta</b>: </p><p><b>text</b>: ${medication.pt.term}</p></div>`
58
- }
59
- };
60
- }
61
-
1
+ /**
2
+ * Encode de Medicamentos from ANDES to FHIR
3
+ * @param {} medication
4
+ */
5
+ export function encode(medication) {
6
+ // Falta completar con más detalle
7
+ return {
8
+ resourceType: 'Medication',
9
+ id: medication.conceptId, // Es el id del medicamento, en este caso usamos el código de snomed (ver si sería correcto)
10
+ meta: {
11
+ profile: [
12
+ 'http://hl7.org/fhir/uv/ips/StructureDefinition/medication-ips'
13
+ ]
14
+ },
15
+ identifier: medication.moduleId, // Acá va el serial number del medicamento.
16
+ code: {
17
+ coding: [
18
+ {
19
+ system: 'http://snomed.info/sct',
20
+ display: medication.term,
21
+ code: medication.conceptId
22
+ }
23
+ ],
24
+ text: medication.fsn
25
+ },
26
+ status: medication.active === true ? 'active' : 'inactive',
27
+ // manufacturer: null,
28
+ // form: null,
29
+ // amount: null,
30
+ // ingredient: null,
31
+ // ingredient: [ // ejemplo
32
+ // {
33
+ // code: {
34
+ // coding: [
35
+ // {
36
+ // system: "http://snomed.info/sct",
37
+ // display: "salbutamol (sustancia)",
38
+ // code: "372897005"
39
+ // }
40
+ // ]
41
+ // },
42
+ // isActive: true,
43
+ // strength: {
44
+ // numerator: {
45
+ // value: 200,
46
+ // unit: "mcg"
47
+ // },
48
+ // denominator: {
49
+ // value: 1,
50
+ // unit: "disparo"
51
+ // }
52
+ // }
53
+ // }
54
+ // ],
55
+ text: {
56
+ status: 'generated',
57
+ div: `<div xmlns="http://www.w3.org/1999/xhtml"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: Medicacion</p><p><b>meta</b>: </p><p><b>text</b>: ${medication.pt.term}</p></div>`
58
+ }
59
+ };
60
+ }
61
+
@@ -1,100 +1,100 @@
1
- /**
2
- * Encode medicationRequest from ANDES to FHIR
3
- * @param {} medicationRequest
4
- */
5
-
6
- import * as moment from 'moment';
7
-
8
- // Muy incompleto hay que mejorarlo mucho todavía
9
-
10
- export function encode(patientReference, practitionerReference, medicationFHIR, data) {
11
- return {
12
- resourceType: 'MedicationRequest',
13
- id: data.registro._id, // id de la prescripción completa
14
- text: {
15
- status: 'generated',
16
- // div: `<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: Medicacion </p><p><b>meta</b>: </p><p><b>text</b>: ${'DEFINIR'}</p></div>`
17
- },
18
- contained: [
19
- medicationFHIR
20
- ],
21
- identifier: [ // Ver bien que sería el array de identifiers
22
- {
23
- use: 'official',
24
- system: 'http://app.andes.gob.ar/prescriptions', // Es el id de la prestación completa
25
- value: data.registro.id
26
- }
27
- ],
28
- // active | on-hold | cancelled | completed | entered-in-error | stopped | draft | unknown
29
- status: (data.prestacion.estadoActual.tipo === 'validada') ? 'active' : 'on-hold', // Lo mejor sería enviar el estado de la receta desde la prestación
30
- // intent: proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option
31
- intent: 'order', // Ya que no tenemos este dato, ver como sería en caso de recetas prolongadas si puede ir como plan
32
- // category: {
33
- // coding: [
34
- // {
35
- // system: '',
36
- // display: '',
37
- // code: ''
38
- // }
39
- // ]
40
- // },
41
- // priority: routine | urgent | asap | stat
42
- priority: 'routine',
43
- doNotPerform: false,
44
- // Se puede usar medicationCodeableConcept o medicationReference, vamos a usar esta última.
45
- medicationReference: {
46
- reference: medicationFHIR.id,
47
- display: medicationFHIR.code.text
48
- },
49
- subject: {
50
- reference: patientReference // podría ser una reference a un group también
51
- },
52
- // encounter: Por ahora lo dejo pendiente. Podría ponerse una referencia a otra prestación o al informe del encuentro.
53
- authoredOn: moment(data.registro.createdAt).format('YYYY-MM-DD'),
54
- // requester & performer: pueden ser Reference(Practitioner|PractitionerRole|Organization|Patient|Device|RelatedPerson|CareTeam)
55
- // por el momento vamos a tomar al profesional porque no tenemos otra info en la prestación
56
- requester: {
57
- reference: practitionerReference
58
- },
59
- // performer: {
60
- // reference: practitionerReference
61
- // },
62
- // performerType: Lo dejamos pendiente
63
- // recorder: {
64
- // reference: practitionerReference
65
- // },
66
- // instantiatesCanonical: null, // ["<canonical>"], // Instantiates FHIR protocol or definition
67
- // instantiatesUri: null, // ["<uri>"], // Instantiates external protocol or definition
68
- basedOn: data.prestacion.id, // Vamos a usar el id de la prestación donde esta todo [{ Reference(CarePlan|MedicationRequest|ServiceRequest| ImmunizationRecommendation) }], // What request fulfills
69
- // groupIdentifier: null, // { Identifier }, // Composite request this is part of
70
- // courseOfTherapyType: null, // { CodeableConcept }, // Overall pattern of medication administration
71
- // insurance: null, // [{ Reference(Coverage|ClaimResponse) }], // Associated insurance coverage
72
- note: null, // De donde sacamos las notas? [{ Annotation }], // Information about the prescription
73
- dosageInstruction: null, // [{ Dosage }], // How the medication should be taken
74
- // Medication supply authorization: Hay que ver esta parte
75
- /*
76
- dispenseRequest: { // Medication supply authorization
77
- initialFill: { // First fill details
78
- quantity: { Quantity(SimpleQuantity) }, // First fill quantity
79
- duration: { Duration } // First fill duration
80
- },
81
- dispenseInterval: { Duration }, // Minimum period of time between dispenses
82
- validityPeriod: { Period }, // Time period supply is authorized for
83
- numberOfRepeatsAllowed: "<unsignedInt>", // Number of refills authorized
84
- quantity: { Quantity(SimpleQuantity) }, // Amount of medication to supply per dispense
85
- expectedSupplyDuration: { Duration }, // Number of days supply per dispense
86
- performer: { Reference(Organization) } // Intended dispenser
87
- },
88
- */
89
- substitution: { // Any restrictions on medication substitution
90
- // allowed[x]: Whether substitution is allowed or not. One of these 2:
91
- allowedBoolean: true, // <boolean>,
92
- // "allowedCodeableConcept" : { CodeableConcept },
93
- reason: null // { CodeableConcept } // Why should (not) substitution be made
94
- },
95
- priorPrescription: null, // { Reference(MedicationRequest) }, // An order/prescription that is being replaced
96
- detectedIssue: null, // [{ Reference(DetectedIssue) }], // Clinical Issue with action
97
- eventHistory: null// [{ Reference(Provenance) }]
98
- };
99
- }
100
-
1
+ /**
2
+ * Encode medicationRequest from ANDES to FHIR
3
+ * @param {} medicationRequest
4
+ */
5
+
6
+ import moment from 'moment';
7
+
8
+ // Muy incompleto hay que mejorarlo mucho todavía
9
+
10
+ export function encode(patientReference, practitionerReference, medicationFHIR, data) {
11
+ return {
12
+ resourceType: 'MedicationRequest',
13
+ id: data.registro._id, // id de la prescripción completa
14
+ text: {
15
+ status: 'generated',
16
+ // div: `<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative with Details</b></p><p><b>id</b>: Medicacion </p><p><b>meta</b>: </p><p><b>text</b>: ${'DEFINIR'}</p></div>`
17
+ },
18
+ contained: [
19
+ medicationFHIR
20
+ ],
21
+ identifier: [ // Ver bien que sería el array de identifiers
22
+ {
23
+ use: 'official',
24
+ system: 'http://app.andes.gob.ar/prescriptions', // Es el id de la prestación completa
25
+ value: data.registro.id
26
+ }
27
+ ],
28
+ // active | on-hold | cancelled | completed | entered-in-error | stopped | draft | unknown
29
+ status: (data.prestacion.estadoActual.tipo === 'validada') ? 'active' : 'on-hold', // Lo mejor sería enviar el estado de la receta desde la prestación
30
+ // intent: proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option
31
+ intent: 'order', // Ya que no tenemos este dato, ver como sería en caso de recetas prolongadas si puede ir como plan
32
+ // category: {
33
+ // coding: [
34
+ // {
35
+ // system: '',
36
+ // display: '',
37
+ // code: ''
38
+ // }
39
+ // ]
40
+ // },
41
+ // priority: routine | urgent | asap | stat
42
+ priority: 'routine',
43
+ doNotPerform: false,
44
+ // Se puede usar medicationCodeableConcept o medicationReference, vamos a usar esta última.
45
+ medicationReference: {
46
+ reference: medicationFHIR.id,
47
+ display: medicationFHIR.code.text
48
+ },
49
+ subject: {
50
+ reference: patientReference // podría ser una reference a un group también
51
+ },
52
+ // encounter: Por ahora lo dejo pendiente. Podría ponerse una referencia a otra prestación o al informe del encuentro.
53
+ authoredOn: moment(data.registro.createdAt).format('YYYY-MM-DD'),
54
+ // requester & performer: pueden ser Reference(Practitioner|PractitionerRole|Organization|Patient|Device|RelatedPerson|CareTeam)
55
+ // por el momento vamos a tomar al profesional porque no tenemos otra info en la prestación
56
+ requester: {
57
+ reference: practitionerReference
58
+ },
59
+ // performer: {
60
+ // reference: practitionerReference
61
+ // },
62
+ // performerType: Lo dejamos pendiente
63
+ // recorder: {
64
+ // reference: practitionerReference
65
+ // },
66
+ // instantiatesCanonical: null, // ["<canonical>"], // Instantiates FHIR protocol or definition
67
+ // instantiatesUri: null, // ["<uri>"], // Instantiates external protocol or definition
68
+ basedOn: data.prestacion.id, // Vamos a usar el id de la prestación donde esta todo [{ Reference(CarePlan|MedicationRequest|ServiceRequest| ImmunizationRecommendation) }], // What request fulfills
69
+ // groupIdentifier: null, // { Identifier }, // Composite request this is part of
70
+ // courseOfTherapyType: null, // { CodeableConcept }, // Overall pattern of medication administration
71
+ // insurance: null, // [{ Reference(Coverage|ClaimResponse) }], // Associated insurance coverage
72
+ note: null, // De donde sacamos las notas? [{ Annotation }], // Information about the prescription
73
+ dosageInstruction: null, // [{ Dosage }], // How the medication should be taken
74
+ // Medication supply authorization: Hay que ver esta parte
75
+ /*
76
+ dispenseRequest: { // Medication supply authorization
77
+ initialFill: { // First fill details
78
+ quantity: { Quantity(SimpleQuantity) }, // First fill quantity
79
+ duration: { Duration } // First fill duration
80
+ },
81
+ dispenseInterval: { Duration }, // Minimum period of time between dispenses
82
+ validityPeriod: { Period }, // Time period supply is authorized for
83
+ numberOfRepeatsAllowed: "<unsignedInt>", // Number of refills authorized
84
+ quantity: { Quantity(SimpleQuantity) }, // Amount of medication to supply per dispense
85
+ expectedSupplyDuration: { Duration }, // Number of days supply per dispense
86
+ performer: { Reference(Organization) } // Intended dispenser
87
+ },
88
+ */
89
+ substitution: { // Any restrictions on medication substitution
90
+ // allowed[x]: Whether substitution is allowed or not. One of these 2:
91
+ allowedBoolean: true, // <boolean>,
92
+ // "allowedCodeableConcept" : { CodeableConcept },
93
+ reason: null // { CodeableConcept } // Why should (not) substitution be made
94
+ },
95
+ priorPrescription: null, // { Reference(MedicationRequest) }, // An order/prescription that is being replaced
96
+ detectedIssue: null, // [{ Reference(DetectedIssue) }], // Clinical Issue with action
97
+ eventHistory: null// [{ Reference(Provenance) }]
98
+ };
99
+ }
100
+