ReadonlyserviceStable, human-readable name for the service. Must be set explicitly on each subclass
because this.constructor.name gets mangled by minification in production builds,
which breaks tracing/observability span names.
ProtectedrunProtectedspanOptional hook for subclasses to attach extra non-PII span attributes derived from params.
The returned attributes appear on the service.${serviceName} span (and, for jobs,
on job.enqueue.* and job.run.* spans too).
Safe ID-like keys on params (e.g. patientId, templateIds, limit, cursor) are
already auto-extracted via toSpanAttributes("service.input", params) — you don't need
to enumerate them here. Use this hook for derived/computed attributes (counts, flags,
computed names) or for fields you've explicitly verified safe but that aren't in the
global allowlist. Hook output overrides auto-extracted attributes on key collision.
Safe by default: returns {} when not overridden. Only declare keys you've confirmed
are non-PII. Never include emails, names, dob, free-text, etc.
ProtectedspanOptional hook for subclasses to attach extra non-PII span attributes derived from the
successful service result. Only called when run resolves successfully; on error, the
span is marked via markSpanError instead.
Safe by default: returns {} when not overridden. Only declare keys you've confirmed
are non-PII (e.g. counts, status flags, computed summaries). Never include emails,
names, dob, free-text, etc.
V2 port of the V1
generate-icd-codeedge function. Generates ICD-10 and/or DSM-5 code suggestions for a session based on its transcript + summary, then persists them asstatus: "suggested"entries on the session row.Per-type try/catch matches V1: one code type failing does not block the others. The result enumerates what succeeded and what failed so callers can log / surface partial failures without breaking the parent flow.
Chart-review (audit) generation is intentionally NOT done here — V2 handles that through
triggerSessionValidationsServiceinvoked bysaveGeneratedSessionNoteService, so this service only owns the codes half of what the V1 orchestrator used to do.