Code Map
This page helps you locate code quickly: it describes the repository layout,
the responsibilities of habit/ subpackages, and where to start when
changing a particular feature.
Repository root
Path |
Contents |
|---|---|
|
Main Python package containing the application code. |
|
Example and production YAML configurations organized by subsystem. |
|
Demo data and generated artifacts, including images and ML tables. |
|
Windows lightweight-release entry points for installation, optional profiles, and the configured HABIT command prompt. |
|
Versioned third-party runtime executables used by the lightweight release. |
|
Pytest tests and executable demo scripts (see Contributor Workflow). |
|
Documentation; Sphinx sources are under |
|
Optional standalone Web GUI (FastAPI + React + bridge), not checked out
by default. See |
|
Build metadata and entry-point definitions
( |
habit/ package structure
flowchart TD
ROOT["habit/"]
ROOT --> CLI["cli.py — Click command group"]
ROOT --> CMD["commands/ — cmd_*.py (active CLI impl)"]
ROOT --> CORE["core/ — business logic"]
ROOT --> UTILS["utils/ — shared utilities"]
CORE --> COM["common/ — configs, configurators, contracts"]
CORE --> SCH["schemas/ — workflow & step schemas, registry, reflect"]
CORE --> PRE["preprocessing/"]
CORE --> HAB["habitat_analysis/"]
CORE --> MLC["machine_learning/"]
CORE --> DCM["dicom_sort/"]
COM --> CFG["configs/"]
COM --> CON["configurators/"]
COM --> REG["registry.py"]
COM --> ORC["orchestrator.py"]
Top-level package responsibilities
Package |
Responsibility |
|---|---|
|
Click root command group; subcommands are declared here and command bodies only perform lazy imports and forwarding. |
|
Active command implementation layer: each |
|
Cross-domain infrastructure: YAML loading and path resolution
( |
|
Pydantic configuration models for workflows, step parameters, parameter registration, validation, and GUI reflection. |
|
Batch image preprocessing: |
|
Habitat segmentation, clustering features, post-segmentation feature extraction, and traditional radiomics (see Subsystems). |
|
Tabular machine learning: data assembly, feature selection, modeling, evaluation, reporting, visualization, and statistical tests. |
|
Standalone DICOM sorting based on dcm2niix; it does not use
|
|
Shared utilities used across subsystems (see below). |
Cross-subsystem contract files
The following files define package-wide interface contracts. Update them and run the contract tests when adding a factory or orchestrator:
flowchart LR
REG["common/registry.py<br/>ClassRegistry"] --> PF["PreprocessorFactory"]
REG --> MF["ModelFactory"]
REG --> CF["ClusteringAlgorithmFactory"]
REG --> EF["FeatureExtractorRegistry"]
REG --> PP["PreprocessingMethodFactory"]
REG --> HF["HabitatFeatureFactory"]
ORC["common/orchestrator.py<br/>ORCHESTRATOR_CONTRACT"] --> BP["BatchProcessor"]
ORC --> HA["HabitatAnalysis"]
ORC --> HW["HoldoutWorkflow / ..."]
TST["tests/test_architecture_contracts.py"] -.-> REG
TST -.-> ORC
Where to start when changing X
Goal |
Starting point |
|---|---|
Add or modify a CLI command |
|
Add a preprocessing step |
|
Add a clustering algorithm |
|
Add a clustering feature extractor |
|
Add a machine-learning model |
|
Add a feature-selection method |
|
Change configuration fields or validation rules |
|
Change the three habitat pipeline strategies |
|
Change the ML training or prediction flow |
|
Add a class-based factory |
Subclass |
Add a top-level orchestrator for a new CLI pipeline |
Implement the class and update |
See also
See Extension and Plugin Guide for the complete extension and registration reference, and Customization and Extension Guide for implementation templates.