Smart Register Architecture (Hybrid)
FP, ANC, PNC and Child Register are built using Android Hybrid model and hence all of them have the same architecture as below. The architecture below is written with ANC Register as example, but the same applies to the other hybrid registers too.
Sound knowledge of below mentioned tools and techniques are necessary to understand how these registers are developed:
Sequence Diagram for Smart Register (Hybrid)
The above mentioned components can be found in code as below:
- Register Activity is implemeted as ANCSmartRegisterActivity class. This is an Android Activity which has a webView control
- Register HTML is implemeted as anc_register.html. This is implemented as an AngularJS application
- Register Controller is implemented as anc_register_app.js. Additionally all the common functionality across the registers, like search, sort, etc, are implemented in a common controller called list_view_controller. list_view_controller is included in all the smart registers
- Android Context is implemented as ANCSmartRegisterController. When Register Activity loads the html into webView, it injects this Java object as a Javscript object using Android Javascript Interface API. Register HTML then uses this object to load the data from the local SQLite database
- Register Service is implemented as anc_service.js
More information about the sequence diagram messages below:
- When a smart register is opened Register Activity is started
- Register Actvity uses webView to load Register HTML
- This initialises AngularJS application and controllers (Register Controller and list view controller)
- Register Controller loads the client list
- It calls Get Clients on Android Context
- Android Context loads the data from SQLite Database and returns the data in JSON format. This JSON is cached using Cache object to reduce the load time of the register
- Register controller pre-processes the client list before rendering it. Pre-process step includes converting date fields to DD/MM/YYYY format; title casing text fields like Wife Name, Village, etc; parsing reminders and service provided information, etc
- Register HTML then renders the client list