How dhananjayporwal/xml-to-pdf-converter-candor-investing works
Project Type and Purpose
• The project is a web-based data conversion tool, built with Streamlit.
• Its primary function is to let users upload XML files, process and parse them, convert the data into readable TXT and PDF formats (including generating a ZIP for multiple files), and view key extracted data in a summary table.
• The tool is designed for both local usage and deployment on cloud platforms (like Streamlit Cloud).
Analyzing the File Structure
• Top-level Files:
• app.py: The main application file that drives the Streamlit interface and implements the file upload, XML parsing, and conversion logic.
• requirements.txt, runtime.txt: Define software dependencies and runtime configuration for deployment.
• Procfile: Indicates how to run the app on certain cloud platforms.
• BulkConverter.ipynb: Likely serves as an exploratory notebook or demo of the conversion process.
• styles.css: Contains custom styles to enhance the app’s UI.
• Directories:
• .streamlit: Contains configuration files (e.g., config.toml) specific to how Streamlit should run and render the UI.
• .devcontainer: Provides development container settings (e.g., for VSCode) to ensure a consistent development environment.
Key Components and Architecture
• Frontend (User Interface):
• Built with Streamlit (code largely in app.py).
• Manages file uploads, displays the interactive summary table, and incorporates custom UI styling (styles.css).
• File Upload & Data Intake:
• Handles user-selected XML files.
• Includes input validations for multiple file uploads.
• Data Processing & Conversion:
• Contains routines for parsing XML and extracting required data (e.g., Name, Gender, PAN, DOB, etc.).
• Converts XML content into human-readable TXT files.
• Generates PDF files (using fpdf) that feature a formatted header (with the company logo) and additional styling.
• Temporary File Storage and Cleanup:
• Leverages temporary directories to hold uploaded as well as processed files.
• Implements cleanup routines post-processing to manage temporary files.
• Download & Export:
• Provides options to download individual converted files or a single ZIP archive when multiple files are processed.
• Deployment & Environment:
• Supports local execution (as per the setup instructions) and cloud deployment via Streamlit Sharing.
• Configuration files (Procfile, runtime.txt, .devcontainer, .streamlit) aid in deployment and development setup.