Skip to content

Commit

Permalink
Merge pull request #23 from openmrs/feat/support_prev_obs
Browse files Browse the repository at this point in the history
(feat) Support for an encounter of previous obs values
  • Loading branch information
hadijahkyampeire authored Dec 20, 2022
2 parents 8be1666 + 609609a commit 0441423
Showing 1 changed file with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,22 @@ export class HistoricalHelperService {

public evaluate(
expr: string,
dataSources: any,
additionalScopevalues: any
): any {
dataSources: Record<string, unknown>,
additionalScopeValues: Record<string, unknown> | null,
) {
const HD = new HistoricalEncounterDataService();
HD.registerEncounters('prevEnc', dataSources['rawPrevEnc']);
const deps: any = {
HD: HD
};
if (dataSources.hasOwnProperty('rawPrevObs')) {
HD.registerEncounters('prevObs', dataSources['rawPrevObs']);
}

const deps = { HD };

if (additionalScopevalues) {
for (const o in additionalScopevalues) {
if (additionalScopevalues[o]) {
deps[o] = additionalScopevalues[o];
if (additionalScopeValues) {
for (const o in additionalScopeValues) {
const value = additionalScopeValues[o];
if (typeof value !== 'undefined' && value !== null) {
deps[o] = value;
}
}
}
Expand Down

0 comments on commit 0441423

Please sign in to comment.