You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
I Luk Kim 722e5cf6a9 Add Oracle event_type vocabulary normalizer for fallback path
When the rule parser can't classify an 8-K and falls back to Stock Oracle's
filing-events API, Oracle's vocabulary (e.g. earnings_result, shareholder_vote,
regulation_fd) was being written verbatim into events.event_type. The DB has
no CHECK constraint (libs/db/models.py:189), so 22 distinct Oracle values
silently leaked into a column the strategy's engine filters expect to be in
its 4-event vocabulary. Result: ~1,069 live rows silently dropped from
strategy candidate pool.

Files:
 - NEW libs/parser/event_type_normalizer.py: normalize_oracle_event_type()
   with conservative synonym map; normalize_oracle_event() additionally
   uses _classify_event_type from rule_parser when an item_number is
   present (item-code path is more reliable than Oracle's event taxonomy)
 - MOD apps/pipeline/event_parser/main.py: oracle-fallback branch (~line
   140) now calls normalize_oracle_event before writing to DB; emits
   oracle_event_type_normalized log event when value changes
 - NEW tests/unit/test_event_type_normalizer.py: 60 tests covering
   identity, synonyms, case/separator insensitivity, None/empty,
   non-string, item_number-precedence

Mapping highlights (justifications in test docstrings):
 earnings_result/earnings_announcement/earnings -> earnings_release
 guidance_revision/guidance_change/regulation_fd -> guidance_update
 material_definitive_agreement/definitive_agreement -> material_contract
 shareholder_vote/acquisition_disposition/bankruptcy/other -> other_material_event

Reg FD -> guidance_update mirrors rule_parser's Item 7.01 mapping for
internal consistency. Debatable but auditable.

Conservative pass-through for ambiguous values (financial_obligation,
articles_amendment, contract_termination, etc., 14 distinct values).
Visible filter-drop > silent re-tag.

Live DB counts that would reclassify on a future --reparse pass:
 412 earnings_result -> earnings_release
 409 shareholder_vote -> other_material_event
 237 regulation_fd -> guidance_update
   7 acquisition_disposition -> other_material_event
   4 other -> other_material_event
TOTAL 1,069 rows currently in oracle-fallback dead-zone.

60/60 normalizer tests pass; combined parser+schema validator suite 86/86.

Follow-up flagged: run --reparse on historical oracle-fallback rows after
extending reparse_events() to also re-normalize known oracle-fallback
values (currently only re-parses event_type='unknown').

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
3 months ago
..
backtest Add reaction_close salvage variant to PeerSympathy engine 3 months ago
intraday Clean up superseded configs and commit accumulated R&D infrastructure 4 months ago
orb_trader Investigate compound mode: V23 is absolute champion in all modes 4 months ago
paper_trader Add three-tier VIX/FRED fallback to paper trader (strict-conservative) 3 months ago
tools Remove momentum breakout sleeve (overfitting, valid -31%) and revert related code 4 months ago
web Investigate compound mode: V23 is absolute champion in all modes 4 months ago
__init__.py feat: implement ACE-F v1 Phase 1 -- Stock Oracle 기반 이벤트 파이프라인 5 months ago
test_config.py feat: PEAD mid-cap strategy + pipeline hardening + README cleanup 5 months ago
test_continuation_snapshot.py Update tests for pipeline, backtest engine, paper trader, and new modules 5 months ago
test_db_models.py feat: implement ACE-F v1 Phase 1 -- Stock Oracle 기반 이벤트 파이프라인 5 months ago
test_enrich_catalyst_persistence_features.py Add ownership/risk-off sleeves, v17-v19 experiments, and web app restructure 4 months ago
test_enrich_earnings_history_features.py Add ownership/risk-off sleeves, v17-v19 experiments, and web app restructure 4 months ago
test_enrich_peer_surprise_features.py Add ownership/risk-off sleeves, v17-v19 experiments, and web app restructure 4 months ago
test_enrich_tier2_features.py Add ownership/risk-off sleeves, v17-v19 experiments, and web app restructure 4 months ago
test_ensemble_overlay_backtest.py Add ownership/risk-off sleeves, v17-v19 experiments, and web app restructure 4 months ago
test_event_features.py feat: PEAD mid-cap strategy + pipeline hardening + README cleanup 5 months ago
test_event_type_normalizer.py Add Oracle event_type vocabulary normalizer for fallback path 3 months ago
test_file_store.py feat: implement ACE-F v1 Phase 1 -- Stock Oracle 기반 이벤트 파이프라인 5 months ago
test_financial_features.py implement Phase 2 gap items: backfill CLI, retry, financial features 5 months ago
test_fred_service.py test: Phase 1/2 체크리스트 재작성 및 Oracle 실연동 통합 테스트 5 months ago
test_ids.py feat: implement ACE-F v1 Phase 1 -- Stock Oracle 기반 이벤트 파이프라인 5 months ago
test_labeler.py Fix label_price_unavailable: preserve future entry_dates as pending 3 months ago
test_llm_cache.py feat: implement Phase 3 -- LLM enrichment, labeler, review queue, dataset export 5 months ago
test_llm_client.py fix: disable Qwen3.5 thinking mode and switch OllamaClient to sync httpx 5 months ago
test_llm_parser_stub.py test: Phase 1/2 체크리스트 재작성 및 Oracle 실연동 통합 테스트 5 months ago
test_logging.py test: Phase 1/2 체크리스트 재작성 및 Oracle 실연동 통합 테스트 5 months ago
test_market_features.py feat: implement ACE-F v1 Phase 1 -- Stock Oracle 기반 이벤트 파이프라인 5 months ago
test_merged_snapshot.py Update tests for pipeline, backtest engine, paper trader, and new modules 5 months ago
test_merger.py feat: implement Phase 3 -- LLM enrichment, labeler, review queue, dataset export 5 months ago
test_oracle_client.py Add paper trader improvements, web GUI updates, and experiment registry cleanup 4 months ago
test_retries.py test: Phase 1/2 체크리스트 재작성 및 Oracle 실연동 통합 테스트 5 months ago
test_review_queue.py feat: implement Phase 3 -- LLM enrichment, labeler, review queue, dataset export 5 months ago
test_rule_parser.py Harden 8-K item-code classifier against dirty input strings 3 months ago
test_schema_validator.py feat: implement ACE-F v1 Phase 1 -- Stock Oracle 기반 이벤트 파이프라인 5 months ago
test_snapshot_export.py Add ownership/risk-off sleeves, v17-v19 experiments, and web app restructure 4 months ago
test_text_normalizer.py Update tests for pipeline, backtest engine, paper trader, and new modules 5 months ago
test_time_utils.py feat: implement ACE-F v1 Phase 1 -- Stock Oracle 기반 이벤트 파이프라인 5 months ago