// Exercise 03 — Database Design

Clinical Trials Data Model

Relational database schema designed for a hospital clinical trials support service. Supports multiple studies, pseudonymized participants, longitudinal data collection, role-based access, and file management.

Entity-Relationship Diagram

MySQL Diagram

ER Diagram — Clinical Trials Data Model

Figure 1. MySQL relational diagram generated for the clinical trials support database.

Overview

Model Overview

The schema is centered on clinical studies, which act as the main organizational entity of the system. Each study is associated with a responsible laboratory, includes pseudonymized participants, defines its own variable set, and allows controlled access for users through study-specific roles.

The design also supports longitudinal data collection by storing repeated hospital visits for each participant. Data recorded during those visits may correspond either to structured scalar values or to file-based clinical resources. Direct patient identifiers are intentionally excluded from this operational database and would be managed in a separate restricted environment in a real hospital setting.

Core Entities

Main Structural Blocks

1. Study Administration

The laboratories and clinical_studies tables define the institutional and organizational context of the system. They store the identity of each study together with its code, description, status, contact information, and responsible laboratory.

2. User Management

The users, roles, and user_study_access tables control system access. This structure allows assigning different roles to the same user in different studies.

3. Pseudonymized Participants

The participants table stores only study-specific pseudonymized identifiers. The participant_seq table supports automatic identifier generation for each study.

4. Longitudinal Visits

The visits table represents repeated participant follow-up over time. Each visit stores date, label, optional notes, and the responsible user.

5. Dynamic Study Variables

The variable_set table defines the variables collected in each study. This makes the schema flexible and avoids using fixed clinical columns for every possible trial.

6. Clinical Records

The schema stores clinical observations in clinical_data_items and file metadata in clinical_data_files, both linked to visits and study variables.

Technical Documentation

Relational Structure

Technical relational structure including entities, keys, cardinalities, and referential integrity rules.

Tables in the Schema

Primary Keys

Foreign Keys

Relationship Types

Referential Integrity

Pseudonymization

Participants are stored through pseudonymized study-specific identifiers. The participant_seq table supports automatic ID generation. Patient-identifying information is intentionally excluded from this operational schema and would be handled externally in a restricted environment.

Summary

Technical Summary Table

Table Primary Key Main Foreign Keys Relationship Type
laboratorieslaboratory_id1:N with clinical_studies
clinical_studiesclinical_study_idlaboratory_id1:N with participants, variable_set, access
rolesrole_id1:N with user_study_access
usersuser_idN:N with studies via access table
user_study_accessaccess_iduser_id, clinical_study_id, role_idJunction table
participant_seqclinical_study_idclinical_study_id1:1 with clinical_studies
participantsparticipant_idclinical_study_id1:N with visits
visitsvisit_idparticipant_id, user_in_charge1:N with data items/files
variable_setvariable_idclinical_study_id1:N with data items/files
clinical_data_itemsitem_idvisit_id, variable_idN-side of visit/variable
clinical_data_filesfile_idvisit_id, variable_id, uploaded_byN-side of visit/variable
Rationale

Design Decisions