User Configurable Views
This page has documentation about User Configurable Views used in the TB Reach application.
Child Pages
- Installation
- App View Configurations
- Base Definitions
- Home View
- Main Configuration
- Patient Details View - In Treatment
- Patient Details View - Positive
- Patient Details View - Presumptive
- Registers Configurations
- User Configurable Login Page
User configurable views will be defined by using JSON objects saved in the OpenSRP couchdb database. They will be fetched by clients(phone or tablet) after configuring the OpenSRP base URL. OpenSRP server has a REST endpoint that the clients will use to sync views to the client.
A background service on the client will occasionally fetch any modified or added configurable views from the OpenSRP server and save them on the client's sqlite database.The client will send the serverVersion of the its last sync and OpenSRP server will return the view configuration files that have changed since the last sync.
The Sequence diagram for User Configurable views
Sequence Diagram Keys: VC - View Configuration, SV - Server Version
The property serverVersion will be used for versioning. If a view configuration file is edited the serverVersion of the view configuration file will have to be updated so that the view configuration can be picked by clients when syncing configurable views. The property is number denoting unix timestamp; one can get the current unix timestamp from https://www.unixtimestamp.com and use that to update the property. Failure to increment server version when editing the files manually will result in the view configuration not to be synched back to the clients.
A view configuration will have a property identifier. The field is used to identify a configuration file on the client e.g identifier of "login_view" can be used to denote that this configuration file is for login screen.This filed is immutable and changes to it will result in the view configuration to be ignored by clients.
By Default a view configuration file may have the below attributes
Property | Datatype | Mandatory | Should be updated | Description |
---|---|---|---|---|
_id | String | * | No | CouchDB Internal document ID used to differentiate different documents within CouchDB |
_rev | String | * | No | CouchDB Internal document revision number used to differentiate different revisions of the same documents within CouchDB. Dont amend this manually |
type | String | * | No | CouchDB Internal document type used to differentiate different documents types within CouchDB. This should always be ViewConfiguration |
identifier | String | * | No | This uniquely identifies this document. This will be used on the client to identify that this document if for a particular screen. This should not be amended |
serverVersion | long | * | Yes | A long number denoting the unix timestamp when the document was updated/created. Its used for versioning by clients. Whenever a document is amended this property should be incremented to the current timestamp so that clients notice the document has changed and they can sync it. |
metadata | Object | Yes | This will be an object that defines configuration at view level. It must have an attribute type that defines the type of configuration being defined. | |
views | List of View Objects | Yes | This will be populated for screens with configurable view components. It contains a list of view objects. The view object is described below. | |
labels | Map(Key value pairs) | Yes | This will be populated for language configuration files. It will have a key value pairs of labels where the key will be identical in all language files but the value will be different for each language. |
This site is no longer maintained. Please visit docs.opensrp.io for current documentation.