medic / cht-conf

A command-line interface for configuring Community Health Toolkit applications
https://communityhealthtoolkit.org
GNU Affero General Public License v3.0
22 stars 25 forks source link

Declarative Config - Events attribute should support function values #357

Open pkitutu opened 4 years ago

pkitutu commented 4 years ago

We need access to the function values in the events attribute so that an event is defined based on certain conditions

Example:

When defining the Task for MUAC follow up RE: BRAC-UG, they require that an event is created every 6 months until that child clocks 59 months. So we need to determine the number of events based on the age of the child i.e more events for a younger child and less events for an older child. Otherwise, we end up having more events than necessary.

The end attribute of an event also needs to change based on the due date to prevent tasks from overlapping. Check here cc @kennsippell

kennsippell commented 2 years ago

Great example of the need for this today. https://github.com/medic/config-muso/pull/561/files#diff-aeb060933d5b950dceb313b9624bd734504968bdb02af010a55b8024d0d9307eR427

How can you have a task which starts on the first day of the month and ends on the last day of the month? Since event timespans (start/end) cannot be calculations - only integers - there is no way to account for the variable duration of a month. The best you can do is make a task which is "28 days" or "31 days" and ignore the error.

kawerewagaba commented 12 months ago

ran into schema validation issues for events myself. thought it was my version of cht-conf (INFO 3.18.3)

Screenshot 2023-10-20 at 10 10 44
kennsippell commented 11 months ago

To test this change before it is reviewed and committed, you'll need to install the branch npm i --save-dev https://github.com/medic/cht-conf#357-events-func and then use npx cht when deploying.