File size: 594 Bytes
ab755b3
123f3e2
ab755b3
123f3e2
ab755b3
eeee6ef
 
 
 
ab755b3
 
 
 
 
 
 
123f3e2
ab755b3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from flask import Blueprint, jsonify
from main import main as data_collection

from . import bp

@bp.route('/health')
def health():
    return jsonify({"message": "OK"}), 200

@bp.route('/trigger-data-collection', methods=['GET'])
def trigger_data_collection():
    """
    This endpoint manually triggers the data collection process defined in main.py.
    
    HTTP Method: GET (you can switch to POST if you prefer).
    """
    data_collection()  # This calls the Prefect flow that orchestrates data collection
    return jsonify({"message": "Data collection triggered successfully"}), 200