Opinions requested - HTML form entry module - REST

https://wiki.openmrs.org/display/projects/RESTful+Submission+of+Forms+in+HTML+Form+Entry

The project is about REST-ifying the current HTML form entry module. The main aim of the project is to Extend HTML Form Entry Module to provide for submission of HTML forms through a RESTful API.

As far as I have understood,when the HTML form is created, the obs tags from HTML form schema (which defines the form structure) are replaced with HTML tags having identifiers based upon generic labels like w1, w2 etc. So when a form is presented to the user for data entry, the fields in that form have "id"s as w1, w2, etc. It is these ids that help the HTML form entry module to record the observations in that encounter.

Now when it comes to creating a REST endpoint for the same(which would allow the user to submit the encounter data RESTfully via the HFE module), there is an issue.

When we used the forms, the forms already took care of the “id” for each form element.

But now when we will allow RESTful submission, how is the user supposed to know the id for the particular obs.

Possible solutions could include

  • maintaining mappings between the tags and the generic labels. These mappings can be accessed by the user to make note of the generic labels like w1, w2 etc. that have been assigned for the elements. Then the user can make a request like below.

{

“encounterDate” : “dd-mm-yy”,

“enocunterLocation” : “place”,

“enounterProvider” : “provider name”,

    “observations” : [
 {

      “obsName” : “w1”,
      “obsValue” : “123”
      “additionalParameters” : {
				“unit” : “cm”,
				“obsDate” : “dd-mm-yy”
                               }
 },

{

      “obsName” : “w2”,
      “obsValue” : “83”
},

…...

 ]

}

The mapping that we could return to the user could look like :

{

<obs …1.> : “w1”,
<obs …2.> : “w2”, …

}

Any suggestions on how this can be tackled alternately are most welcome. @mogoodrich, @owais.hussain, @ivange94 it could help if you can add to the description of the issue.

Why did you create a different thread?

@mogoodrich suggested that we get views of other people too who weren’t actively following the HFE thread.

Then you maybe you could rename it to make it obvious that your are requesting opinions on an idea instead of starting a new GSoC thread? I’m having a hard time following all these threads.

1 Like