📝 Technical Documentation: Intelligent Document Insight System
Framework: TAJ (Think → Ask → Judge → Accomplish) Architectural Model
Target Use Case: Automated Resume Screening & Talent Pipeline Filtering
Author/Developer: AI Engineering Student Portfolio
Target Use Case: Automated Resume Screening & Talent Pipeline Filtering
Author/Developer: AI Engineering Student Portfolio
🗺️ Project Overview & Architecture Blueprint
The Intelligent Document Insight System shifts away from chaotic, manual "one-shot prompting" toward a reliable, multi-step automated data processing pipeline. The system handles raw, unstructured candidate resumes (PDFs and Text files), segments them to preserve context, applies strict skill-based matching rules, structures unstructured data into predictable JSON profiles, runs safety gates for missing values, and exposes this pipeline to an interactive user workspace.
🏗️ Complete End-to-End System Architecture
🛠️ Phase-by-Phase Execution Log & Decisions Taken
Module 1: Preprocessing & Data Ingestion Layer
- Action Taken: Programmatically isolated raw text streams from file uploads and removed system layout formatting artifacts.
- Tool Chosen:
pypdf(PdfReader) for fast native Python data stream extraction. - Architectural Decision: Implemented a regular expression filter (
re.sub(r'\n+', '\n', text_content)) to collapse multiple erratic whitespace gaps into uniform line breaks, preventing token bloat. - Next-Step Connection: Passed the cleaned, unified text block directly into the split sequencer.
Module 2: Chunking Engine
- Action Taken: Fragmented large document data streams into predictable processing units to prevent LLM context-window degradation.
- Tool Chosen: Pure Python character-based looping indices.
- Architectural Decision: Set a strict window size boundary of 500 characters paired with a trailing 50-character overlap. This 10% overlap acts as a context bridge, ensuring critical candidate terms (like job spans or compound skill sets) are not clipped midway at chunk boundaries.
- Next-Step Connection: Populated a structured dictionary array (
[{"chunk_id": X, "text": Y}]) to pass downstream.
Module 3 & 6: Intelligence & Output Structuring Layer
- Action Taken: Applied programmatic models over independent chunks to strip out explicit metadata elements.
- Tool Chosen:
OpenAI API (gpt-4o-mini)integrated withPydanticcore typing rules. - Architectural Decision: Abandoned standard text generation prompts. Adopted OpenAI's Native Structured Outputs API (
client.beta.chat.completions.parse) paired with a rigidCandidateProfilePydantic class. This guarantees that the LLM will never return loose text, forcing it to align with predictable JSON arrays or explicitly fail. - Next-Step Connection: Dispatched structured chunk-level profile classes into the text matrix synthesiser.
Module 4: Aggregation Layer
- Action Taken: Consolidated isolated micro-insights from disjointed chunks back into a unified document profile.
- Tool Chosen: Native Python Data Structures (
setexpressions & list comprehensions). - Architectural Decision: Extracted duplicate profile fields (e.g., if a skill or school was mentioned in three separate chunks) by converting them into Python
setsand casting them back to lists. This cleanly prevents data duplication without making unnecessary extra LLM calls. - Next-Step Connection: Handed the unified, aggregated single record to the system auditor.
Module 5: Query Layer
- Action Taken: Filtered text chunks prior to LLM processing to reduce token consumption and eliminate data noise.
- Tool Chosen: Python case-insensitive string parsing (
keyword.lower() in chunk.lower()). - Architectural Decision: Selected a fast, deterministic keyword-matching query tool instead of a heavy vector database (like FAISS/ChromaDB). This matches the requirements of resume processing perfectly, where recruiters need to verify explicit skill sets (e.g., "Python") rather than general semantic similarities. Included a fallback safety mechanism: if no keywords match, the system passes all chunks to ensure candidate info is never dropped.
- Next-Step Connection: Filtered chunks to reduce LLM workloads in Modules 3 & 6.
Module 7: Validation & Reliability Layer
- Action Taken: Engineered an automated data quality gate to catch incomplete AI extractions.
- Tool Chosen: Conditional logic checking criteria exceptions.
- Architectural Decision: Configured a data isolation rule: if vital identifiers like
candidate_name,education, orpast_job_titlesreturn as "Unknown" or empty, the record is immediately flagged and routed to a dedicated Human Review Queue. This protects production databases from corrupt data while keeping human workers in the loop. - Next-Step Connection: Dispatched clear records to the UI dashboard and flagged items to the review holding panel.
Module 8: MVP Build & User Interface Layer
- Action Taken: Wrapped the entire pipeline logic into an intuitive, functional dashboard.
- Tool Chosen: Streamlit interactive Python framework.
- Architectural Decision: Designed a dual-tab configuration split into a Verified Insights Dashboard and a Human Review Queue. Added a manual "Force Approve" feature to the review queue, letting human recruiters override pipeline flags and move patched profiles to production instantly.
💻 Complete Monolithic Implementation Source Code
This file integrates all layers of the Intelligent Document Insight System into a single runnable codebase.
st.write("Matched Skills:")
if profile('skills_found'):
for skill in profile('skills_found'):
st.caption(f"✔️ {skill}")
else:
st.write("None matched.")
if profile('skills_found'):
for skill in profile('skills_found'):
st.caption(f"✔️ {skill}")
else:
st.write("None matched.")
with col2:
st.write(f"Executive Summary: {profile('executive_summary')}")
st.write(f"Past Roles: {', '.join(profile('past_job_titles'))}")
st.write(f"Education Details: {', '.join(profile('education'))}")
if profile('certifications'):
st.write(f"Certifications: {', '.join(profile('certifications'))}")
else:
st.info("No verified candidate files parsed yet. Upload documents on the sidebar panel to launch optimization processing.")
st.write(f"Executive Summary: {profile('executive_summary')}")
st.write(f"Past Roles: {', '.join(profile('past_job_titles'))}")
st.write(f"Education Details: {', '.join(profile('education'))}")
if profile('certifications'):
st.write(f"Certifications: {', '.join(profile('certifications'))}")
else:
st.info("No verified candidate files parsed yet. Upload documents on the sidebar panel to launch optimization processing.")
with tab_review:
if st.session_state.human_review_queue:
st.warning(f"There are {len(st.session_state.human_review_queue)} records that failed systemic verification gates.")
for index, review_item in enumerate(st.session_state.human_review_queue):
st.error(f"Incomplete Data Payload: Tracking File [{review_item('filename', })")
st.json(review_item('partial_data'))
if st.session_state.human_review_queue:
st.warning(f"There are {len(st.session_state.human_review_queue)} records that failed systemic verification gates.")
for index, review_item in enumerate(st.session_state.human_review_queue):
st.error(f"Incomplete Data Payload: Tracking File [{review_item('filename', })")
st.json(review_item('partial_data'))
# Simple override simulation button to demonstrate moving elements manually to production
if st.button(f"Force Approve File Record {index+1}", key=f"btn_{index}"):
# Patch record names if needed
if review_item('partial_data')('candidate_name') in ("Unknown", "Unknown Name"):
review_item('partial_data')('candidate_name') = f"Manual Verification Needed ({review_item('filename')})"
st.session_state.processed_profiles.append(review_item('partial_data'))
st.session_state.human_review_queue.pop(index)
st.rerun()
else:
st.success("Clear Skies! Review desk queue is empty. All processed files cleared the validation safety checks.")
if st.button(f"Force Approve File Record {index+1}", key=f"btn_{index}"):
# Patch record names if needed
if review_item('partial_data')('candidate_name') in ("Unknown", "Unknown Name"):
review_item('partial_data')('candidate_name') = f"Manual Verification Needed ({review_item('filename')})"
st.session_state.processed_profiles.append(review_item('partial_data'))
st.session_state.human_review_queue.pop(index)
st.rerun()
else:
st.success("Clear Skies! Review desk queue is empty. All processed files cleared the validation safety checks.")

No comments:
Post a Comment