GSoD 2020 - OpenMRS REST API Documentation

@ayesh I am currently in the last section of concepts,

After I get concept and hopefully obs also merged I will float another survey, but I think after we merge concepts we can start getting feedback and , I can hop on a call with @herbert24 where he can share his screen while trying to follow the documentation.

1 Like

yes thats great

@ayesh @burke I saw some attributes which are there in swagger but not in the static docs for creating a concept,

{
  "names": [
    {
      "name": "string",
      "locale": "en",
      "localePreferred": false,
      "conceptNameType": "FULLY_SPECIFIED"
    }
  ],
  "datatype": "uuid",
  "set": true,
  "version": "string",
  "answers": [
    "uuid"
  ],
  "setMembers": [
    "uuid"
  ],
  "hiNormal": "string",
  "hiAbsolute": "string",
  "hiCritical": "string",
  "lowNormal": "string",
  "lowAbsolute": "string",
  "lowCritical": "string",
  "units": "string",
  "allowDecimal": "string",
  "displayPrecision": "string",
  "conceptClass": "string",
  "descriptions": [
    "string"
  ],
  "mappings": [
    "string"
  ]
}

  1. Where can I get some description about these missing attributes like hiNormal, hiAbsolute ?
  2. Should I use all these attributes while writing an example for the static documentation creating a concept or elide some of them which are not so important?
  3. Can I annotate the attributes for required/ not required using this data model here ? since the swagger dosent specify anything neither does our static docs for this section .

@ayesh @burke @gcliff what does this error mean while creating a new concept name for an existing concept this was my request payload. I thought its due to duplicate concept-name but different name also dint work !!


{
  "name": "Bronchospasm",
  "locale": "en",
  "localePreferred": true,
  "conceptNameType": "FULLY_SPECIFIED"
}

cc @burke @ayesh @gcliff @mozzy

  1. I tried adding concept Attribute type to any concept through the refapp on demo server but couldnt find any option to do so, where should I navigate I went to the manage concept section but coudnt find anyway to do it?

  1. Trying through the API calls I am able to create a seperate conceptattributetype but I am getting this error while adding it to a concept

this was the payload I used.

{
  "attributeType": "88e9873a-a520-4d3c-a91d-8ea3c303deff",
  "value": "value"
}

@saurabh you can be able to do it from the legacy ui https://demo.openmrs.org/openmrs/admin/concepts/conceptAttributeTypes.list

Secondly a payload for a conceptattributetype should be something like this

POST /conceptattributetype
{
  "name": "Time Span",
  "description": "This attribute type will record the time span for the concept",
  "datatypeClassname": "org.openmrs.customdatatype.datatype.LongFreeTextDatatype",
  "minOccurs": 0,
  "maxOccurs": 1,
  "datatypeConfig": "default",
  "preferredHandlerClassname": "org.openmrs.web.attribute.handler.LongFreeTextTextareaHandler",
  "handlerConfig": null
}
1 Like

@gcliff but while adding to the concept parent resource, I read that we have to pass in a UUID of the conceptattributetype ?

@saurabh yes then u need to fst create a conceptattributetype as described here

1 Like

yes I did @gciff then while adding I got this error

is this json payload for creating a conceptattributetype ?

No @gcliff the json I have used is for adding that attribute to the concept resource I have already created the conceptattributetype and 88e9873a-a520-4d3c-a91d-8ea3c303deff this was its UUID

@saurabh am not seeing a reference to how this is done except via the legacy ui …

could you also point me to the reference where u got the json payload you have shared

1 Like

here it is @gcliff thanks !!

@gcliff I cant even do it from the legacy UI, I think since it just creates a conceptattributetype and not associates it with any concept in the concept dictionary ?

@saurabh i see in the error logs u shared above

"detail": "org.openmrs.module.webservices.rest.web.response.ConversionException: value on class org.openmrs.ConceptAttribute throwing a java.lang.NullPointerException

which i think is resulting from the failure to convert the value parameter of the json payload. As you can see here in the concept attribute resource there is a property setter method for the attributeType parameter but am not seeing a respective property setter method for the value parameter hence spawning the above conversion exception

1 Like

@gcliff thank you, yes there is no property setter for value parameter but I think we cannot send the payload without any value its required in the datamodel as well, is this a implementation issue should we raise a ticket for it ?

value is a REQUIRED attribute as seen here ,you can raise a ticket with the necessary tests to address this issue

cc @dkayiwa

2 Likes

The fact that this test does not fail proves that a value should be saved successfully. From the stack trace, this is the underlying cause. The referenceString that is being passed in does not exist.

2 Likes

@dkayiwa is there something wrong with the value passed, I used a dummy string value for a conceptattributetype created using this payload.

The value property setter can be found here. As you can see in that code, the structure of the value should be one that the custom datatype can reference from.

1 Like