Form mappings are voided whenever we delete a subject type, program or encounter type.
However, voided subject types, programs and encounter types, as well as their transactional data are synced to the client.
When syncing, we need to find the sync scope (catchment, direct assignment etc) of an encounter. This requires us to look up the form mapping, find the subject type and then look up the sync scope from it. We need a non-voided form mapping in order to do this.
If we ever delete an existing program or encounter type, the client still expects sync to happen, and we try to look up form mappings. If these are unavailable, then the sync fails because it is hard to figure out the subject type that the form mapping is associated to.
Solution
Look up the form mapping with highest last_modified_date_time if no unvoided form mapping available
Acceptance criteria
The above solution is implemented for all syncs that require us to pull up form mappings to get the subject type (enrolments, encounters, program encounters, checklists, entity approval)
Issue
Form mappings are voided whenever we delete a subject type, program or encounter type.
However, voided subject types, programs and encounter types, as well as their transactional data are synced to the client.
When syncing, we need to find the sync scope (catchment, direct assignment etc) of an encounter. This requires us to look up the form mapping, find the subject type and then look up the sync scope from it. We need a non-voided form mapping in order to do this.
If we ever delete an existing program or encounter type, the client still expects sync to happen, and we try to look up form mappings. If these are unavailable, then the sync fails because it is hard to figure out the subject type that the form mapping is associated to.
Solution
Acceptance criteria