Skip to content

insilica/ctgov-compliance-web

Repository files navigation

CTGOV Compliance Web Application

This project provides a basic Flask web interface for viewing clinical trial compliance information. It also includes supporting scripts and database services.

Components

  • Flask application located in web/.
  • PostgreSQL for application data.
  • Flyway for database migrations.

Requirements

  • NixOS must be downloaded onto the system
    • Run in Terminal (MacOS):

      sh <(curl --proto '=https' --tlsv1.2 -L https://nixos.org/nix/install)
      
    • Windows Instructions

  • UV must be downloaded onto the system
    • Run in your CLI with Homebrew:

      brew install uv
      
    • Alternatively, you may use the following:

      curl -LsSf https://astral.sh/uv/install.sh | sh
      

Usage

nix develop

This command will download all dependencies and set up the development environment.

File Cleanup

Running the command below will delete files autogenerated by the nix develop command. It will also kill the PostgreSQL server.

source scripts/flake/clean.sh

Mock Data

Not required; ran using nix develop

For convenience a helper script is included to load mock organizations, users, trials and compliance information into PostgreSQL.

python scripts/init_mock_data.py

Running the Flask App

Not required; ran using nix develop

After the services are running and mock data is loaded you can start the development server:

flask run --host 0.0.0.0 --port 6525

Development Auto-Authentication

For development convenience, you can enable automatic user authentication:

# For local development
export ENVIRONMENT=dev
flask run --host 0.0.0.0 --port 6525

# For preview deployments (single PR testing)
export ENVIRONMENT=preview
flask run --host 0.0.0.0 --port 6525

When ENVIRONMENT=dev or ENVIRONMENT=preview is set, you'll be automatically logged in as user1@example.com when visiting any protected route. This eliminates the need for manual login during development and testing.

Environment Flow: preview (single PR) → dev (main branch) → prod (tagged release)

Account Management

You can create an account directly in the application and reset your password when needed.

  1. Visit /register to sign up for a new account.
  2. Use /reset to generate a password reset link.

Cloud Database Setup

This application supports both local development databases and Google Cloud SQL for production deployments.

Quick Start for Cloud

  1. Set up Cloud SQL instance and configure GitHub secrets
  2. Deploy application using existing GitHub Actions
  3. Initialize database with mock data using the "Initialize Cloud Database" GitHub Action
  4. Verify setup by accessing your Cloud Run service

For detailed setup instructions, see Cloud Database Setup Guide.

Key Features

  • Automatic connection handling (local vs Cloud SQL)
  • One-time data population with safety mechanisms
  • GitHub Actions integration for automated deployment
  • Population status tracking to prevent duplicate data
  • Force repopulation when needed for testing

Scripts

  • scripts/init_cloud_data.py - Safely populate cloud database with mock data
  • scripts/check_db_status.py - Check database population status
  • Use GitHub Actions workflow "Initialize Cloud Database" for automated setup

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •