A web application for structured management, version control, and reuse of REDCap-compatible electronic case report forms (eCRFs). Built with Flask, React, and PostgreSQL, the system enables validated editing, semantic consistency, and transparent provenance tracking of questionnaires while preserving full REDCap CSV compatibility.
- Import of REDCap CSV Data Dictionaries
- Normalized relational schema (
Form β Section β Question) - Versioning and provenance tracking for questions
- Questionnaire composition using existing forms and sections
- REDCap-compatible CSV export
- JWT-based authentication and user profiles
Description:
The main entry point of the application.
Users can navigate between modules, view imported forms, and access profile or questionnaire creation options.
Description:
Interface for editing and validating individual questions.
Users can modify question text, choices, validation rules, and branching logic in real time with input validation.
Description:
Displays all available versions of a question or form.
Users can track changes, compare versions, and revert to previous states while maintaining full provenance metadata.
Description:
Drag-and-drop interface for assembling new questionnaires from existing validated questions and sections.
Facilitates reuse, consistency, and structured form design.
Description:
Displays all imported and custom questionnaires together in a unified view.
Users can browse, filter, and inspect forms along with their sections and questions.
Description:
Extended hierarchical view showing the modular structure of forms, sections, and questions.
Supports visual grouping and quick navigation through complex questionnaires.
Description:
User profile management area.
Allows editing account details.
Note:
All screenshots were taken from the local development environment using the default layout and styling.
Displayed data are synthetic and used for demonstration purposes only.
| Layer | Technology |
|---|---|
| Frontend | React (Create React App via npx create-react-app) |
| Backend | Flask (Python) |
| Database | PostgreSQL |
| Authentication | JWT (JSON Web Token) |
| Styling | CSS / Tailwind |
Before installation, ensure the following software is installed:
| Component | Recommended Version |
|---|---|
| Python | 3.10+ |
| Node.js & npm | Node 18+ (includes npm) |
| PostgreSQL | 14+ |
| Git | latest |
| (Optional) PyCharm | 2023+ (Community or Professional) |
Check versions:
python --version
node --version
npm --version
psql --version
git --versionOn macOS/Linux, use
python3instead ofpython.
.
ββ backend/ # Flask REST API
β ββ requirements.txt
β ββ alembic.ini
β ββ src/... # Flask app (e.g., app/__init__.py)
ββ frontend/ # React (Create React App via npx)
β ββ package.json
β ββ src/...
ββ README.md
Adjust paths as needed for your project.
Create a dedicated database and user:
CREATE USER app_user WITH PASSWORD 'change_me';
CREATE DATABASE app_db OWNER app_user;
GRANT ALL PRIVILEGES ON DATABASE app_db TO app_user;Keep these credentials for your backend .env configuration.
cd backend
python -m venv .venv
# Activate virtual environment
# Windows (PowerShell):
. .\.venv\Scripts\Activate.ps1
# Windows (cmd):
.\.venv\Scripts\activate.bat
# macOS/Linux:
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txtCreate a .env file in backend/:
# Flask
FLASK_APP=src.app:app
FLASK_ENV=development
# Security
JWT_SECRET=change_this_secret
# Database (PostgreSQL)
DATABASE_URL=postgresql+psycopg://app_user:change_me@localhost:5432/app_db
# CORS (React uses port 3000)
CORS_ORIGINS=http://localhost:3000Ensure
FLASK_APPmatches your Flask app import path (e.g.,src.app:apporapp:app).
alembic upgrade headIf Alembic is not set up yet, initialize it first:
alembic init alembicConfigure it to match your SQLAlchemy models, generate a migration:
alembic revision --autogenerate -m "init"and apply it:
alembic upgrade head
flask run --host=0.0.0.0 --port=8000The API will be available at:
http://localhost:8000
cd frontend
npm installCreate a .env file in frontend/:
REACT_APP_API_BASE_URL=http://localhost:8000Your frontend reads this as process.env.REACT_APP_API_BASE_URL.
npm startThe frontend will be available at:
http://localhost:3000
- PostgreSQL is running and
app_dbexists. - Flask backend is running on
http://localhost:8000. - React frontend is running on
http://localhost:3000. - Register a new user via the UI or API (
POST /api/register). - Log in (
POST /api/login). - Import a REDCap CSV or create a new questionnaire in the web interface.
- Run β Edit Configurations β Add New β Flask Server
FLASK_APP:src.app:appFLASK_ENV:development- Environment variables: use
.env - Host:
0.0.0.0 - Port:
8000
- Interpreter: select projectβs
.venv.
- Run β Edit Configurations β Add New β npm
package.json:frontend/package.json- Command:
start
Create docker-compose.yml in your project root:
version: "3.9"
services:
db:
image: postgres:15
environment:
POSTGRES_USER: app_user
POSTGRES_PASSWORD: change_me
POSTGRES_DB: app_db
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U app_user -d app_db"]
interval: 5s
timeout: 5s
retries: 10
backend:
build: ./backend
env_file: ./backend/.env
depends_on:
- db
ports:
- "8000:8000"
frontend:
build: ./frontend
environment:
- REACT_APP_API_BASE_URL=http://localhost:8000
ports:
- "3000:3000"For production:
- Use Gunicorn or uWSGI for Flask.
- Build frontend (
npm run build) and serve it with Nginx. - Restrict CORS and use HTTPS via a reverse proxy.
| Problem | Possible Fix |
|---|---|
| Port already in use | Change ports or stop conflicting process (3000 or 8000). |
| CORS error | Ensure CORS_ORIGINS matches frontend URL. |
| Database connection fails | Verify Postgres is running and DATABASE_URL credentials. |
| Migrations missing tables | Run alembic upgrade head. |
| Frontend cannot reach API | Confirm REACT_APP_API_BASE_URL is correct. |
- Never commit
.envor secrets to version control. - Use a strong
JWT_SECRETand secure database passwords. - Set
FLASK_ENV=productionfor deployment. - Limit
CORS_ORIGINSto trusted domains. - Always use HTTPS in production.
End of Installation Guide
Flask backend uses Blueprints for modularity (auth, import, questions, forms).
Alembic handles database migrations.
All sensitive values (JWT secrets, DB credentials) should be stored in .env.






