35 lines
945 B
Python
35 lines
945 B
Python
import logging
|
|
from typing import List, Dict
|
|
from graph_pre_processing import pre_processing
|
|
from graph_processing import processing
|
|
from graph_post_processing import post_processing
|
|
|
|
# Configure logging
|
|
logging.basicConfig(
|
|
level=logging.INFO,
|
|
format="%(asctime)s [%(levelname)s] %(name)s - %(message)s",
|
|
)
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def __main__(results: List[Dict]) -> List[Dict]:
|
|
logger.info(f"data receiving in g1v1 block: {results}")
|
|
data = pre_processing(results)
|
|
logger.info(f"pre_processed_data, new_user_app_data: {data}")
|
|
|
|
# df = processing(data)
|
|
if data.get("cluster_size", 2) < 2:
|
|
data["prediction"] = 0
|
|
else:
|
|
data = processing(data)
|
|
logger.info("prediction: %.8f", float(data['prediction']))
|
|
|
|
# Post-processing: calculate the Final Score and update the dataframe.
|
|
final = post_processing(data)
|
|
logger.info(final)
|
|
|
|
return final
|
|
|
|
# testing :
|
|
# __main__
|