Add OpenAI two-pass extraction pipeline with QC, compaction, and review integration#241
Open
karilint wants to merge 14 commits intocodex/prepare-implementation-plan-for-recode-extractionfrom
Conversation
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.
Motivation
Description
recode_extraction.adapters.openai_client.OpenAITwoPassClientand prompt builders inopenai_two_pass_prompts.py, plus lightweight service exports inopenai_two_pass.py.recode_extraction.services.orchestrator.RecodePipelineRunnerwith a newopenai_two_passpath that runs per-page PASS1 calls, compacts evidence (pass1_compaction.py), runs PASS2, runs QC/normalization (qc.py), and persists candidateExtractedAssertionModelrows; add timing logs and safer page-number handling.trait_vocabulary.pyto build abbreviation dictionaries and trait lists from the DB, cached for performance.pass1_evidence_package,pass2_structured_package,qc_summary,qc_errorsand extendunmapped_reasonlength.RECODE_OPENAI_*settings insettings.py.services.reviewto accept prefilledets_payloadwhen persisting approved assertions and to validate presence of review columns at runtime.base_validation.py.BaseImporter.get_or_create_source_locationto handleNonevalues and database schema drift whencoord_textlacks a default.openaiandpydanticand a collection of unit tests and fixtures covering adapter, compaction, QC/normalization, orchestrator flows, review persistence, and importer edge cases.Testing
app/tests/recode_extraction/test_openai_two_pass_pipeline.py,test_openai_client_adapter.py,test_openai_qc_normalization.py,test_openai_schema.py,test_pass1_compaction.py,test_openai_two_pass_pipeline.py, and updated review/importer tests, and they all passed.app/tests/recode_extraction/test_orchestrator.py,test_qc_review.py) which succeeded and show timing logs and new persistence behaviors.mock_openaifixture inapp/tests/recode_extraction/conftest.pyto avoid live API calls during tests.Codex Task