Improved auto-numbering of accessions and inventories
We use -1
in the numerical part of accession and inventory numbers (_number_part2
) to automatically assign the next available value.
The current implementation does not take into account numbers that were registered in the past and may assign the same number when the right conditions are met. Example: Accession INTRO 13
is renamed to ACC 9999
. If we now create a new INTRO -1
it will may assign INTRO 13
because it is not currently used.
We "log" inventoryNumber
and accessionNumber
as AccessionInvName with category SITE_ID
. The improved auto-numbering mechanism should generate a candidate number (same as current implementation), then check if there already exists a matching AccessionInvName
in category SITE_ID
. If so, then it should use the next available number.
For consideration
- We can't differentiate between accession and inventory in
AccessionInvName
withoutjoin Inventory i
and inspectingi.formTypeCode
. - [Performance] We may need to check many
AccessionInvName
records to determine a "free number". What optimizations can we use?