Conversation
Structural refactor only — no behavior change. Storage-agnostic pieces of the AI-interpretation pipeline move into a sibling package (../fairscape_interpret) so the forthcoming fairscape-cli can share the same code without duplicating prompts, scoring, and condensation heuristics that iterate rapidly. - pyproject.toml: add fairscape_interpret as editable [tool.uv.sources] - crud/interpretation.py: 1650 -> 1066 lines; imports helpers/prompts from fairscape_interpret instead of defining them inline - crud/condensation.py: 1020 -> 317 lines; keeps only Mongo-specific glue (BFS batch loader + condensed-crate persistence); condensation algorithm itself lives in fairscape_interpret.pipeline.condense - crud/fairscape_request.py: re-exports flexible_ark_query from the shared package; FairscapeRequest class unchanged - models/annotated_computation.py: 298 -> 44-line re-export shim - models/annotated_evidence_graph.py: 119 -> 22-line re-export shim Ports + orchestrators + Mongo adapters land in Phase 1. See ../fairscape_interpret/MIGRATION.md for full plan and tracking. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds crud/interpret_adapters.py with four Mongo-backed adapters satisfying the shared package's port protocols: MongoGraphSource -> GraphSource MongoResultSink -> ResultSink MongoTaskTracker -> TaskTracker ServerSoftwareFetcher -> SoftwareFetcher Behavior is faithful to the pre-refactor interpretation.py + condensation.py: StoredIdentifier wrapping, hasCondensedROCrate / hasAnnotatedEvidenceGraph back-pointers, evi:annotatedBy reverse links, and the /software/download/ endpoint fetch with baseUrl->internalUrl rewrite + GitHub fallback. No call sites wired yet — Phase 1 #11 will rewire the CRUD classes to use these adapters. MongoGraphSource composes a FairscapeCondensationRequest instead of inheriting from it, to keep the adapter's public surface limited to port methods only. See fairscape_interpret/MIGRATION.md decisions log for the full rationale.
…ers.
interpret_rocrate (1066 -> 88 lines): load task config, build four
Mongo adapters + Condenser + Interpreter, dispatch to run_sync. Module
re-exports (_build_index, _is_computation, _is_rocrate_root,
_resolve_refs, prefetch_software_code, GraphSynthesisResult, httpx)
keep the existing test file importable.
condense_rocrate (317 -> 251 lines total): pre-check 409, hand off to
Condenser.condense, map ValueError to 404 and other exceptions to 500.
build_full_graph_for_rocrate and delete_condensed_rocrate unchanged.
Lazy-imports the Mongo adapter module inside the method to break the
condensation <-> interpret_adapters cycle.
MongoResultSink: track last_stats in persist_condensed so the thin
wrapper can return {condensed_id, stats} to the Celery worker without
widening the ResultSink port.
pyproject dep + uv.sources path and all import sites under crud/, models/, tests/crud/ updated to the renamed package. Behavior unchanged. See fairscape_graph_tools/EVIDENCE_GRAPH_MIGRATION.md for the coordinated rename across mds_python, fairscape-cli, and the shared package.
EvidenceGraph core + pure projection helpers now live in fairscape_graph_tools. This module re-exports EvidenceGraphCreate / EvidenceNode straight and subclasses the shared EvidenceGraph to re-attach the legacy Mongo-aware build_graph method. crud/evidence_graph keeps working unchanged; the subclass goes away in Phase 3 when that CRUD starts calling EvidenceGraphBuilder. EvidenceGraphBuildRequest and list_evidence_graphs_from_db stay here — both are Celery/Mongo-bound and explicitly server-only per the Phase 0 decision log in fairscape_graph_tools/EVIDENCE_GRAPH_MIGRATION.md. Control flow in the subclass's build_graph is identical to the original (output_nodes + start_rocrate_outputs captured pre-condense, same BFS, same projection order) to keep the server byte-identical ahead of the Phase 3 regression test.
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.
No description provided.