jkuester
We are preparing for end of semester exams, thus took a break, I still cant be able to display the data, only widgets available, and my code is as below:
target config
const extras = require('./nools-extras');
const {
posCovidPercTested,
negCovidPercTested,
} = extras;
module.exports = [
{
id: 'percentage-positive-covid-test',
type: 'percent',
icon: 'medic-covid-case',
goal: -1,
translation_key: 'targets.posCovid.title',
subtitle_translation_key: 'targets.this_month.subtitle',
appliesTo: 'contacts',
appliesToType: ['person'],
passesIf: posCovidPercTested,
date:'reported',
},
{
id: 'percentage-negative-covid-test',
type: 'percent',
icon: 'medic-covid-case',
goal: -1,
translation_key: 'targets.negCovid.title',
subtitle_translation_key: 'targets.this_month.subtitle',
appliesTo: 'contacts',
appliesToType: ['person'],
passesIf: negCovidPercTested,
date:'reported',
},
];
nools-extra
const posCovidPercTested = contact => {
return contact.reports.some(report => report.form === 'case_investigation' && report.fields.testing.cov_test === 'Positive');
};
const negCovidPercTested = contact => {
return contact.reports.some(report => report.form === 'case_investigation' && report.fields.testing.cov_test === 'Negative');
};
module.exports = {
posCovidPercTested,
negCovidPercTested,
};
On it now and was following your thread, Did you end up implementing an appliesIf
function in your target? No I didn’t
Given I just want to get percentage of people with Covid, how will the appliesif function look like?
Trying to figure this out