-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to remove resources not relevant to measure
- Loading branch information
1 parent
76ef6c1
commit e05c843
Showing
8 changed files
with
316 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { atom } from 'recoil'; | ||
|
||
/** | ||
* Atom indicating if resources on a patient bundle are to be minimized using the | ||
* data requirements of the provided measure bundle | ||
*/ | ||
export const resourceSwitchOn = atom<boolean>({ | ||
key: 'resourceSwitchOn', | ||
default: false | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { selector } from 'recoil'; | ||
import { dataRequirementsState } from './dataRequirements'; | ||
|
||
export interface DataRequirementsLookupByTypeProps { | ||
keepAll: boolean; | ||
valueSets: string[]; | ||
directCodes: fhir4.Coding[]; | ||
} | ||
|
||
export const dataRequirementsLookupByType = selector<Record<string, DataRequirementsLookupByTypeProps>>({ | ||
key: 'dataRequirementsLookupByType', | ||
get: async ({ get }) => { | ||
const dataRequirements = get(dataRequirementsState); | ||
const result: Record<string, DataRequirementsLookupByTypeProps> = {}; | ||
|
||
if (dataRequirements !== null) { | ||
dataRequirements.forEach((dr, i) => { | ||
if (result[dr.type]) { | ||
if (result[dr.type].keepAll === false) { | ||
if (dr.codeFilter === undefined) { | ||
result[dr.type].keepAll = true; | ||
} else { | ||
dr.codeFilter.forEach(cf => { | ||
if (cf.valueSet) { | ||
result[dr.type].valueSets = result[dr.type].valueSets.concat(cf.valueSet); | ||
} else if (cf.code) { | ||
result[dr.type].directCodes = result[dr.type].directCodes.concat(cf.code); | ||
} | ||
}); | ||
} | ||
} | ||
} else { | ||
if (dr.codeFilter === undefined) { | ||
result[dr.type] = { keepAll: true, valueSets: [], directCodes: [] }; | ||
} else { | ||
dr.codeFilter.forEach(cf => { | ||
if (cf.valueSet) { | ||
result[dr.type] = { keepAll: false, valueSets: [cf.valueSet], directCodes: [] }; | ||
} else if (cf.code) { | ||
result[dr.type] = { keepAll: false, valueSets: [], directCodes: cf.code }; | ||
} | ||
}); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
return result; | ||
} | ||
}); |
Oops, something went wrong.