Skip to content
sumedhsinhaPublic

About

DocPlus, a secure document signing & management portal created by Neil & Sumedh

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

CS437 Database Systems Implementation (Document Signing Portal - DocPlus)

Welcome to DocPlus, the onestop solution for handling all your electronic paperwork & signatures!

The structure of the repository is as follows:

  • Diagrams: all the relevant illustrations that showcase the setup & flow of data between different components.
  • Documents: all documentation relating to the project.
  • Sample Data: some sample data to test out the features of the application.
  • Source / Program files: all the source code that powers the application. Includes SQL files containing code for testing, database schema, procedures, views, sample data generator (randomized data, sometimes raises duplicate errors which can be safely ignored), triggers & indexes for speeding up common queries.
  • Test Files: these scripts can be used to rigourously test the application code & handling of edge cases.
  • Contributing: details on the cotributions made by the different developers & stakeholders responsible for the application.
  • Quick Deploy Script (QDS) - deploy_db.py: After cloning the repository, simply run this script to quickly get started. Refer to Contributing for detailed instructions.
  • README (this file): the base file that links to all the documents & components of the application at large.

Quick Setup (also refer to Contributing)

1. Prerequisites

Ensure the following software is installed on your machine before starting:

2. Project Structure

Make sure your project folder is organized as follows:

Project Structure

Project Structure and File Descriptions

Path Description
.gitignore Git ignore rules
CONTRIBUTING.md Contribution guidelines
README.md Main project readme
README_ETL.md ETL-specific readme
deploy_db.py Script to deploy the database
docker-compose.yml Docker compose setup
mysql-queries.ps1 PowerShell script for MySQL queries used for demo
src/ Source code and SQL scripts
├─ OLTP.sql OLTP database setup script
├─ cache_manager.py Handles caching logic
├─ db_manager.py Database connection and queries
├─ etl_pipeline.py ETL pipeline implementation
├─ generate_sample_data.py Generates a sizeable sample test data, a copy is attached "SAMPLE_DATA_PRESET.sql"
├─ gui_app.py GUI application for the project
├─ logger_config.py Logging configuration
├─ main.py Main entry point for the app
├─ more_sql/ Additional SQL scripts
│ ├─ SAMPLE_DATA_PRESET.sql Some sample data
│ ├─ analysis_views.sql Analysis views definitions
│ ├─ etl_error_handlers.sql ETL error handling SQL scripts
│ ├─ generate_random_sample_data.sql Generates random test data
│ ├─ indexes.sql Index definitions
│ ├─ procedures.sql Stored procedures
│ ├─ some_views.sql Additional views
│ ├─ staging_tables.sql Staging tables for ETL
│ └─ triggers.sql Database triggers
├─ print_db_data.py Script to print database content
├─ telemetry_cache_gui.txt Telemetry logs from GUI cache
└─ test_db_redis.py Tests for database and Redis integration
logs/ Log files
├─ app_telemetry.log App telemetry logs
├─ etl_pipeline.log ETL pipeline logs
├─ initial_deployment_report.log Deployment report
├─ log_cache_gui.log GUI cache logs
└─ telemetry_cache_gui.log GUI telemetry logs
diagrams/ Project diagrams
├─ 3NF-ERdiagram.png ER diagram
├─ ContextDiagram.png Context diagram
└─ DFD-Level1.png Data Flow Diagram
docs/ Documentation files
├─ ARCHITECTURE.md Architecture design
├─ Cache_Design.md Cache system design
├─ Disclaimer.md Project disclaimer about e-signatures
├─ ETL_Design.md ETL design document
├─ ETL_architecture.md ETL architecture
├─ E_SIGN_ACT_TEXT.pdf The current US Law on validity of e-signatures
├─ FRD.md Functional requirements
├─ GUI_Design.md GUI design document
├─ Midterm_fixes.md Midterm updates/fixes
└─ TDD.md Technical Design Document
tests/ Test scripts
├─ fail_cases.sql SQL scripts for failure cases
└─ insert_upd_perf.py Insert/update performance tests

3. Install Notes

  • We recommend using a Python Virtual Environment for installing some of the required libraries to isolate project dependencies and avoid issues with the global installation of Python. See https://www.w3schools.com/python/python_virtualenv.asp. We have provided a Python Script (requires Python installed!) that can help you automatically setup the venv for you, see setup_venv.py.
  • Make sure to install all the libraries listed in requirements.txt.
  • Configure your MySQL installation with a secured password for root, and add the credentials in a .env file placed in the project root folder (review the project structure provided above). This file should not be pushed out to GitHub under any circumstances!
  • Run the deploy_db.py file to automatically setup the OLTP (transaction) database and tables. Any existing database matching name specified in the .env file will be DROPPED.

4. Execution

  • Open Docker Desktop, and make sure it is fully ready. You do not need to create an account.
  1. In a terminal opened at Project root folder, build the Docker Images.
docker-compose up -d --build
  1. Activate the Python venv if not done so already.
# Windows
python -m venv venv
venv\Scripts\activate

# Mac/Linux
python3 -m venv venv
source venv/bin/activate
  1. Run the main GUI application
python3 src/main.py

Appendix

Issue: "DB: CRITICAL (Dual Failure)" on First Run

Cause: You launched the Python app before MySQL finished initializing.

Fix: Close the app, wait 10 seconds, and run python src/main.py again.

Issue: "Connection Refused" logs

Cause: Docker containers are not running.

Fix: Run docker-compose start or check docker ps to ensure ports 3306 and 6379 are bound.

Issue: Changes in SQL Terminal don't show in GUI

Cause: You forgot to commit the transaction in SQL.

Fix: Run COMMIT; after your UPDATE/INSERT statements in the MySQL terminal.

SAMPLE .env for reference

# MySQL Database Settings
DB_HOST=127.0.0.1
DB_PORT=3306
DB_NAME=DocSignSys
DB_USER=<yourusername>
DB_PASS=<yourpassword>

# REDIS CONFIGURATION
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_MAX_MEMORY=100mb
REDIS_POLICY=allkeys-lru

# LOGGING for main app
LOG_FILE_PATH=../logs/app_telemetry.log

# CACHE BEHAVIOR
# TTL (in Seconds)
CACHE_TTL_PAGES=60
CACHE_TTL_TABLES=300

# Lookahead Settings (1 = Enabled, 0 = Disabled)
CACHE_PREFETCH_ENABLED=1 

© Neil Patel & Sumedh Sinha, all rights reserved.

About

DocPlus, a secure document signing & management portal created by Neil & Sumedh

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages