Replies: 2 comments
-
This is the SQL schema we could use: CREATE TABLE studies (
study_id SERIAL PRIMARY KEY,
study_identifier VARCHAR(255) NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
study_title VARCHAR(255),
randomization_method VARCHAR(100),
randomization_parameters JSONB,
is_active BOOLEAN DEFAULT TRUE,
deactivated_at TIMESTAMP WITH TIME ZONE
);
CREATE TABLE study_arms (
arm_id SERIAL PRIMARY KEY,
study_id INTEGER REFERENCES Studies(study_id),
arm_label VARCHAR(255)
);
CREATE TABLE patients (
patient_id SERIAL PRIMARY KEY,
study_id INTEGER REFERENCES Studies(study_id),
arm_id INTEGER REFERENCES StudyArms(arm_id),
randomization_code VARCHAR(255) NOT NULL,
randomization_code_used BOOLEAN NOT NULL,
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- Timestamp of the last update
enrollment_date TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE audit_trail (
request_id SERIAL PRIMARY KEY,
request_time TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
request_endpoint VARCHAR(100),
request_payload JSONB,
study_id INTEGER REFERENCES Studies(study_id),
response_code INTEGER,
response_payload JSONB
);
CREATE OR REPLACE FUNCTION update_modified_column()
RETURNS TRIGGER AS $$
BEGIN
NEW.updated_at = CURRENT_TIMESTAMP;
RETURN NEW;
END;
$$ language 'plpgsql';
CREATE TRIGGER update_studies_modtime
BEFORE UPDATE ON studies
FOR EACH ROW
EXECUTE FUNCTION update_modified_column();
CREATE TRIGGER update_patients_modtime
BEFORE UPDATE ON patients
FOR EACH ROW
EXECUTE FUNCTION update_modified_column(); |
Beta Was this translation helpful? Give feedback.
-
Following our recent discussion on the design of the randomization algorithm's endpoints, I wanted to provide an update and outline our agreed approach. As we've determined, the OpenAPI standard doesn't offer a straightforward way to handle conditional parameters for different randomization methods. To ensure clarity and ease of use for our API users, we've decided to create distinct endpoints for each randomization method. This design choice will allow us to provide clear, fixed parameters for each method, which will be thoroughly documented. Here's a summary of the changes and how they will be implemented:
Endpoints Overview:
We believe that this structured approach will enhance the usability of our API, making it more accessible and easier to integrate for our users. The clarity in documentation and endpoint design will also aid in reducing potential errors and misunderstandings. |
Beta Was this translation helpful? Give feedback.
-
How to implement general architecture for the endpoint? Initial proposal:
GET /randomization_methods
)POST /study
):study_id
, timestamp)GET /study
)GET /study/{study_id}
)study_id
, timestamp)POST /study/{study_id}/patient
):GET /study/{study_id}/randomization_list
):GET /study/{study_id}/audit_trial
):DELETE /study/{study_id}
):Beta Was this translation helpful? Give feedback.
All reactions