web.flask_app¶
flask_app.py
Flask web application for uploading and processing CSV files.
This application allows users to upload CSV files, which are then processed in the background. The progress of the processing is tracked and can be queried via a dedicated endpoint.
Key Features: - Tableau workbook upload via a web form. - Background processing of Tableau workbook using the process_twb function. - Progress tracking for ongoing processing tasks. - Progress information is accessible through the /progress endpoint.
Configuration: - Uploads are saved in the static/uploads directory, which is created if it does not exist.
Usage: Run this module to start the Flask development server.
- web.flask_app.index()¶
Render the index page and handle file uploads.
If a file is uploaded, it is saved to the upload folder, and the processing function is started in a separate thread to maintain responsiveness of the application.
- Returns:
The rendered HTML of the index page.
- Return type:
str
- web.flask_app.progress()¶
Return the current progress of the file processing.
This function responds with a JSON object containing the current processing progress and the filename being processed.
- Returns:
A JSON response containing progress and filename.
- Return type:
jsonify
- web.flask_app.run_processing(filepath)¶
Processes a Tableau workbook file in the background.
This function calls the process_twb function to handle the processing of the specified Tableau workbook file. The processing is done using the filepath provided as an argument, with a predefined upload folder and a flag indicating the executable state.
- Parameters:
filepath (str) – The path to the Tableau workbook file to be processed.
- Returns:
None