File size: 998 Bytes
32519eb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from flask import Flask, render_template, redirect, url_for, flash
import subprocess
import os

app = Flask(__name__)
app.secret_key = 'your_secret_key'  # Required for flashing messages

@app.route('/')
def index():
    return render_template('index.html')

@app.route('/collect_data')
def collect_data():
    try:
        subprocess.run(['python', 'setup_data.py'], check=True)
        flash('Data collection completed successfully!', 'success')
    except subprocess.CalledProcessError as e:
        flash(f'Error during data collection: {str(e)}', 'error')
    return redirect(url_for('index'))

@app.route('/analyze_data')
def analyze_data():
    try:
        subprocess.run(['python', 'analyze_data_quality.py'], check=True)
        flash('Data analysis completed successfully!', 'success')
    except subprocess.CalledProcessError as e:
        flash(f'Error during data analysis: {str(e)}', 'error')
    return redirect(url_for('index'))

if __name__ == '__main__':
    app.run(debug=True)