File tree Expand file tree Collapse file tree 14 files changed +26
-26
lines changed Expand file tree Collapse file tree 14 files changed +26
-26
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ class BaseFHIRExtractor extends Extractor {
19
19
/* eslint-disable class-methods-use-this */
20
20
// Use context to get PatientId by default; common need across almost all extractors
21
21
// NOTE: Async because other extractors that extend this may need to make async lookups in the future
22
- async parametrizeArgsForFHIRModule ( { mrn , context } ) {
23
- const patient = getPatientFromContext ( mrn , context ) ;
22
+ async parametrizeArgsForFHIRModule ( { context } ) {
23
+ const patient = getPatientFromContext ( context ) ;
24
24
return { patient : patient . id } ;
25
25
}
26
26
/* eslint-enable class-methods-use-this */
Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ class FHIRAdverseEventExtractor extends BaseFHIRExtractor {
10
10
}
11
11
12
12
// In addition to default parametrization, add study if specified
13
- async parametrizeArgsForFHIRModule ( { mrn , context } ) {
14
- const paramsWithID = await super . parametrizeArgsForFHIRModule ( { mrn , context } ) ;
13
+ async parametrizeArgsForFHIRModule ( { context } ) {
14
+ const paramsWithID = await super . parametrizeArgsForFHIRModule ( { context } ) ;
15
15
// The patient is referenced in the 'subject' field of an AdverseEvent
16
16
paramsWithID . subject = paramsWithID . patient ;
17
17
delete paramsWithID . patient ;
Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ class FHIRAllergyIntoleranceExtractor extends BaseFHIRExtractor {
10
10
}
11
11
12
12
// In addition to default parametrization, add clinical status
13
- async parametrizeArgsForFHIRModule ( { mrn , context } ) {
14
- const paramsWithID = await super . parametrizeArgsForFHIRModule ( { mrn , context } ) ;
13
+ async parametrizeArgsForFHIRModule ( { context } ) {
14
+ const paramsWithID = await super . parametrizeArgsForFHIRModule ( { context } ) ;
15
15
return {
16
16
...paramsWithID ,
17
17
'clinical-status' : this . clinicalStatus ,
Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ class FHIRConditionExtractor extends BaseFHIRExtractor {
10
10
}
11
11
12
12
// In addition to default parametrization, add category
13
- async parametrizeArgsForFHIRModule ( { mrn , context } ) {
14
- const paramsWithID = await super . parametrizeArgsForFHIRModule ( { mrn , context } ) ;
13
+ async parametrizeArgsForFHIRModule ( { context } ) {
14
+ const paramsWithID = await super . parametrizeArgsForFHIRModule ( { context } ) ;
15
15
return {
16
16
...paramsWithID ,
17
17
category : this . category ,
Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ class FHIRMedicationRequestExtractor extends BaseFHIRExtractor {
10
10
}
11
11
12
12
// In addition to default parametrization, add status if specified
13
- async parametrizeArgsForFHIRModule ( { mrn , context } ) {
14
- const paramsWithID = await super . parametrizeArgsForFHIRModule ( { mrn , context } ) ;
13
+ async parametrizeArgsForFHIRModule ( { context } ) {
14
+ const paramsWithID = await super . parametrizeArgsForFHIRModule ( { context } ) ;
15
15
// Only add status to parameters if it has been specified
16
16
return {
17
17
...paramsWithID ,
Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ class FHIRObservationExtractor extends BaseFHIRExtractor {
10
10
}
11
11
12
12
// In addition to default parametrization, add category
13
- async parametrizeArgsForFHIRModule ( { mrn , context } ) {
14
- const paramsWithID = await super . parametrizeArgsForFHIRModule ( { mrn , context } ) ;
13
+ async parametrizeArgsForFHIRModule ( { context } ) {
14
+ const paramsWithID = await super . parametrizeArgsForFHIRModule ( { context } ) ;
15
15
return {
16
16
...paramsWithID ,
17
17
category : this . category ,
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ const { getBundleEntriesByResourceType, getBundleResourcesByType } = require('./
7
7
* @param {Object } context - Context object consisting of a FHIR Bundle
8
8
* @return {Object } The first Patient resource found in the bundle
9
9
*/
10
- function getPatientFromContext ( mrn , context ) {
10
+ function getPatientFromContext ( context ) {
11
11
logger . debug ( 'Getting patient from context' ) ;
12
12
const patientResourceInContext = getBundleResourcesByType ( context , 'Patient' , { } , true ) ;
13
13
if ( ! patientResourceInContext ) {
Original file line number Diff line number Diff line change @@ -43,20 +43,20 @@ describe('BaseFhirExtractor', () => {
43
43
44
44
test ( 'parametrizeArgsForFHIRModule parses data off of context if available' , async ( ) => {
45
45
baseFHIRModuleSearchSpy . mockClear ( ) ;
46
- const paramsBasedOnContext = await baseFHIRExtractor . parametrizeArgsForFHIRModule ( { mrn : MOCK_PATIENT_MRN , context : MOCK_CONTEXT } ) ;
46
+ const paramsBasedOnContext = await baseFHIRExtractor . parametrizeArgsForFHIRModule ( { context : MOCK_CONTEXT } ) ;
47
47
expect ( baseFHIRModuleSearchSpy ) . not . toHaveBeenCalled ( ) ;
48
48
expect ( paramsBasedOnContext ) . toHaveProperty ( 'patient' ) ;
49
49
expect ( paramsBasedOnContext . patient ) . toEqual ( MOCK_CONTEXT . entry [ 0 ] . resource . id ) ;
50
50
} ) ;
51
51
52
52
test ( 'parametrizeArgsForFHIRModule throws an error if context has no relevant ID' , async ( ) => {
53
53
baseFHIRModuleSearchSpy . mockClear ( ) ;
54
- await expect ( baseFHIRExtractor . parametrizeArgsForFHIRModule ( { mrn : MOCK_PATIENT_MRN , context : { } } ) ) . rejects . toThrow ( ) ;
54
+ await expect ( baseFHIRExtractor . parametrizeArgsForFHIRModule ( { context : { } } ) ) . rejects . toThrow ( ) ;
55
55
expect ( baseFHIRModuleSearchSpy ) . not . toHaveBeenCalled ( ) ;
56
56
} ) ;
57
57
58
58
test ( 'get should return a condition resource' , async ( ) => {
59
- const data = await baseFHIRExtractor . get ( { mrn : MOCK_PATIENT_MRN , context : MOCK_CONTEXT } ) ;
59
+ const data = await baseFHIRExtractor . get ( { context : MOCK_CONTEXT } ) ;
60
60
expect ( data . resourceType ) . toEqual ( 'Bundle' ) ;
61
61
expect ( data . entry ) . toBeDefined ( ) ;
62
62
expect ( data . entry . length ) . toBeGreaterThan ( 0 ) ;
Original file line number Diff line number Diff line change @@ -36,19 +36,19 @@ describe('FHIRAdverseEventExtractor', () => {
36
36
37
37
describe ( 'parametrizeArgsForFHIRModule' , ( ) => {
38
38
test ( 'should not add study when not set to param values' , async ( ) => {
39
- const params = await extractor . parametrizeArgsForFHIRModule ( { mrn : MOCK_MRN , context : MOCK_CONTEXT } ) ;
39
+ const params = await extractor . parametrizeArgsForFHIRModule ( { context : MOCK_CONTEXT } ) ;
40
40
expect ( params ) . not . toHaveProperty ( 'study' ) ;
41
41
} ) ;
42
42
43
43
describe ( 'pass in optional study parameter' , ( ) => {
44
44
test ( 'should add study when set to param values' , async ( ) => {
45
- const params = await extractorWithStudy . parametrizeArgsForFHIRModule ( { mrn : MOCK_MRN , context : MOCK_CONTEXT } ) ;
45
+ const params = await extractorWithStudy . parametrizeArgsForFHIRModule ( { context : MOCK_CONTEXT } ) ;
46
46
expect ( params ) . toHaveProperty ( 'study' ) ;
47
47
expect ( params . study ) . toEqual ( extractorWithStudy . study ) ;
48
48
} ) ;
49
49
50
50
test ( 'should delete patient after its value is moved to subject' , async ( ) => {
51
- const params = await extractorWithStudy . parametrizeArgsForFHIRModule ( { mrn : MOCK_MRN , context : MOCK_CONTEXT } ) ;
51
+ const params = await extractorWithStudy . parametrizeArgsForFHIRModule ( { context : MOCK_CONTEXT } ) ;
52
52
expect ( params ) . not . toHaveProperty ( 'patient' ) ;
53
53
} ) ;
54
54
} ) ;
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ describe('FHIRAllergyIntoleranceExtractor', () => {
37
37
38
38
describe ( 'parametrizeArgsForFHIRModule' , ( ) => {
39
39
test ( 'should add category to param values' , async ( ) => {
40
- const params = await extractor . parametrizeArgsForFHIRModule ( { mrn : MOCK_MRN , context : MOCK_CONTEXT } ) ;
40
+ const params = await extractor . parametrizeArgsForFHIRModule ( { context : MOCK_CONTEXT } ) ;
41
41
expect ( params ) . toHaveProperty ( 'clinical-status' ) ;
42
42
expect ( params [ 'clinical-status' ] ) . toEqual ( baseClinicalStatus ) ;
43
43
} ) ;
You can’t perform that action at this time.
0 commit comments