OpenMRS-iOS Development Guide
This page is outdated and no longer receives updates!
This is the development guide for OpenMRS-iOS, detailing the architecture of the application. If you're looking for the user guide, see the OpenMRS-iOS User Guide.
The code for the app is available on GitHub: https://github.com/openmrs/openmrs-contrib-ios-client. It will soon be transferred to an official OpenMRS repository. You will need to install Cocoapods and run pod install
 in the directory after cloning.
High-level overview
 - The app is written in Objective C, and is compatible with iOS 8 and above.
 - The app communicates with OpenMRS installations through the REST module, and a list of endpoints can be found on REST Web Service Resources in OpenMRS 1.9.
Patterns
Try your best to follow the Model-View-Controller pattern where possible, it helps keeps code clean and responsibilities separate. Additionally, try to keep code DRY - Don't Repeat Yourself.Â
Communicating with the API
All communication with the API should be handled by the OpenMRSAPIManager. It handles authentication, login/logout, and communication with the API. Additionally, it handles the encoding/decoding of objects into JSON that the REST API can consume and output. If the network is not available, it will try to return results from the stored database of patients on the device.Â
Authentication
The user's OpenMRS host, username, and password are stored in the user's keychain. They are then decoded and used as authentication in requests.
Adding new views
New views has to support state restorations with very few exceptions
to add it.
The view class has to comply to protocol: <UIViewControllerRestoration>
And add 2 methods in the .m files
- (void)encodeRestorableStateWithCoder:(NSCoder *)coder
to save any required state to recreate it when restored
+ (UIViewController *)viewControllerWithRestorationIdentifierPath:(NSArray *)identifierComponents coder:(NSCoder *)
to re-init the state when restored and saving any required data saved perviously
Offline Database
The app contains an offline database powered by Core Data, with an additional level of encryption provided by encrypted-core-data. The user's OpenMRS password is used to encrypt the patient data.
The database currently stores these objects:
Â
Future improvements!
Â
Currently, the app doesn't use Core Data relationships. That would be a good improvement to make!
Not having to remove offline data when switching between servers, have a specific directory for each server
More info in encounter cell
show more data for patient like allergies
Salt coredata password for more security
Adding support for HTML forms