As is:
Visit is selected by the visitUuid sent in the EncounterTransaction. Within the visit, the encounter is filtered based on the following logic , in that order
Regular Consultation
- by encounterType
- by sessionTime
- by user and provider
- by location
Retrospective
- by encounterType
- by user and provider
- by date
Visit Document
- by encounterType
- by provider
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
To be:
Objectives:
...
for regular encounters, retrospective encounter, on behalf of encounters and encounter edits.
...
, in that order
Regular Consultation & Retrospective Consultation
- by encounterUuid if sent by the client.
- by encounterType
- by sessionTime (for retrospective entry, the client should send the date as 12:00)
- by provider if provider or on behalf of provider
- by user if not a provider
Note: Visit Document matching can be modelled as onBehalfOf and the time fixed to one specific time of a day as in retrospectiveVisit Document
- by encounterType
- by provider
Encounter Type Matching
Regular Consultation & Retrospective Consultation
Encounter type to be used for finding an encounter or creating a new encounter is based on either of the following logic in the given order,
- by programUuid - mapping present in entity_mapping table with entity_mapping_type as 'program_encountertype'
- by location uuid - mapping present in entity_mapping table with entity_mapping_type as 'location_encountertype'
- by default encounter type provided in global property ( bahmni.encounterType.default)