docs: 7421 client-processing-documentation - #6549
Conversation
|
|
||
| The callbacks use `after_save` rather than `after_commit` deliberately: `after_save` gives reliable access to `saved_changes` within a transaction, at the cost of occasionally queuing a redundant rebuild if the transaction is later rolled back. The queue is de-duplicated so rapid edits do not pile up jobs. Shared queuing logic lives in `Hmis::Hud::Concerns::ServiceHistoryQueuer` (`drivers/hmis/app/models/hmis/hud/concerns/service_history_queuer.rb`). | ||
|
|
||
| ### Manual Rebuild Process | ||
|
|
||
| The steps below are required in two situations: targeted developer intervention, and **any console-level data fix**. When records are corrected directly via `update_columns`, `update_all`, raw SQL, or bulk import, the model callbacks do not fire — neither the processed-state clear nor the job enqueue happens automatically. The operator must perform both steps explicitly. | ||
|
|
||
| To manually trigger a service history rebuild for specific enrollments: | ||
|
|
||
| ```ruby | ||
| # Invalidate enrollment(s) - this clears the processed_as hash | ||
| enrollment.invalidate_source_data! |
There was a problem hiding this comment.
In HMIS code (and adhoc developer action), we run invalidate_processing! on the enrollment or set of enrollments. The logic is:
hmis-warehouse/app/models/concerns/hud_concerns/enrollment.rb
Lines 47 to 57 in 7627fed
It seems like the difference is:
invalidate_processing!clears bothprocessed_asandprocessed_hashon the specified enrollment(s)invalidate_source_data!clearsprocessed_ason the enrollment AND on any household member's enrollments
So I have a couple questions:
- Is it safe to say it is the callers responsibility to ensure that ALL household enrollments are invalidated when necessary (i.e. by using
invalidate_source_data!or invokinginvalidate_processing!for each member)? (There is no built-in logic to Service History Enrollment processing to ensure that all household members are reprocessed when one is invalidated?) - What is the significance of clearing
processed_hashvs not clearing it?
There was a problem hiding this comment.
Depending on the answers to those questions, probably worth adding something here about significance of reprocessing a whole household together.
I think an example is: one Enrollment in the household is deleted, leading to the household composition to change from 'adults with children' to 'adults only' (not exact terms, but we have something like that on SHE). In addition to the newly deleted Enrollment being reprocessed, all remaining Enrollments must also be reprocessed in order to reflect the updated composition of the household for those enrollments.
gigxz
left a comment
There was a problem hiding this comment.
great additions and clarifications, thank you!
Merging this PR
Description
Address documentation gaps around client processing. See issue description for details
Type of change
Documentation
Checklist before requesting review