I am using DHIS2 version 126.96.36.199
i configured the unique system identifier as follows:
When i entered a TEI the unique identifier in my case (registration number) was working fine. however when i wanted to delete a TEI for example registered with (DUH01-2022-00001) and wanted to enter another new TEI the unique identifier continues to (DUH01-2022-00002) rather than re-use the UID of the deleted one (DUH01-2022-00001).
The following images show that i have deleted all TEIs and when entering a new TEI the system unique identifier still continues from the last TEI entered.
is that normal? or does it require a different setup?
I see the issue. I thought that if I clear the cache and permanently remove the deleted tracked entity instances using the Data Administration app, the number will return but while testing, I found out that the number kept increasing.
I also found out while test that if you click on ‘register’ but don’t actually register, go back, the number will increment by 1. The autogenerated numbers are incrementing just by visiting the registration form even if the registration was not complete.
Will ask more about these two. Thank you for your post.
Hi @Haliz.t , @Gassim !
Thanks for raising this question - Let me clarify the implementation we have for generating values and some of the requirements they were based on:
- When I deleted a TEI, I was not able to reuse the unique identifier
This is by design. The generated ids are not reusable, they are generated once, then used (Or skipped). Due to the ecosystem of many DHIS2 implementations, we need to account for offline devices, which means we have no way of knowing when a value is no longer reserved, or if it has already been used. As a result, all values are one-time generated and will not be generated again (Unless you are using the “random” pattern, but I would highly recommend avoiding that)
In addition, we had a hard requirement for keeping the order of values as much as possible knowing that offline devices could in theory end up out of order. So assuming the values A->B->C, although B is reserved, but never used, as soon as C is used, B would be out of order and unable to be used again due to this requirement.
In other words, this is normal, and there is no support for reusing values right now.
- The numbers keep increasing without registering
This is a decision made in the front-end app. The app pre-fills the field, does not track whether it was used or not, and will generate a new one each time the form is rendered. This could be changed in the app, but it’s potentially quite a difficult task to decide when a value is no longer required or not, and we could get out of sync quite quickly.
Hope this clears up the questions
Thank you both so much for the great explanation… am very grateful