GSoD 2020 - OpenMRS REST API Documentation

So I would say first add the new samples from Java and Javascript then we can think about having a live playground :slightly_smiling_face:

1 Like

@ayesh can you help me, whether I lookup on this for some insight on what resources might have been left out from the current documentation here

but the version mentioned in the psbrandt.io swagger based documentation is 1.11.6, (I dont know if that version corresponds to the APIs version or the document version itself) which is itself old since the github repo of openMRS webServices latest released version is 2.28.0.

thanks :smiley:

Hi @saurabh

Please refer the swagger doc here https://demo.openmrs.org/openmrs/module/webservices/rest/apiDocs.html

I think that one is little bit outdated

1 Like

thanks @ayesh :smiley:

Hi @burke I think @burke is here :smiley:

1 Like

yess @ayesh while searching through a bit of history on this project I got his extremely precise posts like these , which are really helpful in understanding a bit of buildup to this project !!

of course he is the project champion and my mentor as well as @batbrain7’s mentor last year :smiley:

1 Like

@ayesh I found this doc here what was it really used for ??

because it has the required tabs for other language examples but misses out on some resources that the current documentation has :slight_smile:

Oh, it was my playground prior to moving things to the openmrs repo. It just has the tabs nothing more.

I would prefer you to go through the slate docs to see how we can have tabs. Don’t refer to this one.

@ayesh ohkk I will do that thanks :slight_smile:

and a request @ayesh can you please review my PR here so that I can make suitable changes as suggested by @sanjula in addition to your suggestions. thanks

@saurabh I would like to suggest you now to work on the only missing resource we didn’t work on last time Forms resource. You can talk with developers refer the swagger documentation and other resources to get an idea.

1 Like

yes @ayesh , I will start working on forms next up surely !!

@ayesh as you requested on the github repo I started looking for resources on adding examples to in addition to the current cURL examples but I dint get a few things,

do we need examples of this format or we need plain http request examples which dont use annotations and rather simply create and http request to the OpenMRS webServices.

//generic example for uploading a resource

@RequestMapping(value = "/{resource}", method = RequestMethod.POST, headers = "Content-Type=multipart/form-data")
@ResponseBody
public Object upload(@PathVariable("resource") String resource, @RequestParam("file") MultipartFile file,
    HttpServletRequest request, HttpServletResponse response) throws IOException, ResponseException {
  baseUriSetup.setup(request);
  RequestContext context = RestUtil.getRequestContext(request, response);
  Resource res = restService.getResourceByName(buildResourceName(resource));
  if (res instanceof Uploadable) {
    Object updated = ((Uploadable) res).upload(file, context);
    return RestUtil.created(response, updated);
  } else {
    throw new ResourceDoesNotSupportOperationException(res.getClass().getSimpleName() + "is not uploadable");
  }
}

Hi @saurabh

So am talking about Forms in openMRS context if you refer https://demo.openmrs.org/openmrs/module/webservices/rest/apiDocs.htm You will be able to identify the forms resource. It has 2 subresources mentioned below.

  1. Resource
  2. Formfield

You have to first document this as we have done for other resources(patients, locations etc). as I mentioned previously then we can move to other types of examples like javascript, node.js.

Please remember this is all about finding things by engaging with the community you have all the required documents and resources. Please refer and come up with proper documentation for Forms :slightly_smiling_face:

1 Like

ohkk @ayesh I thought I had to do examples before this one :sweat_smile:

okay then I do forms before examples then!!.

@ayesh I did look up the swagger documentation and all the wiki posts I could find and I have almost finished the forms section of the doc I will raise a PR once I have tested all the curl examples . but I need some help in defining the formfield (subresource), for which I could just get a resource here

apart from that I fiddled with the forms on the refApp and came up with this short definition for the form

  • The concept dictionary is a central part of OpenMRS. Concepts can commonly be thought of as questions and possible answers which are on forms (although they have other uses too).
  • so forms in OpenMRS can be thought of as data collecting means for various concepts in this dictionary , where corresponding to the questions these concepts pose answers are fetched via these forms.
  • forms in OpenMRS can be of many types for e.g. observation forms which help in capturing observations during an encounter e.t.c

@dkayiwa can you please help us refine these definitions a bit :smiley: thanks!!

Hi @saurabh it looks ok to me. Let get the view from @burke and @dkayiwa :smiley:

1 Like

Forms are data collection tools. Nearly all implementations of forms in OpenMRS represent encounter forms, where data are collected during a clinical encounter with a patient (sometimes retrospectively after the encounter is over). Forms can contain various fields including the date of collection, patient demographics, medications, allergies, and clinical observations. The majority of data collected are modeled as clinical observations.

2 Likes

Thanks alot @burke

@saurabh I would like to suggest you to send a PR with what you have also since burke replied you hve clear idea now :slightly_smiling_face:

@burke thank you for making things more clear now :grinning:, @ayesh I have opened PR I will make changes to that now and request a review again :slight_smile: