OptionalscopeWhen true, restrict each patient's runs to their LATEST treatment episode (newest
admission_date) or runs with no episode stamped (treatment_episode_id IS NULL). Runs tied to
a prior episode are excluded. Opt-in (the review dashboard sets it); other analytics consumers
leave it off so their behavior is unchanged.
Profiles to scope the query to.
nullmeans unrestricted (admin / superadmin or no provider filter requested). When set, a run is included only if the patient's creator profile OR primary provider is in this set.For non-admin callers, the TRPC layer intersects the user's accessible profiles with any user-requested profile filter and passes the result here.