Ports
Pipeline ports implemented by source and destination adapters.
- class acmad_uploader.ports.pipeline.Extractor(*args, **kwargs)
Bases:
Protocol,GenericExtract source data without applying API-specific mapping.
- extract(source)
Extract
sourceinto an infrastructure-independent value.- Return type:
StageResult[TypeVar(ExtractedT)]
- class acmad_uploader.ports.pipeline.Transformer(*args, **kwargs)
Bases:
Protocol,GenericTransform extracted data into the canonical ACMAD representation.
- transform(extracted)
Validate and transform an extracted value.
- Return type:
StageResult[TypeVar(CanonicalT)]
- class acmad_uploader.ports.pipeline.Loader(*args, **kwargs)
Bases:
Protocol,GenericPersist canonical data through a destination adapter.
- load(canonical)
Persist a canonical value and return a destination result.
- Return type:
StageResult[TypeVar(LoadedT)]
Destination port for patient persistence.
- class acmad_uploader.ports.patient.PatientLoadAction(*values)
Bases:
StrEnumChange made to a patient at the destination.
- CREATED = 'created'
- UPDATED = 'updated'
- class acmad_uploader.ports.patient.PatientUpsertResult(site_patient_id, patient_url, action)
Bases:
objectResult returned by a patient destination adapter.
- site_patient_id: str
- patient_url: str
- action: PatientLoadAction
- exception acmad_uploader.ports.patient.PatientRepositoryError
Bases:
RuntimeErrorExpected patient persistence failure suitable for user reporting.
- class acmad_uploader.ports.patient.PatientRepository(*args, **kwargs)
Bases:
ProtocolCreate or update patient records without exposing HTTP concepts.
- upsert(patient)
Create a missing patient or update the existing identified patient.
- Return type:
Destination port for diagnosis persistence.
- class acmad_uploader.ports.diagnosis.DiagnosisLoadAction(*values)
Bases:
StrEnumChange made to a diagnosis at the destination.
- CREATED = 'created'
- UPDATED = 'updated'
- class acmad_uploader.ports.diagnosis.DiagnosisUpsertResult(site_patient_id, diagnosis_type, age_at_diagnosis_days, diagnosis_url, action)
Bases:
objectResult returned by a diagnosis destination adapter.
- site_patient_id: str
- diagnosis_type: DiagnosisType
- age_at_diagnosis_days: int
- diagnosis_url: str
- action: DiagnosisLoadAction
- exception acmad_uploader.ports.diagnosis.DiagnosisRepositoryError
Bases:
RuntimeErrorExpected diagnosis persistence failure suitable for user reporting.
- class acmad_uploader.ports.diagnosis.DiagnosisRepository(*args, **kwargs)
Bases:
ProtocolCreate or update diagnosis records without exposing HTTP concepts.
Diagnoses are matched by
(patient, diagnosis_type, age_at_diagnosis_days). Multiple primary diagnoses can exist for one patient at different ages; the destination determines which is “latest” from that history, so this port never sets or reasons about that flag.- upsert(diagnosis)
Create a missing diagnosis or update the existing matched one.
- Return type:
Destination port for gait assessment persistence.
- class acmad_uploader.ports.gait_assessment.GaitAssessmentLoadAction(*values)
Bases:
StrEnumChange made to a gait assessment event at the destination.
- CREATED = 'created'
- FOUND = 'found'
- class acmad_uploader.ports.gait_assessment.GaitAssessmentUpsertResult(site_patient_id, age_in_days, gait_assessment_url, action)
Bases:
objectResult returned by a gait assessment destination adapter.
- site_patient_id: str
- age_in_days: int
- gait_assessment_url: str
- action: GaitAssessmentLoadAction
- exception acmad_uploader.ports.gait_assessment.GaitAssessmentRepositoryError
Bases:
RuntimeErrorExpected gait assessment persistence failure suitable for user reporting.
- class acmad_uploader.ports.gait_assessment.GaitAssessmentRepository(*args, **kwargs)
Bases:
ProtocolCreate or find the patient event and gait assessment for one record.
Unlike patient upsert, a gait assessment has no writable fields beyond its event linkage, so a repeat run performs no write once the event and its assessment already exist; it only resolves and returns them.
- upsert(assessment)
Create a missing gait assessment or return the existing one.
- Return type:
Destination port for function assessment persistence.
- class acmad_uploader.ports.function_assessment.FunctionAssessmentLoadAction(*values)
Bases:
StrEnumChange made to a function assessment at the destination.
- CREATED = 'created'
- UPDATED = 'updated'
- class acmad_uploader.ports.function_assessment.FunctionAssessmentUpsertResult(site_patient_id, age_in_days, function_assessment_url, action)
Bases:
objectResult returned by a function assessment destination adapter.
- site_patient_id: str
- age_in_days: int
- function_assessment_url: str
- action: FunctionAssessmentLoadAction
- exception acmad_uploader.ports.function_assessment.FunctionAssessmentRepositoryError
Bases:
RuntimeErrorExpected function assessment persistence failure suitable for reporting.
- class acmad_uploader.ports.function_assessment.FunctionAssessmentRepository(*args, **kwargs)
Bases:
ProtocolCreate or update a function assessment without exposing HTTP concepts.
A function assessment is matched by its owning
gait_assessment(a one-to-one relationship), resolved from(site_patient_id, age_in_days).- upsert(assessment)
Create a missing function assessment or update the existing one.
- Return type:
Destination port for mocap session persistence.
- class acmad_uploader.ports.mocap_data.MocapDataLoadAction(*values)
Bases:
StrEnumChange made to a mocap session at the destination.
- CREATED = 'created'
- UPDATED = 'updated'
- class acmad_uploader.ports.mocap_data.MocapDataUpsertResult(site_patient_id, age_in_days, mocap_data_url, action)
Bases:
objectResult returned by a mocap session destination adapter.
- site_patient_id: str
- age_in_days: int
- mocap_data_url: str
- action: MocapDataLoadAction
- exception acmad_uploader.ports.mocap_data.MocapDataRepositoryError
Bases:
RuntimeErrorExpected mocap session persistence failure suitable for reporting.
- class acmad_uploader.ports.mocap_data.MocapDataRepository(*args, **kwargs)
Bases:
ProtocolCreate or update a mocap session without exposing HTTP concepts.
MocapDatahas no database-level natural key at all (many rows are allowed per gait assessment), so this port matches by(gait_assessment, session_condition, left_condition_detail, right_condition_detail)client-side — confirmed with the user that this combination is unique per day/assessment in practice.- upsert(session)
Create a missing mocap session or update the matched one.
- Return type:
Destination port for biomechanics artifact persistence.
- class acmad_uploader.ports.biomechanics_artifact.BiomechanicsArtifactLoadAction(*values)
Bases:
StrEnumChange made to a biomechanics artifact at the destination.
- CREATED = 'created'
- UPDATED = 'updated'
- SKIPPED = 'skipped'
- class acmad_uploader.ports.biomechanics_artifact.BiomechanicsArtifactUpsertResult(site_patient_id, age_in_days, original_path, artifact_url, action)
Bases:
objectResult returned by a biomechanics artifact destination adapter.
- site_patient_id: str
- age_in_days: int
- original_path: str
- artifact_url: str
- action: BiomechanicsArtifactLoadAction
- exception acmad_uploader.ports.biomechanics_artifact.BiomechanicsArtifactRepositoryError
Bases:
RuntimeErrorExpected biomechanics artifact persistence failure suitable for reporting.
- class acmad_uploader.ports.biomechanics_artifact.BiomechanicsArtifactRepository(*args, **kwargs)
Bases:
ProtocolCreate or update a biomechanics artifact file and its metadata.
Matched by
(mocap_data, original_path)— the destination’s own natural key.- upsert(artifact)
Create a missing artifact, update it, or skip an unchanged upload.
- Return type:
Destination port for physical examination + anthropometrics persistence.
- class acmad_uploader.ports.physical_examination.PhysicalExaminationLoadAction(*values)
Bases:
StrEnumChange made to a physical examination at the destination.
- CREATED = 'created'
- UPDATED = 'updated'
- class acmad_uploader.ports.physical_examination.PhysicalExaminationUpsertResult(site_patient_id, age_in_days, physical_examination_url, anthropometrics_url, action, detail_row_count)
Bases:
objectResult returned by a physical examination destination adapter.
- site_patient_id: str
- age_in_days: int
- physical_examination_url: str
- anthropometrics_url: str
- action: PhysicalExaminationLoadAction
- detail_row_count: int
- exception acmad_uploader.ports.physical_examination.PhysicalExaminationRepositoryError
Bases:
RuntimeErrorExpected physical examination persistence failure suitable for reporting.
- class acmad_uploader.ports.physical_examination.PhysicalExaminationRepository(*args, **kwargs)
Bases:
ProtocolCreate or update a physical examination and its detail rows.
PhysicalExaminationis matched by its owninggait_assessment(one-to-one), resolved from(site_patient_id, age_in_days).Anthropometricsis matched by its owningphysical_examination(also one-to-one). The side-keyed detail models (AnthropometricSide/RangeOfMotion/Strength/Tone/FootStructure) are each matched by(physical_examination, side).- upsert(examination)
Create a missing physical examination/detail rows, or update them.
- Return type:
Destination port for PROMs family persistence.
- class acmad_uploader.ports.proms.PromsLoadAction(*values)
Bases:
StrEnumChange made to the PROMs parent row at the destination.
- CREATED = 'created'
- UPDATED = 'updated'
- class acmad_uploader.ports.proms.PromsUpsertResult(site_patient_id, age_in_days, proms_url, action, faq_written, ofaq_count, podci_count, mgait_efficiency_count, walk12_count, goal_assessment_count)
Bases:
objectResult returned by a PROMs destination adapter.
- site_patient_id: str
- age_in_days: int
- proms_url: str
- action: PromsLoadAction
- faq_written: bool
- ofaq_count: int
- podci_count: int
- mgait_efficiency_count: int
- walk12_count: int
- goal_assessment_count: int
- exception acmad_uploader.ports.proms.PromsRepositoryError
Bases:
RuntimeErrorExpected PROMs persistence failure suitable for reporting.
- class acmad_uploader.ports.proms.PromsRepository(*args, **kwargs)
Bases:
ProtocolCreate or update a PROMs parent row and each child questionnaire.
PROMsis matched by its owninggait_assessment(one-to-one), resolved from(site_patient_id, age_in_days).FAQis matched by its owningproms(also one-to-one).OFAQ/PODCI/MGaitEfficiency/Walk12/GoalAssessmentare each matched by(proms, completed_by).- upsert(proms)
Create missing PROMs rows or update the matched ones.
- Return type:
Destination port for surgery/intervention episode persistence.
- class acmad_uploader.ports.surgery.SurgeryLoadAction(*values)
Bases:
StrEnumChange made to a surgery episode at the destination.
- CREATED = 'created'
- UPDATED = 'updated'
- class acmad_uploader.ports.surgery.SurgeryUpsertResult(site_patient_id, age_in_days, surgery_url, action, procedure_count)
Bases:
objectResult returned by a surgery destination adapter.
- site_patient_id: str
- age_in_days: int
- surgery_url: str
- action: SurgeryLoadAction
- procedure_count: int
- exception acmad_uploader.ports.surgery.SurgeryRepositoryError
Bases:
RuntimeErrorExpected surgery persistence failure suitable for user reporting.
- class acmad_uploader.ports.surgery.SurgeryRepository(*args, **kwargs)
Bases:
ProtocolCreate or update a surgery episode and its procedures.
Surgeryis matched by its owningpatient_event, resolved from(patient, event_type="surgery", age_in_days). EachSurgicalProcedurehas no natural key at the destination, so this port matches procedures client-side by(laterality, surgery_type, surgery_region, surgery_intervention).- upsert(surgery)
Create a missing surgery episode or update the matched one.
- Return type: