how to advance syncing to the last published ATOMFeed page?

Environment Bahmni 0.92. As per this wiki

http://localhost:8052/openelis/ws/feed/patient/recent

shows the last published page by OpenELIS (as publisher) and markers table in OpenMRS (as subscriber) database holds the last synced page from OpenELIS

In our case, most recent page published by OpenELIS (as publisher) is as 55417 (found using the above url …/patient/recent) and markers table in OpenMRS (as subscriber) shows the last synced pagee as 2318.

We do not need to sync the past data from OpenELIS to OpenMRS, so, we set the markers table in OpenMRS side to the most recent published page (55417) of OpenELIS along with the appropriate ATOM feed tag using SQL Update.

We noticed that, after some time markers table in OpenMRS goes back to page 2318 and start syncing from thier instead of most recent page that was set manually

Question

  1. Is there any way to advance the OpenMRS (as subscriber) directly to start syncing only the new data that is to the most recent published page of OpenELIS?
  2. Does OpenMRS, markers table get populated from event_records_offset_marker?

I found the solution to advance the syncing from openelis to openmrs directly to the most recent published page by openlis

  1. stop the openmrs service

  2. get the most recent page and the related tag of the last entry from http://localhost:8052/openelis/ws/feed/patient/recent as highlighted in the image

  3. login to mysql openmrs database

  4. update markers table with the most recent page and the related tag

    update markers set last_read_entry_id = 'tag:atomfeed.ict4h.org:5de9b48a-1093-4cd9-9a6d-ca1c4e9f75f2', feed_uri_for_last_read_entry = 'http://localhost:8052/openelis/ws/feed/patient/55071';
    
  5. Start the openmrs service

Now openmrs will start syncing from the most recent page of openelis

2 Likes

tag id can be also retrieved from uuid field from event_records table
for checking openerp-feed-service.log
/opt/bahmni-erp-connect/run/logs/openerp-feed-service.log

Note: - if we want to get tag as well the recent number as per particular date range go back and forth on the number as per the required date range
for example if we want records of 2023-07-03
curl http://localhost:8050/openmrs/ws/atomfeed/patient/65551
consider the 5th page tag

<title> Patient</title> 
<category term="patient">
<id>tag:atomfeed.ict4h.org:2d9d56f2-6022-4ede-a258-139c679fd56b</id>
<updated>2023-07-03T11:44:23Z</updated>
<published> 2023-07-03T11:44:23Z</published> <content type="application/vnd.atomfeed+xml"> <![CDATA[/openmrs/ws/rest/v1/patient/922425c7-986c-46c7-a95b-d8f01ea4ba5a?v=full]></content> </entry> </feed>
</pre>

We can verify the recent number which is seen in the markers table

mysql> select count(*) from event_records where category=‘Encounter’;

±---------+

| count(*) |

±---------+

| 1451570 |

±---------+

Divide 1451570 with 5=290314
Note: for each “/number” 5 tags are generated

#Event from atomfeed-console
{
“categories”: [
{
“schemeResolved”: null,
“term”: “Encounter”,
“label”: null,
“scheme”: null
}
],
“id”: “tag:atomfeed.ict4h.org:9ff4dff5-9609-4a21-92e2-a79c94c9c321”,
“content”: “/openmrs/ws/rest/v1/bahmnicore/bahmniencounter/7748dd8b-4264-4b23-8813-b6916faa02ab?includeAll=true”,
“feedUri”: null,
“updatedDate”: null,
“title”: “Encounter”,
“dateCreated”: null
}

“content”: “/openmrs/ws/rest/v1/bahmnicore/bahmniencounter/7748dd8b-4264-4b23-8813-b6916faa02ab?includeAll=true”,
where content is linked to encounter
select * from encounter where uuid =‘7748dd8b-4264-4b23-8813-b6916faa02ab’;