Insert Form

For inserting a form you need the following values:

  • user id
  • patient id
  • department id
  • form ID
  • language in which the form was filled out

When you do this the first time, you have to call server.downloadFormDefinition  
This operation returns a object which contains the complete structure of the form. The object hierarchy is :

Form

  |__Subforms

      |__Sections

          |__Groups

              |__Questions

                  |__Labels

 

This form objects with all children describes the whole form structure and contains all necessary names (subform names, question names) and ids used to map your data the correct objects.

NOTE: You will receive a form ID for further identifying the form. This form ID can be different on different servers. Therefore you should not hard code this value but save it in a properties file or database table. Once you finish developing your client on the Demo server and use it on the Live server, you have to change this values. The same applies to the subform ID.

Now you create a FormData object which is the container for your answers.
The FormData object has a SubformData collection. The SubformData object has a Answer collection and this collection is where you have to put your answers in.

Answering a question:

Textquestions:

  1. Create an Answer object
  2. Add the questionname as questionname
  3. Add the answer string as value.

Single/Multiple Choice Questions:

  1. Create an Answer object
  2. Add the questionname as questionname
  3. add the label value as value

NOTE: The unique identifier for a question is the questionname, not the questionId. If you are mapping questions from your local implementation to our form you must always use the questionname. The questionId might change whenever the form gets changed/updated.

Add the answer object to the answer collection of the form object. Once you added all answers to the collection, you add the subformData object to the subformData collection of the formData. Additionally, the formData needs the formId and the patientId.

Now that the FormData object is done, the method server.insertForm with this parameters:

  • The FormData object you just created
  • The creator id. This is the user id of the Person (Doctor) to whom this case belongs to. This may be the user id of your web service user or the user id of someone else. If your web service writes data for different doctors/data entry clerks, you have to know their user ids and add them here
  • The department id
  • The server session id

The method will return true or false

When the form has been inserted successfully you have to 'submit' it, this means, the form will be locked and can not be modified anymore. All forms have to be 'submitted' else the will not show up in tools like the online statistics

server.submitForm