filter column in event_log table is not updated to correct value

OpenMRS is configured with 15 Patient Identifier Sources of type Local Identifier Generator. Names, Prefix, min length and max length are as follows ABC1 ABC1 4 15 ABC2 ABC2 4 15 ABC3 ABC3 4 15 … … ABC9 ABC9 4 15 ABC10 ABC10 4 16 ABC11 ABC11 4 16 … … ABC15 ABC15 4 16

When new patient is created with patient identifier as ABC10, the right Patient identifier is being assigned to the patient(i.e ABC10000000001 in event_records table), however when the patient data is flowing to event_log table, the filter column is getting update with ABC1, Expected value is ABC10.

Because of this when initial sync is performed in the offline device. The index DB in the device is not getting any information related to the ID ABC10(assuming there is no patient created under the ID ABC10)

It is observed that filter is populating from method evaluateFilterForPatient() in https://github.com/Bahmni/bahmni-offline-sync/blob/release-0.91/omod/src/main/java/org/bahmni/module/bahmniOfflineSync/strategy/IDBasedSyncStrategy.java

++ @angshuonline @binduak @snehabagri

1 Like

Moved to the bahmni category.

@sivareddy can you update what approach you finally undertook, after the discussion on PAT call and further investigations?

@angshuonline updating the method evaluateFilterForPatient(String uuid) in org.bahmni.module.bahmniOfflineSync.strategy.IDBasedSyncStrategy.java
Approach followed: Fetch the prefix for Patient Identifier source using the query. Query Used: select distinct idgen_seq_id_gen.prefix from idgen_seq_id_gen join idgen_log_entry entry on idgen_seq_id_gen.id = entry.source and entry.identifier = ‘ABC150000000002’ join idgen_identifier_source src on src.id = entry.source and src.retired is not null ;

If the above query returns zero results, then following the existing approach.

Will provide PR with fix.

++ @binduak @srivathsala

PR Link : https://github.com/Bahmni/bahmni-offline-sync/pull/6

++ @binduak @angshuonline @srivathsala @vmalini