-
-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sentinel needs to support these patient_id use cases #3166
Comments
We will need to change sentinel so it processes person documents. We should remove the document restriction, and just update all of the existing transitions to ignore documents appropriately (some may already do so by the nature of their filters) |
If we were to use the same trigger, the person creation forms could be easily modified to result in a "registrations": [
{
"form": "person_create",
"events": [
{
"name": "on_create",
"trigger": "add_patient",
"params": "",
"bool_expr": ""
}
]
}, |
This allows us to use sentinel for all normal (not deleted or ddoc) documents.
Step 1: change sentinel so it passes allows transitions to transition all types of documents. @garethbowen please review and merge medic/medic-sentinel#111 when ready. I'm keeping this ticket open and working on it, but let's get this chunk out and done with. |
This allows us to use sentinel for all normal (not deleted or ddoc) documents. medic/cht-core#3166
Nice. Merged. Assigning back to you, |
I think adding |
Actually @abbyad would you expect this to just run on any person that was created? That would generate ids for CHPs as well, right? |
@abbyad for the third bullet point (using Enketo -> existing external[1] patient id onto new contact.) do we need to do anything here? Can enketo forms already be configured to store something at |
Correct. Although I don't see harm in it coming from the same transition
Projects that use IDs for CHWs are more likely to use an external ID, such as their "Health Worker Registry" number. Given that, I don't think we would need to create an ID for everyone in every project. If we did we might exhaust possible numbers a bit quicker, and it would mean that app workflow only projects get an unnecessary ID for patients. That may not be a problem, and may make things more consistent that every person and place has a short form ID to refer to it.
Yes, we can already do this. In this case we couldn't verify that it is unique, but that is likely fine. |
Added a WIP branch to check in code I'm working through that allows support for third party ids: https://github.com/medic/medic-sentinel/tree/3166-external-id-support |
* Generate patient_id on patients New sentinel transition that adds a patient_id to each person document that does not already contain one. This allows patients created via XForms to be used via SMS. It will also allow CHWs to be referred to via SMS in the future if a partner wishes to do so. * Auto-lengthen ids generated To support an increase in ids, and to remove a production issue where sentinel runs out of generatable ids, we now auto-lengthen the patient ids we generate. We attempt to create 5 randomly generated ids, and if all of them are already used by patients we up the length of ids we're generating by 1 and try again. This will auto-increase as they are used up to a maximum of 14, which is in the area of a million billion ids, so I'm sure it's fine for now™. * Drop support for id_format Dropping support for this setting allows us to more easily support ids that auto-lengthen when required. id_format was not used by any existing partners, with the exception of fixing the aforementioned issue with Sentinel running out of ids. Tickets: - medic/cht-core#3166 - medic/cht-core#3000 - medic/cht-core#3230
@garethbowen can you please review the code: medic/medic-sentinel#116 I have no idea where to put the following documentation. I started writing out markdown documentation to cover things, and then realised that it's sort of half-covered by Additional documentation
|
I don't think there is sufficient place to document this in |
OK let's get this all clear, because there are lots of fragmented things flying around. @garethbowen, can you approve (you may have seen this stuff before):
Once these are cool I'm going to merge medic/medic-sentinel#117 into medic/medic-sentinel#116, then hopefully be able to test properly with a good local environment, and then merge into master. |
@SCdF Nice one. One small change requested on each of the last two PRs. Merge when fixed! |
* Generates patient_id on patients medic/cht-core#3166 We now support external ids instead of using our own. * Better optimisation of id generation medic/cht-core#3231 ID generation is now encapsulated in an ES6 generator, which manages state, id length and id validity compared to existing ids. The generator caches chunks of up to 100 ids: 100 are randomly generated and then validated to not already be used by CouchDB. Id length is increased automatically if all 100 of the ids that were randomly generated are already used in CouchDB. NB: this implies that this generator is system-wide, and is the only tool generating ids.
OK everything is merged with the exception of the documentation stuff, which Gareth and I will talk about on Monday, and then I'll almost certainly merge it then. |
OK merged documentation. Donnnnnnnnnnnne. |
Any clue on how to AT this @abbyad ? |
Has this already been released? |
Looks like it has been release @abbyad.... |
Yes this has been released, looks like 2.11.1. However, it hasn't been AT'd ;-) |
There are various ways that
patient_id
gets set, we need to support them all. We currently support:We need to also support:
patient_id
to contacts created using app #3000This ticket may have code against it, or it may just link to other tickets that take care of this.
[1] internal being a patient id we generate, external being one that we are given. At least for this ticket we are presuming that a) we are given unique patient ids, and b) they fit whatever validation scheme is configured.
The text was updated successfully, but these errors were encountered: