Add OSFI speeches ingestion R script and README for recurring RAG pipeline - #6
Add OSFI speeches ingestion R script and README for recurring RAG pipeline#6charles-hebert wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e12640a617
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| new_or_changed <- live_listing |> | ||
| left_join(upserted_catalog |> select(url, content_hash), by = "url") |> | ||
| filter(is.na(content_hash)) |
There was a problem hiding this comment.
Re-fetch speeches when existing URLs change
The selection for new_or_changed only keeps rows where content_hash is NA, so once a speech URL has been ingested once it is never fetched again even if OSFI edits the page content at that same URL. In that scenario, speech_catalog.csv, speech_chunks.csv, and speech_chunk_vectors.jsonl stay stale indefinitely, which breaks the script’s stated “new or changed” ingestion behavior.
Useful? React with 👍 / 👎.
Motivation
Peter RoutledgeandBen Gully) so chunks can be filtered by speaker.Description
osfi_speeches_ingest.R, an Rscript that discovers paginated OSFI speech listings, extracts listing metadata, downloads speech bodies, normalizes text, detects the speaker, chunks content and generates per-chunk embeddings using a deterministic hash backend.speech_catalog.csv,speech_chunks.csv, per-chunk JSONL vectors atvectors/speech_chunk_vectors.jsonl, plain-text files undertext/, and arun_log.csv; the catalog setsremoved_noticed_datewhen a known URL is no longer present on the live listing.extract_card_nodes,extract_listing_entry,extract_best_content_node,clean_body_text), speaker extraction logic (detect_speaker), and chunking/embedding helpers (split_into_chunks,hash_embedding).OSFI_DATA_DIR,OSFI_VECTOR_BACKEND,OSFI_VECTOR_DIM,OSFI_CHUNK_SIZE,OSFI_CHUNK_OVERLAP, andOSFI_USER_AGENT.README_osfi_speeches.mddocumenting outputs, scheduling examples forcronandn8n, and recommended vectorization upgrade paths (OpenAI or local models).Testing
git diff --checkand repository static checks with no reported whitespace or diff errors.removed_noticed_date,detect_speaker <- function,hash_embedding <- function,html_elements("main h3 a"),speech_chunk_vectors.jsonl,split_into_chunks <- function) and those checks passed.Rscript/R is not available in the execution environment, so runtime validation was not performed.Codex Task