-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #202 from mcode/add_search_parameters
Add search parameters
- Loading branch information
Showing
20 changed files
with
53 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,14 @@ | ||
const rewire = require('rewire'); | ||
const { FHIRAllergyIntoleranceExtractor } = require('../../src/extractors/FHIRAllergyIntoleranceExtractor.js'); | ||
|
||
const FHIRAllergyIntoleranceExtractorRewired = rewire('../../src/extractors/FHIRAllergyIntoleranceExtractor.js'); | ||
const MOCK_URL = 'http://example.com'; | ||
const MOCK_HEADERS = {}; | ||
const MOCK_MRN = '123456789'; | ||
const MOCK_CLINICAL_STATUS = 'status1,status2'; | ||
const MOCK_CONTEXT = { | ||
resourceType: 'Bundle', | ||
entry: [ | ||
{ | ||
fullUrl: 'context-url', | ||
resource: { resourceType: 'Patient', id: MOCK_MRN }, | ||
}, | ||
], | ||
}; | ||
|
||
const extractor = new FHIRAllergyIntoleranceExtractor({ baseFhirUrl: MOCK_URL, requestHeaders: MOCK_HEADERS }); | ||
const extractorWithClinicalStatus = new FHIRAllergyIntoleranceExtractor({ baseFhirUrl: MOCK_URL, requestHeaders: MOCK_HEADERS, clinicalStatus: MOCK_CLINICAL_STATUS }); | ||
const baseClinicalStatus = FHIRAllergyIntoleranceExtractorRewired.__get__('BASE_CLINICAL_STATUS'); | ||
|
||
describe('FHIRAllergyIntoleranceExtractor', () => { | ||
describe('Constructor', () => { | ||
test('sets resourceType as AllergyIntolerance', () => { | ||
expect(extractor.resourceType).toEqual('AllergyIntolerance'); | ||
}); | ||
|
||
test('sets clinical status based on BASE_CLINICAL_STATUS', () => { | ||
expect(extractor.clinicalStatus).toEqual(baseClinicalStatus); | ||
}); | ||
|
||
test('sets clinical status if provided', () => { | ||
expect(extractorWithClinicalStatus.clinicalStatus).toEqual(MOCK_CLINICAL_STATUS); | ||
}); | ||
}); | ||
|
||
describe('parametrizeArgsForFHIRModule', () => { | ||
test('should add category to param values', async () => { | ||
const params = await extractor.parametrizeArgsForFHIRModule({ context: MOCK_CONTEXT }); | ||
expect(params).toHaveProperty('clinical-status'); | ||
expect(params['clinical-status']).toEqual(baseClinicalStatus); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,15 @@ | ||
const rewire = require('rewire'); | ||
const { FHIRConditionExtractor } = require('../../src/extractors/FHIRConditionExtractor.js'); | ||
const MOCK_CONTEXT = require('./fixtures/context-with-patient.json'); | ||
|
||
const FHIRConditionExtractorRewired = rewire('../../src/extractors/FHIRConditionExtractor'); | ||
const MOCK_URL = 'http://example.com'; | ||
const MOCK_HEADERS = {}; | ||
const MOCK_CATEGORIES = 'category1,category2'; | ||
|
||
|
||
const extractor = new FHIRConditionExtractor({ baseFhirUrl: MOCK_URL, requestHeaders: MOCK_HEADERS }); | ||
const extractorWithCategories = new FHIRConditionExtractor({ baseFhirUrl: MOCK_URL, requestHeaders: MOCK_HEADERS, category: MOCK_CATEGORIES }); | ||
const baseCategories = FHIRConditionExtractorRewired.__get__('BASE_CATEGORIES'); | ||
|
||
describe('FHIRConditionExtractor', () => { | ||
describe('Constructor', () => { | ||
test('sets resourceType to Condition', () => { | ||
expect(extractor.resourceType).toEqual('Condition'); | ||
}); | ||
|
||
test('sets category based on BASE_CATEGORIES if not provided', () => { | ||
expect(extractor.category).toEqual(baseCategories); | ||
}); | ||
|
||
test('sets category if provided', () => { | ||
expect(extractorWithCategories.category).toEqual(MOCK_CATEGORIES); | ||
}); | ||
}); | ||
|
||
describe('parametrizeArgsForFHIRModule', () => { | ||
test('should add category to param values', async () => { | ||
const params = await extractor.parametrizeArgsForFHIRModule({ context: MOCK_CONTEXT }); | ||
expect(params).toHaveProperty('category'); | ||
expect(params.category).toEqual(baseCategories); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.