Coded concept with values from Location

Tags: #<Tag:0x00007fe2e7eec290>

Hi all, I am creating a coded concept whose values should be facility Locations, Is there a way my concept can pick its dropdown options from Location data?

@ganguyo are doing this in html form entry module ?

Yes, in the html entry model

ok and have you had a look at the html reference tag with coded data type examples of dropdowns ?

can this be of help<obs>

1 Like

Let me look through and see which applies in my scenario

1 Like

@ganguyo obviously all concepts is coded data , so you dint have to say coded concept

Not exactly from my understanding a concept with the datatype of coded has multiple concepts as answers e.g dropdowns and so on

1 Like

ok , i get from that perspective. did the above link @gcliff shared work for you ?? did you try out that tag??

Not exactly…scenario - I have to use the encounterLocation options (locations) as the drop down of location where samples are referred

I think what what he is asking is whether it is possible to do a lookup from the location table and store the result in the concept with a coded datatype. I don’t think that is really necessary. What you want to do is store a numeric identifier for the location in the concept and use HTML forms to populate a dropdown from the location table with each location’s identifier. Store the identifier in the text field (if alphanumeric) or numeric. What specific use case do you have for recording the location outside of the encounter information?

That is correct…I am doing this because we are keeping track of locations where some tests have been referred to and want to avoid a free text field, and there are thousands of these facilities so creating each facility as a concept before using them is not a good idea. So how do I populate my html form from the location using the identifier?

This is not supported, but it would be great if it was.

We are facing a similar requirement where the user would have to pick a location from a dropdown list and - due to time constraints mainly - we are going down the route of mirroring our locations through concepts, which is not great but well…

Or @ganguyo, do you have any dev capability on your end to start expanding on the HFE <obs/> tag to support this?

Cc @sameermotwani11

1 Like

Busy for the next 1 month certainly I will consider taking this on after that

@mksd i think we can go ahead a ticket to solve this issue, there might other devs who can be able to handle …lets give it a shot :slightly_smiling_face:

@gcliff this requires some design thinking that should be done here before creating a ticket.

@ganguyo could you outline how you would envision the <obs/> tag to be configured to be plugged on a source of locations? This can be tricky given the tree nature of the hierarchy of locations. Also should be anticipated how the locations should be saved (name vs UUID).

very true,thanks for the enlightenment :ok_hand:

cant it just fetch all the locations that is , parent , child and all descendant locations at whatever level and return them in a drop down or rather a search widget kind of ?

A tentative design could be:

<obs location="Amani Hospital" locationDepth="1" ... />

That would mean that the 1st level of child locations of Amani Hospital will be listed as possible choices to pick from.

A missing locationDepth attribute or locationDepth="0"would mean all child locations.

@ball @mogoodrich @ssmusoke thoughts?

1 Like

Hello everyone… this actually is supported, in a somewhat hacky way, but it looks like it isn’t super-well documented.

Check out “style=‘location’” here:

Note that this stores the primary key of the location in the “value_text” field of the obs (since value_coded keys to concept_id, we can’t use value_coded) and “org.openmrs.Location” is set in the obs “comments” field.

If people want to update the documentation to make this feature more clear, feel free to!

Take care, Mark