Skip to content

#176 - smart output file renaming#177

Open
Cubix33 wants to merge 1 commit intofireform-core:mainfrom
Cubix33:smart-output-renaming
Open

#176 - smart output file renaming#177
Cubix33 wants to merge 1 commit intofireform-core:mainfrom
Cubix33:smart-output-renaming

Conversation

@Cubix33
Copy link

@Cubix33 Cubix33 commented Mar 3, 2026

Closes #176

📝 Description

This PR introduces Smart Output Renaming, replacing static timestamped filenames with dynamic, context-aware names based on the data extracted by the LLM.

🛠️ Key Changes

  • filler.py: Refactored the fill_form method to run the LLM extraction before generating the output filename.
  • Regex Sanitization: Added a robust string cleaner using the re module to strip illegal file characters and convert spaces to underscores, ensuring safe saves across all operating systems.
  • Dynamic Naming Logic: The script now searches the JSON dictionary for common identifiers (e.g., "Employee's name", "Name"). If found, it appends this to the base filename.
  • Fallback Preserved: If the LLM fails to extract a name (or returns "-1"), the system safely falls back to the original _YYYYMMDD_HHMMSS_filled.pdf format.

📸 Evidence

Before:
temp_outfile_20260304_120000_filled.pdf

After:
temp_outfile_John_Doe.pdf

🧪 Quality Check

  • Tested with standard names (John Doe).
  • Tested with special characters/plural lists (safely extracts the first string and removes illegal chars).
  • Tested fallback logic when no name is present in the transcript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT]: Smart Output Renaming based on Extracted LLM Data

1 participant