Flexible ID generation

classic Classic list List threaded Threaded
5 messages Options
Friedman, Roger (CDC/CGH/DGHA) (CTR) Friedman, Roger (CDC/CGH/DGHA) (CTR)
Reply | Threaded
Open this post in threaded view
|

Flexible ID generation

For the lab module on which I am working, I need to generate unique IDs for lab orders, specimens and reports.  These IDs should be in a user-specified format containing some or all of the following elements: patient ID, current year, current month, current day, sequential number, check digit, string constant.  I am trying to decide on how the user is to specify this: a pattern stored in a global property, some sort of interpretable scripting language, a groovy snippet, whatever.  Does anybody have any suggestions, patterns to follow, examples?  


[hidden email] from OpenMRS Developers' mailing list
sunbiz sunbiz
Reply | Threaded
Open this post in threaded view
|

Re: Flexible ID generation

We've been discussing that it will also be useful to make these ids (including patient identifiers) unique in space because since we might be using offline id creation, we could have a conflict if the ids were generated at the same time. So a combination of them being unique in space (through location/device id) and in time (current time upto sec) should be good enough for them to avoid conflicts.

---
Regards,
Saptarshi PURKAYASTHA

My Tech Blog:  http://sunnytalkstech.blogspot.com
You Live by CHOICE, Not by CHANCE


On 14 May 2012 17:08, Friedman, Roger (CDC/CGH/DGHA) (CTR) <[hidden email]> wrote:

For the lab module on which I am working, I need to generate unique IDs for lab orders, specimens and reports.  These IDs should be in a user-specified format containing some or all of the following elements: patient ID, current year, current month, current day, sequential number, check digit, string constant.  I am trying to decide on how the user is to specify this: a pattern stored in a global property, some sort of interpretable scripting language, a groovy snippet, whatever.  Does anybody have any suggestions, patterns to follow, examples?  



[hidden email] from OpenMRS Developers' mailing list
Ben Wolfe (openmrs) Ben Wolfe (openmrs)
Reply | Threaded
Open this post in threaded view
|

Re: Flexible ID generation

A pattern in a gp seems most user friendly.  Not sure many people will know or want to make a groovy script to do it.  Make a few constants that they can put in to get the location, device id, current millisecond time, etc.

Ben

On Mon, May 14, 2012 at 8:13 AM, Saptarshi Purkayastha <[hidden email]> wrote:
We've been discussing that it will also be useful to make these ids (including patient identifiers) unique in space because since we might be using offline id creation, we could have a conflict if the ids were generated at the same time. So a combination of them being unique in space (through location/device id) and in time (current time upto sec) should be good enough for them to avoid conflicts.

---
Regards,
Saptarshi PURKAYASTHA

My Tech Blog:  http://sunnytalkstech.blogspot.com
You Live by CHOICE, Not by CHANCE



On 14 May 2012 17:08, Friedman, Roger (CDC/CGH/DGHA) (CTR) <[hidden email]> wrote:

For the lab module on which I am working, I need to generate unique IDs for lab orders, specimens and reports.  These IDs should be in a user-specified format containing some or all of the following elements: patient ID, current year, current month, current day, sequential number, check digit, string constant.  I am trying to decide on how the user is to specify this: a pattern stored in a global property, some sort of interpretable scripting language, a groovy snippet, whatever.  Does anybody have any suggestions, patterns to follow, examples?  



[hidden email] from OpenMRS Developers' mailing list


[hidden email] from OpenMRS Developers' mailing list
Burke Mamlin Burke Mamlin
Reply | Threaded
Open this post in threaded view
|

Re: Flexible ID generation

In reply to this post by Friedman, Roger (CDC/CGH/DGHA) (CTR)
The typical approach would be to define variable names for these things and then use a module setting (global property) to define the ID format – e.g. $YY$MM$DD$PID$N-$C, where you define variables like:
  • $YYYY four digit year
  • $YY two digit year
  • $M non-padded month
  • $MM zero-padded month
  • $D non-padded day of month
  • $DD zero-padded day of month
  • $PID patient id
  • $N incrementing number for day
  • $C check digit (calculated from identifier)
If you are using a mod10 algorithm for check digits, then you may want to consider the modified Luhn algorithm that allows for letters as well as numbers in the identifier.

Note that the next iteration of the order entry service will be generating an order number & will accommodate implementation-specific algorithms.  I'm assuming that, since you're building a lab system, you're referring to generating the lab's accession number.

-Burke

On Mon, May 14, 2012 at 7:38 AM, Friedman, Roger (CDC/CGH/DGHA) (CTR) <[hidden email]> wrote:

For the lab module on which I am working, I need to generate unique IDs for lab orders, specimens and reports.  These IDs should be in a user-specified format containing some or all of the following elements: patient ID, current year, current month, current day, sequential number, check digit, string constant.  I am trying to decide on how the user is to specify this: a pattern stored in a global property, some sort of interpretable scripting language, a groovy snippet, whatever.  Does anybody have any suggestions, patterns to follow, examples?  


[hidden email] from OpenMRS Developers' mailing list
Friedman, Roger (CDC/CGH/DGHA) (CTR) Friedman, Roger (CDC/CGH/DGHA) (CTR)
Reply | Threaded
Open this post in threaded view
|

Re: Flexible ID generation

Thanks all.

 

@Saptarshi --

Since this number is not just a unique identifier, but is intended to serve an audit purpose (i.e., it should be possible to see if an ID is missing), we do need a sequential number.  In the distributed environment you describe, pre-assignment of blocks of IDs to a device could serve the same purpose.

 

@Burke --

As for accession number, I had originally thought that this represented specimen ID, which wouldn't work for tests which require multiple specimens (e.g. xylose absorption).  However, from recent exchanges, it seems like accession number might more properly refer to the report ID, of which there is only one per order record.

In jsslab, the concept of lab order identifier is a little bit different than what I understand yours to be, in that an identifier can cover multiple lab order records, each of which requests a single test panel.  I know your approach to such multiplicity typically is to have a group field, and the lab order ID field could include a line item subfield that could be hidden when displayed.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Burke Mamlin
Sent: Monday, May 14, 2012 8:39 AM
To: [hidden email]
Subject: Re: [OPENMRS-DEV] Flexible ID generation

 

The typical approach would be to define variable names for these things and then use a module setting (global property) to define the ID format – e.g. $YY$MM$DD$PID$N-$C, where you define variables like:

  • $YYYY four digit year
  • $YY two digit year
  • $M non-padded month
  • $MM zero-padded month
  • $D non-padded day of month
  • $DD zero-padded day of month
  • $PID patient id
  • $N incrementing number for day
  • $C check digit (calculated from identifier)

If you are using a mod10 algorithm for check digits, then you may want to consider the modified Luhn algorithm that allows for letters as well as numbers in the identifier.

 

Note that the next iteration of the order entry service will be generating an order number & will accommodate implementation-specific algorithms.  I'm assuming that, since you're building a lab system, you're referring to generating the lab's accession number.

 

-Burke

 

On Mon, May 14, 2012 at 7:38 AM, Friedman, Roger (CDC/CGH/DGHA) (CTR) <[hidden email]> wrote:

For the lab module on which I am working, I need to generate unique IDs for lab orders, specimens and reports.  These IDs should be in a user-specified format containing some or all of the following elements: patient ID, current year, current month, current day, sequential number, check digit, string constant.  I am trying to decide on how the user is to specify this: a pattern stored in a global property, some sort of interpretable scripting language, a groovy snippet, whatever.  Does anybody have any suggestions, patterns to follow, examples?  


[hidden email] from OpenMRS Developers' mailing list