clintonhealthaccess / chailmis-android

Android Tablet Application for Logistics Management in the DHIS2 Platform
Other
7 stars 6 forks source link

Client initiates Data Sync automatically #254

Open ihassin opened 8 years ago

ihassin commented 8 years ago

Client has automated process that syncs SOH data with the server twice a day.

Scenario: Retry to send SOH only at prescribed intervals Given the server has "5" items of type "A" When I update SOH with "Received" "A" "10" And I wait for the sync period at "01:00AM" But the sync fails And I wait for the sync period at "12:00PM" And the sync succeeds Then the server shows that there are "15" items of type "A" for my clinic

If we have time, I suggest that the times be read from a config file at run-time.

ihassin commented 8 years ago

From Bin: About the sync time, The local time on the tablet is not reliable. We never sync the time from app to the server, so 1 am or 12 pm on the tablet may not be the same with that on the server.

@garymabin : is there a process on the device that currently that runs on a scheduled time? If so, keep it. If not, please let me know ASAP.

Auto syncing even if it's not at the desired times is better than nothing. The operator will use the manual sync button during the day anyway. The server runs a batch script twice a day and that means that sometimes, it won't be up to date. I have not heard from Egwuma that this latency is a problem for the project.

LakshmiCHAI commented 8 years ago

On a related note, is it possible to force an automatic sync when the device is shutting down? This need not be developed now if it's high effort, but is it technically feasible and how much effort would it take if so?

karloskalcium commented 8 years ago

@LakshmiCHAI : We should create a new card for this. However, I don't think we will have budget left to code and test a synch-on-shutdown like that.

ihassin commented 8 years ago

I think a story should be created for the backlog - we can then see if we can fit it in.

On Oct 8, 2015, at 13:35, Karl Brown notifications@github.com wrote:

@LakshmiCHAI https://github.com/LakshmiCHAI : We should create a new card for this. However, I don't think we will have budget left to code and test a synch-on-shutdown like that.

— Reply to this email directly or view it on GitHub https://github.com/clintonhealthaccess/chailmis-android/issues/254#issuecomment-146632526.

LakshmiCHAI commented 8 years ago

Done, see card 260

garymabin commented 8 years ago

About the sync time, The local time on the tablet is not reliable. We never sync the time from app to the server, so 1 am or 12 pm on the tablet may not be the same with that on the server.

Bin MaConsultantEmailbinma@thoughtworks.comTelephone+86 13125033274 <+86+13125033274>[image: ThoughtWorks] http://www.thoughtworks.com/?utm_campaign=bin-ma-signature&utm_medium=email&utm_source=thoughtworks-email-signature-generator

2015-10-09 6:17 GMT+08:00 LakshmiCHAI notifications@github.com:

Done, see card 260

— Reply to this email directly or view it on GitHub https://github.com/clintonhealthaccess/chailmis-android/issues/254#issuecomment-146702031 .

chai-lmis commented 8 years ago

@ Itamar, the latency betweenw the server analytics run is not a a problem

ihassin commented 8 years ago

Following Bin's recommendation, we'd like to propose that we configure the tablet to sync SOH 4 times a day with the times for the sync ideally in a config file. @egwuma - please approve?

ihassin commented 8 years ago

OK - Config file is out of the question, and building a config retrieval service on the server is out of scope. We'll sync 4 times a day hardcoded in the code. I don't think it's a big issue doing so.

ihassin commented 8 years ago

This is ready for development, but should be picked up till 253 is at least code-complete

garymabin commented 8 years ago

Finish dev with #253

chai-lmis commented 8 years ago

can you please confirm the sync times, this will help in testing this card

ihassin commented 8 years ago

Looking at the source code, it looks like every 6 hours. Hope this helps.

chai-lmis commented 8 years ago

ok will check test this today

chai-lmis commented 8 years ago

Tested Ok for all commodities except 1 where the numbers did not add up - Hep.B Antigen (i emailed a screen shot)

ihassin commented 8 years ago

@garymabin any news on this please?

garymabin commented 8 years ago

@Ihassin, Will check it today

ihassin commented 8 years ago

@egwuma - we do not understand why a certain category was not synced. Maybe it's server side scripts? We need logs from transactions from the server side in order to investigate.

Also, please do not send info by email, rather paste here. I am referring to the screen shot. Please add it to this ticket.

ihassin commented 8 years ago

@egwuma - please note that the tablet does not show Heb.P; it means we don't have it locally, so that explains that the server did not update its values. Please make sure that server side API exposes HepB to client when asked for items.

ihassin commented 8 years ago

Auto sync was successful at 4am. Closing this ticket, and opening new ticket for Hep.B

chai-lmis commented 8 years ago

Tablet shows Hep. B Antigen, check again under vaccines category