Repository navigation
Refactor/reduction - #9
Merged
Merged
Conversation
Split json_reduction into the ingest package: extract.py (MultiQC unwrap with generic-JSON fallback), annotate.py (descriptor overlay, now optional; MultiQC spatial_neighbors/co_occurrence merging stays opportunistic), and io_utils.py (path/JSON I/O only). check_env.py's descriptor check is now informational since annotation no longer requires it. Adds tests/test_ingest.py covering the MultiQC-unwrap and generic-passthrough behavior.
The glossary (load_glossary/build_glossary_context/_collect_report_labels) only ever defined labels from the bundled example dataset, so it doesn't generalize to arbitrary input. Dropped from the system prompt entirely.
llmize.py: input JSON is no longer assumed to be MultiQC-only (help text, descriptor loading is fail-soft when the path is missing). Updated all references in README, copilot-instructions, CI workflow, Dockerfile, docker/entrypoint.sh, main.nf, and nextflow.config to match the ingest/ package layout and the new entrypoint name.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved moderate issues remain in generic-section handling, glossary preservation, and Nextflow descriptor handling.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Refactors preprocessing into the modular ingest package, renames the entrypoint to llmize.py, and adds generic section-keyed JSON support.
Changes:
- Splits I/O, extraction, and annotation responsibilities.
- Updates Docker, Nextflow, documentation, and CI.
- Adds ingest tests and optional descriptor handling; removes glossary integration.
File summaries
| File | Summary |
|---|---|
tests/test_ingest.py |
Adds extraction and annotation tests. |
tests/__init__.py |
Adds a test package marker. |
README.md |
Documents the new entrypoint, package layout, and generic JSON support. |
nextflow.config |
Updates the descriptor schema path. Moderate (1 vote): Missing descriptors still fail during staging. |
main.nf |
Uses llmize.py and updates input messaging. Moderate (1 vote): Descriptor handling remains mandatory before fallback can run. |
llmize.py |
Uses the new ingest API and optional descriptor handling. Nit (1 vote): Missing descriptors do not emit the documented warning. |
json_reduction/cell_type_glossary.json |
Removes the legacy glossary asset. |
interpret.py |
Removes glossary prompt context. Moderate (3 votes): Existing glossary definitions are lost. |
ingest/io_utils.py |
Adds path resolution and JSON I/O utilities. |
ingest/extract.py |
Adds MultiQC extraction and generic passthrough. |
ingest/descriptor_schema.json |
Adds the relocated descriptor schema. Nit (3 votes): Contains “once” instead of “ones.” |
ingest/annotate.py |
Adds annotation and merging logic. Moderate (1 vote): Broad substring matching can transform unrelated generic sections. |
ingest/__init__.py |
Re-exports the ingest public API. |
Dockerfile |
Updates the container entrypoint. |
docker/entrypoint.sh |
Runs llmize.py. |
check_env.py |
Treats the descriptor schema as optional. |
.github/workflows/test.yml |
Adds unit-test execution and updates compile checks. |
.github/copilot-instructions.md |
Updates development guidance. Nit (3 votes): References nonexistent ingest/main.py. |
Review details
Suppressed comments (4)
ingest/annotate.py:100
- Because
annotate()now accepts arbitrary section-keyed JSON, the existing substring classification ("spatial_neighbors" in section/"co_occurrence" in section) can capture unrelated generic sections such asmy_spatial_neighbors_summary. Those sections are then renamed/reshaped (and co-occurrence payloads can be dropped), contradicting the promised generic passthrough; restrict the special cases to the documented MultiQC section names and numeric suffixes.
llmize.py:173 - When the descriptor path is missing, this expression silently substitutes
{}. The PR description says the optional-schema fallback emits a warning, but a normalllmize.pyrun gives no indication that all sections are being left unannotated; please log a warning on this fallback (the environment check does not cover ordinary runs).
main.nf:40 - The CLI now treats a missing descriptor as valid, but this Nextflow process still requires and stages
descriptorviachannel.fromPath(..., checkIfExists: true)beforellmize.pyruns. A missing custom descriptor therefore fails the workflow instead of reaching the{}fallback described by this refactor; make the descriptor input/channel optional and add--descriptoronly when it exists.
python3 ${home}/llmize.py \\
nextflow.config:5
- The Python entry point now treats a missing descriptor as optional, but the Nextflow workflow still stages
params.descriptorwithcheckIfExists: true, so a missing descriptor fails beforellmize.pycan apply this fallback. Make the Nextflow descriptor input conditional too, or scope the optional-file claim to direct invocation.
descriptor = "${projectDir}/ingest/descriptor_schema.json"
- Files reviewed: 16/18 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Split into Nextflow (containerized, recommended) vs direct-Python run paths since the local venv/Ollama setup steps only apply to the latter (and the native Nextflow profile). Documents llmize.py's direct CLI usage, updates the CI description to match the current workflow (compileall + unittest + check_env), and fixes remaining ingest/ path references.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request restructures and generalizes the preprocessing pipeline, renaming and reorganizing modules to improve clarity, modularity, and support for both MultiQC and generic section-keyed JSON input. The main entrypoint is renamed, and the extraction, annotation, and I/O logic are now split into clear, single-responsibility modules under the new
ingestpackage. Documentation and CI instructions are updated to reflect these changes, and the pipeline is now more robust to missing optional files and non-MultiQC data.Major pipeline and API restructuring:
pipeline.pytollmize.py, and all references in documentation, Docker, and CI are updated accordingly. [1] [2] [3] [4]json_reductiontoingest, splitting responsibilities intoio_utils.py(I/O and path resolution),extract.py(input flattening/extraction), andannotate.py(section annotation and MultiQC-specific merging). The public API is re-exported fromingest/__init__.py. [1] [2] [3] [4]annotate()) now accepts any section-keyed JSON, with descriptor schema being optional; if missing, sections are passed through unannotated instead of failing. [1] [2]Documentation and CI updates:
llmize.pyentrypoint andingest/package. The documentation now clearly states that the pipeline supports both MultiQC and generic JSON, and describes the new module structure and conventions. [1] [2] [3] [4] [5]Improved flexibility and error handling:
These changes make the pipeline easier to maintain, extend, and use with a wider range of input data.