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 https://wiki.openmrs.org/display/docs/HTML+Form+Entry+Module+Reference#HTMLFormEntryModuleReference-<obs>
Let me look through and see which applies in my scenario
@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
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?
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
@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
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?
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