Offline Data and Synchronization

One major requirement for this app is the ability for agents to work offline and synchronize to our cloud servers once they get online. By default ALL data entry should be done ‘offline’ even if there is an internet connection. Trying to save data online on a slow connection might hold up data entry time.

Offline Data

Agents will be required to login with a mobile number and a password. The screen should also have a Reset Password link. The input for entering the mobile number should display ONLY numeric characters. Authentication is handled by Calabash and thus requires an API call to be made. The app should keep agents logged into their devices until they explicitly logout. After logging in for the first time the following data needs to be downloaded and saved to the agent’s device. Agent’s default profile information.

  • Region
  • Full name
  • Mobile
  • Country
  • Company
  • Any preferences the agent has set.
  • Assigned warehouses
  • Assigned markets
  • Assigned projects
  • Warehouses for the agent’s project ID
  • Farmers uploaded by the agent. All data previously collected about the farmer will be made available for offline saving to make it easier for an agent to edit a farmer’s records offline.
  • Aggregators uploaded by the agent.
  • Commodities defined for the agent's project.
  • Measures defined for the agent's project.
  • Loan providers for the agent's project.
  • Loan Inputs and Services. The available inputs and services farmers can request for when applying for loans. These are specific to the agent’s project.
  • Markets. These will be restricted to only the markets assigned to the agent.
  • Regions in the agent's country.
  • ID types. The various types of IDs we can collect.
  • Farmers cooperatives for farmers within the region the agent is assigned to.
  • Tractor makes
  • Tractor horsepower
  • Truck types
  • Truck tonnage
  • Planting protocols
  • Farmer loans: this will be a list of all farmers and their respective pending loans. This will be when making offline purchases to determine if a farmer has a pending.

If an agent logs out and logs back in to the same device, all data they previously uploaded should still be on the device. If the agent logging in is different from the one who logged in previously, all data should be purged and new offline data fetched on to the device.

Synchronization

Synchronization should be done automatically when an internet connection is detected and should be a background process that does not interfere with the agent’s work. Agents also have the option of synchronizing manually from the profile screen. An agent need's to know the progress of their synschronization. Ideally, they should know how many of the items pending synchronization have actually synced and how many failed.

Agents should be able to see a list of all failed syncs with the appropriate reason as to why they failed. It should be possible for the agent to retry syncing items that failed.

Data Refresh

It is possible for an agent to get assigned more data after they sign in. For example, when an agent is created, no markets were assigned. The agent logs in to their app and pulls in all the offline data. Later on, the agent's supervisor assigns a couple of markets to him. In order for the agent to see these markets on his device, a data refresh needs to be done.

Both Refresh and Synchronization will be done using the same button available on the agent's profile screen.