Skip to main content

Module credit_registration_events

Module credit_registration_events 

Source
Expand description

Append-only audit trail for the credit registration ledger.

No retention sweep touches this table, so every Suotar payload must go through scrub_suotar_body at the write site β€” redacting on read would leave the raw values on disk.

StructsΒ§

CreditRegistrationEvent
ErrorCodeWindowCounts
One error code’s standing over a window and the window before it.
NewCreditRegistrationEvent
NotImprovedAttainment
The attainment the study registry pointed at when it turned a submission down as no improvement.
SuotarItemOutcomeTotals
How the study registry answered the items it was asked about in a window.

EnumsΒ§

CreditRegistrationEventKind
KeyPolicy πŸ”’

ConstantsΒ§

NEVER_SCANNED_KEYS πŸ”’
Keys whose values the value scan must leave alone: they carry ids shaped like student numbers β€” cr-{uuid} request item ids, Sisu ids such as hy-CUR-135176012 β€” that the scan would mangle.
REDACTED
Replaces a redacted value; the key is kept so the payload shape survives.
REDACTED_KEYS πŸ”’
Keys whose values identify a person or authenticate a request. Matched case-insensitively at any depth.

StaticsΒ§

EMAIL_RE πŸ”’
STUDENT_NUMBER_RE πŸ”’
Student-number-shaped digit runs. The id shapes come first because the regex crate has no lookaround: leftmost-first alternation is the only way to say β€œdigits not part of an id”. The word boundaries keep the digit branch off longer numbers such as millisecond timestamps.

FunctionsΒ§

count_item_outcomes_since
Per-item outcomes in [since, now), counted over events rather than rows: an item that failed really failed, whatever its row has since become.
get_by_registration_id
The per-item timeline, newest first.
get_by_suotar_api_call_id
The per-item timeline entries one study registry call produced, oldest first: what the answer did to each row it covered.
get_error_code_counts_for_window
Error events per code over [now - 2 * window, now), split at now - window.
get_ids_with_several_submitted_attainments
Registrations whose answers named more than one submitted attainment id, which is the shape a double submission would leave behind.
get_not_improved_attainment
The registry’s verdict for a row it declined as no improvement. None for every other row, and for one whose answer named no attainment.
get_recent_by_kind
insert
Callers that also change state must go through credit_registrations::transition instead, which writes both in one transaction.
insert_batch
Inserts the same event on many rows in one round trip. Appends one event per element, in one statement. The column list is insert’s, so a batch writes the same rows a loop would.
insert_many
keep_scalars πŸ”’
Keeps bare ids and lists of ids, but hands objects back to scrub so an exemption cannot smuggle a nested error message past the value scan.
key_policy πŸ”’
normalize_key πŸ”’
scrub πŸ”’
scrub_free_text πŸ”’
scrub_suotar_body
Best-effort removal of personal data from a Suotar request or response body. Not a guarantee and not an exhaustive PII filter.
scrub_text
Scrubs a bare error message with the same rules as a JSON body.
string_field πŸ”’
suotar_exchange_details
Both sides of a Suotar exchange, scrubbed on construction so there is no way to build an unscrubbed details. The request is kept because the ledger row no longer reflects it after a retry.