Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This is the process of converting form submissions to Event and Client models.

...

FieldTypeopenmrs_entityNotes
_idjava.lang.String
Auto generated by couchdb
_revjava.lang.String
Auto generated by couchdb
eventTypejava.lang.String
Equivalent to encounter_type value in model.xml
baseEntityIdjava.lang.String

This is the client unique identifier equivalent to id in relational databases. Equivalent to formSubmission.entityId() value.

Info

Only a single client should exist with a similar base_entity_id value


entityTypejava.lang.String
This is equivalent to the bind_type value in the form_definition
dateCreatedjava.util.Date

Current date in the format: yyyyMMddTHHmmssSSSZ

This is the date when the event is created on the server

providerIdjava.lang.String
Logged in user username
formSubmissionIdjava.lang.String
FormsubmissionId of the form submission currently being converted to EC
locationIdjava.lang.String
Location id of the logged in user as returned by OpenMRS authentication process during login
versionjava.lang.Long

Current timestamp long value. Most of the server side repeating jobs use this value to get the last updated or created events

This timestamp indicates when an event was created on the device

eventDatejava.util.Date

This is the encounter date

This is the date when the encounter happened. In most instances this indicates the date the event was created. However if an encounter happened in the past e.g immunization was done in the past, the eventDate this is changed to reflect that.

typejava.lang.String
Document type. Should be Event
obsList<org.ei.opensrp.clientandeventmodel.Obs>concept

Each field of type concept is an Obs object as show below

Code Block
languagejs
titleSample Observation
{
           "comments": null,
           "fieldCode": "160600AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
           "fieldDataType": "select one",
           "fieldType": "concept",
           "formSubmissionField": "FWCWOMSTRMEN",
           "humanReadableValues": [
               "1"
           ],
           "parentCode": null,
           "values": [
               "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
           ],
           "value": "1065AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
       }
The humanReadableValues key stores a human readable version of the concept value for easier processing in the client app
which doesn't maintain a concept dictionary


status



statusHistory



priority



episodeOfCare



referrals



category



duration



reason


...

  1. The FormUtils.generateFormSubmisionFromXMLString() is called in the activities saveFormSubmission() method and converts the XML data received from enketo to a JSONObject and  loads the form_definition.json for the current formsubmission to get the form and the subforms from the xml data in the enketo data creating an instance of org.ei.opensrp.domain.form.FormSubmission .
  2. With the FormSubmission instance, call FormUtils.generateClientAndEventModelsForFormSubmission() method in the above method to retrived EC data from the form submission
  3. In the FormUtils.generateClientAndEventModelsForFormSubmission() method, formEntityConverter.getClientFromFormSubmission() method is called to generate clients and formEntityConverter.getEventFromFormSubmission() to generate events. The method formEntityConverter.getDependentClientsFromFormSubmission () is called to retrieve other clients/events in case the form had subforms and return them in a java.util.Map.

  4. CloudantDataHandler.createEventDocument() and CloudantDataHandler.createClientDocument() are called to create Cloudant event and client models respectively.