Cognitive-rag / 01_data_ingestion / instructions.md
instructions.md
Raw

Task 1️⃣ Data Ingestion & Cleaning (Matthew)

Input

Raw knowledge base files such as PDFs, Word documents, HTML pages, Markdown files, or internal documentation. These files may come from different sources and contain inconsistent formatting, tables, headers, footers, and page numbers.

Details

The goal of this task is to load raw documents and convert them into clean, structured text while preserving traceability information such as page numbers, section titles, and document boundaries. Using LangChain loaders, the focus is on normalization, not simplification. The content should remain intact, readable, and attributable to its source.

Only disruptive artifacts introduced by file conversion should be removed, such as broken encoding, unreadable symbols, or duplicated boilerplate. Page numbers must be preserved so that downstream steps can reference exact locations within source documents.

Example (raw → cleaned structure):

RAW PDF TEXT:
Page 4
EMPLOYEE BENEFITS

Employees are entitled to parental leave of up to 12 weeks.
Page 5
Eligibility requirements include...

CLEANED STRUCTURED OUTPUT:
doc_id: HR_Handbook_2024
page: 4
section: Employee Benefits
content: Employees are entitled to parental leave of up to 12 weeks.

doc_id: HR_Handbook_2024
page: 5
section: Employee Benefits
content: Eligibility requirements include...

Output

Cleaned, structured text where each document is stored in a standardized format with metadata such as document ID, section, and page number. This output is passed directly to the chunking step.