Generating Facility Codes for a Facility Registry in Sierra Leone

Hi all,
We are looking at using DHIS2 to manage facilities for a Facility Registry in Sierra Leone. One of the requirements is that they have a facility code that combines:

  • an sub-code to indicate the region the facility is in
  • an incremental counter of the region
    These codes don’t need to be immediately available. On a routine basis (e.g. nightly) the facility list will be sent to the InterLinked Registry / OpenInfoMan for wider sharing for example with mHero.

I don’t think that there is anything to automatically generate codes codes for facilities in DHIS2 using rules like the above. I am looking for some suggestions. A couple of (half-baked) ideas include:

  • create a DHIS2 Web App to create new facilities with the logic implemented above
  • create a script that runs on a cron job that will look for any facilities without a code and modify their records to add the code based on the rules above

I think the second possibilities would be the simplest to implement.

Cheers,

-carl

Hi All,

Just to clarify this code would be used as a way for a human to refer to the facility. On the back end, we would still very much make use of the UUID as an unchanging ID.

Cheers,

-carl

···

On Nov 24, 2015, at 10:27 AM, Carl Leitner litlfred@ibiblio.org wrote:

Hi all,
We are looking at using DHIS2 to manage facilities for a Facility Registry in Sierra Leone. One of the requirements is that they have a facility code that combines:

  • an sub-code to indicate the region the facility is in
  • an incremental counter of the region
    These codes don’t need to be immediately available. On a routine basis (e.g. nightly) the facility list will be sent to the InterLinked Registry / OpenInfoMan for wider sharing for example with mHero.

I don’t think that there is anything to automatically generate codes codes for facilities in DHIS2 using rules like the above. I am looking for some suggestions. A couple of (half-baked) ideas include:

  • create a DHIS2 Web App to create new facilities with the logic implemented above
  • create a script that runs on a cron job that will look for any facilities without a code and modify their records to add the code based on the rules above

I think the second possibilities would be the simplest to implement.

Cheers,

-carl

Second approach sounds most painless to me.

A 3rd approach (shooting from the hip) is to create a postgres trigger
function to generate codes on insert.

···

On 24 November 2015 at 15:27, Carl Leitner <litlfred@ibiblio.org> wrote:

Hi all,
We are looking at using DHIS2 to manage facilities for a Facility Registry
in Sierra Leone. One of the requirements is that they have a facility code
that combines:

an sub-code to indicate the region the facility is in
an incremental counter of the region

These codes don’t need to be immediately available. On a routine basis (e.g.
nightly) the facility list will be sent to the InterLinked Registry /
OpenInfoMan for wider sharing for example with mHero.

I don’t think that there is anything to automatically generate codes codes
for facilities in DHIS2 using rules like the above. I am looking for some
suggestions. A couple of (half-baked) ideas include:

create a DHIS2 Web App to create new facilities with the logic implemented
above
create a script that runs on a cron job that will look for any facilities
without a code and modify their records to add the code based on the rules
above

I think the second possibilities would be the simplest to implement.

Cheers,
-carl

_______________________________________________
Mailing list: DHIS 2 developers in Launchpad
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : DHIS 2 developers in Launchpad
More help : ListHelp - Launchpad Help