pipeline
¶
Modules:
Classes:
-
AuditEntry– -
BaseSkill– -
ChannelManifest– -
Inquiry– -
PipelineContext– -
Session– -
Skill– -
SkillMetadata– -
SkillRegistry– -
Stage– -
StageRunner–
Functions:
AuditEntry
¶
Bases: BaseModel
BaseSkill
¶
BaseSkill(metadata: SkillMetadata)
Methods:
-
check_requirements– -
execute– -
post– -
pre–
Source code in src/hiperhealth/pipeline/skill.py
check_requirements
¶
check_requirements(
stage: str, ctx: PipelineContext
) -> list[Inquiry]
Override to return a list of Inquiry objects describing what additional data the skill needs. The default implementation returns an empty list (no extra data needed). Inquiries use three priority levels: - required: must have before this stage can run - supplementary: improves results, available now - deferred: only available after a future pipeline step parameters: stage: type: str ctx: type: PipelineContext returns: type: list[Inquiry]
Source code in src/hiperhealth/pipeline/skill.py
execute
¶
execute(
stage: str, ctx: PipelineContext
) -> PipelineContext
Source code in src/hiperhealth/pipeline/skill.py
post
¶
post(stage: str, ctx: PipelineContext) -> PipelineContext
Source code in src/hiperhealth/pipeline/skill.py
pre
¶
pre(stage: str, ctx: PipelineContext) -> PipelineContext
Source code in src/hiperhealth/pipeline/skill.py
ChannelManifest
¶
Bases: BaseModel
Inquiry
¶
Bases: BaseModel
PipelineContext
¶
Bases: BaseModel
Serializable context that flows between independently executed stages. summary: |- Callers can serialize this to JSON between invocations that may happen hours or days apart, by different actors. attributes: patient: type: dict[str, Any] language: type: str session_id: type: str | None results: type: dict[str, Any] audit: type: list[AuditEntry] extras: type: dict[str, Any]
Session
¶
System X creates or loads a session, provides clinical data, and uses the runner to assess / execute stages. The parquet file is the single source of truth. attributes: path: type: Path _language: type: str _events: type: list[dict[str, Any]]
Methods:
-
create– -
load– -
provide_answers– -
record_event– -
set_clinical_data– -
to_context– -
update_from_context–
Attributes:
-
clinical_data(dict[str, Any]) – -
events(list[dict[str, Any]]) – -
language(str) – -
pending_inquiries(list[Inquiry]) – -
results(dict[str, Any]) – -
stages_completed(list[str]) –
Source code in src/hiperhealth/pipeline/session.py
create
classmethod
¶
create(path: str | Path, language: str = 'en') -> Session
Source code in src/hiperhealth/pipeline/session.py
load
classmethod
¶
load(path: str | Path) -> Session
Source code in src/hiperhealth/pipeline/session.py
provide_answers
¶
Source code in src/hiperhealth/pipeline/session.py
record_event
¶
record_event(
event_type: str,
stage: str | None = None,
skill_name: str | None = None,
data: dict[str, Any] | None = None,
) -> None
Source code in src/hiperhealth/pipeline/session.py
set_clinical_data
¶
Source code in src/hiperhealth/pipeline/session.py
update_from_context
¶
update_from_context(
stage: str, ctx: PipelineContext
) -> None
Source code in src/hiperhealth/pipeline/session.py
Skill
¶
Bases: Protocol
Methods:
-
check_requirements– -
execute– -
post– -
pre–
check_requirements
¶
check_requirements(
stage: str, ctx: PipelineContext
) -> list[Inquiry]
Source code in src/hiperhealth/pipeline/skill.py
execute
¶
execute(
stage: str, ctx: PipelineContext
) -> PipelineContext
Source code in src/hiperhealth/pipeline/skill.py
post
¶
post(stage: str, ctx: PipelineContext) -> PipelineContext
Source code in src/hiperhealth/pipeline/skill.py
pre
¶
pre(stage: str, ctx: PipelineContext) -> PipelineContext
SkillMetadata
dataclass
¶
SkillMetadata(
name: str,
version: str = '0.1.0',
stages: tuple[str, ...] = (),
description: str = '',
)
SkillRegistry
¶
Methods:
-
add_channel– -
install_channel– -
install_skill– -
list_channel_skills– -
list_channels– -
list_skills– -
load– -
remove_channel– -
remove_skill– -
update_channel– -
update_skill–
Attributes:
-
registry_dir(Path) – -
root_dir(Path) –
Source code in src/hiperhealth/pipeline/registry.py
add_channel
¶
Source code in src/hiperhealth/pipeline/registry.py
install_channel
¶
Source code in src/hiperhealth/pipeline/registry.py
install_skill
¶
Source code in src/hiperhealth/pipeline/registry.py
list_channel_skills
¶
Source code in src/hiperhealth/pipeline/registry.py
list_channels
¶
Source code in src/hiperhealth/pipeline/registry.py
list_skills
¶
Source code in src/hiperhealth/pipeline/registry.py
1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 | |
load
¶
load(name: str) -> BaseSkill
Source code in src/hiperhealth/pipeline/registry.py
remove_channel
¶
Source code in src/hiperhealth/pipeline/registry.py
remove_skill
¶
Source code in src/hiperhealth/pipeline/registry.py
update_channel
¶
Source code in src/hiperhealth/pipeline/registry.py
1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 | |
update_skill
¶
Source code in src/hiperhealth/pipeline/registry.py
Stage
¶
Bases: str, Enum
Custom string stage names are also accepted by the StageRunner; this enum provides the standard built-in stages.
StageRunner
¶
StageRunner(
skills: list[Skill] | None = None,
registry: SkillRegistry | None = None,
)
Each stage can be run independently, at any time, by any actor.
The primary API is run() for single-stage execution.
run_many() is a convenience for sequential batch execution.
attributes:
_skills:
type: list[Skill]
_registry:
description: Value for _registry.
_disabled_skill_names:
type: set[str]
Methods:
-
check_requirements– -
disabled– -
register– -
run– -
run_many– -
run_session–
Attributes:
Source code in src/hiperhealth/pipeline/runner.py
check_requirements
¶
check_requirements(
stage: str,
session: Session,
*,
disabled_skills: str | Collection[str] | None = None,
**kwargs: Any,
) -> list[Inquiry]
Builds a PipelineContext from the session, calls
skill.check_requirements() for every skill registered
on the given stage, and records events in the session file.
Inquiries are returned with three priority levels:
- required: must have before this stage can run
- supplementary: improves results, available now
- deferred: only available after a future pipeline step
parameters:
stage:
type: str
session:
type: Session
disabled_skills:
type: str | Collection[str] | None
kwargs:
type: Any
variadic: keyword
returns:
type: list[Inquiry]
Source code in src/hiperhealth/pipeline/runner.py
disabled
¶
Disabled skills stay registered and installed, but are skipped during runner operations while the context is active. parameters: skill_names: type: str | Collection[str] returns: type: Iterator[None]
Source code in src/hiperhealth/pipeline/runner.py
register
¶
Looks up the skill in the attached SkillRegistry using either a
built-in name, a canonical channel skill id such as
tm.ayurveda, or a legacy installed skill name; then it
instantiates the skill and adds it to the execution list.
Pass index to control execution order.
parameters:
name:
type: str
index:
type: int | None
Source code in src/hiperhealth/pipeline/runner.py
run
¶
run(
stage: str,
ctx: PipelineContext,
*,
disabled_skills: str | Collection[str] | None = None,
**kwargs: Any,
) -> PipelineContext
Extra keyword arguments (e.g. llm, llm_settings)
are stored in ctx.extras['_run_kwargs'] so skills can
access them.
parameters:
stage:
type: str
ctx:
type: PipelineContext
disabled_skills:
type: str | Collection[str] | None
kwargs:
type: Any
variadic: keyword
returns:
type: PipelineContext
Source code in src/hiperhealth/pipeline/runner.py
run_many
¶
run_many(
stages: list[str],
ctx: PipelineContext,
*,
disabled_skills: str | Collection[str] | None = None,
**kwargs: Any,
) -> PipelineContext
Source code in src/hiperhealth/pipeline/runner.py
run_session
¶
run_session(
stage: str,
session: Session,
*,
disabled_skills: str | Collection[str] | None = None,
**kwargs: Any,
) -> Session
Builds a PipelineContext from the session, runs the stage
with the existing run() method, then writes results
back to the session parquet.
parameters:
stage:
type: str
session:
type: Session
disabled_skills:
type: str | Collection[str] | None
kwargs:
type: Any
variadic: keyword
returns:
type: Session
Source code in src/hiperhealth/pipeline/runner.py
create_default_runner
¶
create_default_runner() -> StageRunner
Uses the SkillRegistry to load and register built-in skills in the standard order: privacy, extraction, diagnostics. returns: type: StageRunner
Source code in src/hiperhealth/pipeline/__init__.py
discover_skills
¶
discover_skills(
group: str = 'hiperhealth.skills',
) -> list[BaseSkill]
Scans the hiperhealth.skills entry-point group for
pip-installed skill packages.
parameters:
group:
type: str
returns:
type: list[BaseSkill]