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: dev@openmrs.org [mailto:dev@openmrs.org] On Behalf Of Burke Mamlin Sent: Monday, May 14, 2012 8:39 AM To: openmrs-deve...@listserv.iupui.edu 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<https://wiki.openmrs.org/x/bxIz> 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) <r...@cdc.gov<mailto:r...@cdc.gov>> 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? ________________________________ Click here to unsubscribe<mailto:lists...@listserv.iupui.edu?body=SIGNOFF%20openmrs-devel-l> from OpenMRS Developers' mailing list