Recording geocoordinates in OpenMRS

We have received a request to store latitude and longitude for encounters in OpenMRS. I had thought at one time that we actually had such fields in the data model associated with a location. I don’t see them anymore in 1.11. I can create a concept for encounter longitude and latitude (two concepts) with precise numeric data type, but wondered if there was a better way for this to be stored in the data model. Location attribute based on a concept?

Locations have latitude and longitude fields already (see

) and every encounter must have a location, so if you’re talking about encounters at fixed locations, you should use the existing fields.

If you’re talking about recording the geocoordinates of encounters outside the facility (e.g. home visits for everyone in a cohort) that don’t correspond to a fixed Location, then you’ll need to do something different.

I can definitely see the argument for adding these as optional fields directly on encounter in the core data model, though I guess this might involve some discussion and wouldn’t be immediately available to existing implementations.

So my recommendation would be to go ahead and create these concepts, and push to get the idea integrated into the core data model in the future.

1 Like

How would this be represented?

Thanks @darius! I should have looked in the address fields. I did great a generic latitude and longitude concept with datatype numeric, precise, units degrees with max/min of 90/-90 and 180/-180 respectively. They can be used in any set which requires a separate location, but I will direct fixed locations in the location table to have them entered as part of the address.

1 Like

@akanter, shouldn’t concepts be used to represent patient data, not location data? This is just my $0,02

Concept dictionary is used for any structured data in the database. Not only for attributes used in other tables, but also for things like aggregated measures that might be used in reports and decision support :). There is even the household module which captures non-patient data in OBS-like tables…

1 Like

Okay, I’m more than happy to be wrong here :slight_smile: