Auto-Generation patient ID based on the location?

Reference Aplication 2.10

Hi again, everyone.

I have an instance with 2 different locations, is it possible to generate a patient ID based on the location where this patient is registered?

It is possible to obtain identifiers whose prefix is specific to the location. And I realise that this is totally not documented, so I will attempt to do it here :-/

This was introduced in ID Gen 4.6.0 through IDGEN-110.

Assuming LOC1 would be the prefix for the first location, and LOC2 the prefix for the second location, you would end up with identifiers like this: LOC110001, LOC110002, LOC210003, LOC210004, LOC110005, … etc. That’s if

  • the first 2 identifiers were generated at the first location,
  • the next 2 identifiers were generated at the second location,
  • the fifth identifier was generated at the first location,
  • etc.

To achieve this, first, the prefix of your identifier source needs to point to a bean that implements the logic for a dynamic location-based prefix. Luckily there is a default one in ID Gen: LocationBasedPrefixProvider. In order to use it you would set provider:idgen.locationBasedPrefixProvider as the prefix of your source:

Then LOC1 and LOC2 need to be set as the values of a location attribute (say ‘Location Code’) for each of the locations, for example for the first location:

Of course in order to do this the ‘Location Code’ location attribute type needs to exists:

Finally, you need to tell ID Gen that the attribute type that is used to point to the location prefix is that ‘Location Code’ type, and that’s done via the GP idgen.prefixLocationAttributeType:

4 Likes

OMG, you’re a genius

Thanks a lot!