ACCORD Conflict Detection is a Flask-based web application designed to manage and detect conflicts in Google Drive activity logs. The application extracts activity logs, defines fine-grained action constraints on shared resources, and uses a conflict detection algorithm to identify and resolve conflicts.
- Install Google Client Library for Access Activity Logs via Reports API:
pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib
- Install Flask and related librarires:
pip install Flask pip install Flask-WTF Flask-SQLAlchemy Flask-Migrate
- Database Setup (MySQL Workbench locally): Database dump can be provided on request.
- API access tokens for reports API in token.json and tokens directory contains drive api tokens: json files and access tokens can be provided to authroized personnel on request.
- / (index): Renders the main page (index.html) and initializes the Google Drive Reports API service for the admin user
- /refresh_logs (POST): Updates the local database with the latest Google Drive activity logs retrieved using the Reports API.
- /detect_conflicts_demo (POST): Handles the demonstration of conflict detection. Retrieves logs and action constraints from the database, runs the detection algorithm (detectmain), and returns detected conflicts with detection time metrics.
- /addActionConstraints (POST): Receives JSON data containing user-defined action constraints, processes them, and adds them to the database (log_details) for future conflict detection.
- /fetch_actionConstraints (POST): Retrieves action constraints from the database based on a specified date, processes them into a structured format, and returns them as JSON for display.
- /fetch_drive_log (GET): Retrieves Google Drive activity logs from the Reports API based on a specified start time (startTime) and updates the local log database (log_details).
- /get_action_constraints (POST): Retrieves specific action constraints from the database (log_details) based on document ID, action type, and constraint target, and returns them as JSON.
- Fetch Logs Tab: Allows users to select a date and fetch activity logs from a specified date. It includes a table to display fetched logs, a loader for indicating data fetching, and a button to detect conflicts based on the fetched logs.
- Action Constrains Tab: Enables users to view and manage action constraints associated with logged activities. It includes a form to select a date, a button to display action constraints for that date, and a table to show detailed constraints including timestamps, target resources, and owners.
- Extarct activity logs from database.
- Extract all action constraints from database.
- T0 -> Start Time
- Call detection Engine to compare activity logs against action constraints to detect conflicts. (Activity Handler and Action constraint Handler)
- Identify conflicts and store them.
- T1 -> Stop Timer
- T1-T0 = Detection Time
- After installing all the packages, configuring the database and setting up access tokens, exuecute following command to run app:
python app.py
- Open a web browser and goto:
http://127.0.0.1:5000
This README.md provides an overview of the ACCORD Conflict Detection project, installation and configuration instructions, descriptions of application routes, details about the index page menu tabs, and an explanation of how detection time is calculated.