Added history schema, got extraction_lib to read and write from db
parent
4ae3064bf2
commit
ee3e37e834
@ -1,113 +0,0 @@
|
||||
/*
|
||||
Create schema history
|
||||
|
||||
|
||||
CREATE TABLE history.versions
|
||||
nct_id
|
||||
version
|
||||
--Study Status
|
||||
overall_status^
|
||||
primary_completion_date^
|
||||
completion_date^
|
||||
last_update_submitted_date
|
||||
--SponsorCollaborators
|
||||
sponsor (multi?)
|
||||
collaborators (multi?)
|
||||
--Oversight
|
||||
fda_regulated_drug (ignore)
|
||||
fda_regulated_device (ignore)
|
||||
dmc (ignore)
|
||||
--StuldyDescription
|
||||
summary
|
||||
detailed_description
|
||||
--Conditions
|
||||
Conditions
|
||||
Keywords
|
||||
--StudyDesign
|
||||
Study type
|
||||
Primary Purpose
|
||||
Study Phase
|
||||
Interventional Study Model
|
||||
Number of Arms
|
||||
Masking
|
||||
Allocation
|
||||
Enrollment ^
|
||||
--ArmsAndInterventions
|
||||
Arms (multiple) (Ignore)
|
||||
--ProtocolOutcomeMeasures
|
||||
--Eligibility
|
||||
--ContactsLocation
|
||||
--IPDSharing
|
||||
--References
|
||||
--ParticipantFlow
|
||||
--BaselineCharacteristics
|
||||
--ROutcomeMeasures
|
||||
--AdverseEvents
|
||||
--LimitationsAndCaveats
|
||||
--More Information
|
||||
|
||||
|
||||
CREATE TABLE history.colaborators
|
||||
nct_id
|
||||
version
|
||||
collaborator_name
|
||||
|
||||
CREATE TABLE history.locations
|
||||
nct_id
|
||||
version
|
||||
location name
|
||||
location contact info
|
||||
|
||||
CREATE TABLE history.arms
|
||||
*/
|
||||
|
||||
/*
|
||||
Create the history
|
||||
*/
|
||||
|
||||
CREATE TYPE history.updatable_catetories AS ENUM
|
||||
('Actual', 'Anticipated', 'Expected');
|
||||
|
||||
ALTER TYPE history.updatable_catetories
|
||||
OWNER TO root;
|
||||
|
||||
COMMENT ON TYPE history.updatable_catetories
|
||||
IS 'This enum is used to capture the different types of categories that a date or enrollemnt figure may have.';
|
||||
|
||||
|
||||
|
||||
CREATE TYPE history.study_statuses AS ENUM
|
||||
('Available', 'Withdrawn', 'Withheld', 'Temporarily not available', 'Active, not recruiting', 'Recruiting', 'Not yet recruiting', 'Enrolling by invitation', 'Suspended', 'No longer available', 'Approved for marketing', 'Unknown status', 'Completed', 'Terminated');
|
||||
|
||||
ALTER TYPE history.study_statuses
|
||||
OWNER TO root;
|
||||
|
||||
|
||||
|
||||
|
||||
-- Table: history.trial_snapshots
|
||||
|
||||
DROP TABLE IF EXISTS history.trial_snapshots;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS history.trial_snapshots
|
||||
(
|
||||
nct_id character varying(15) COLLATE pg_catalog."default" NOT NULL,
|
||||
version integer NOT NULL,
|
||||
primary_completion_date timestamp without time zone,
|
||||
primary_completion_date_category history.updatable_catetories,
|
||||
start_date timestamp without time zone,
|
||||
start_date_category history.updatable_catetories,
|
||||
completion_date timestamp without time zone,
|
||||
completion_date_category history.updatable_catetories,
|
||||
overall_status history.study_statuses,
|
||||
enrollment integer,
|
||||
enrollment_category history.updatable_catetories,
|
||||
sponsor character varying(255) COLLATE pg_catalog."default",
|
||||
responsible_party character varying(255) COLLATE pg_catalog."default",
|
||||
CONSTRAINT trial_snapshots_pkey PRIMARY KEY (nct_id, version)
|
||||
);
|
||||
|
||||
TABLESPACE pg_default;
|
||||
|
||||
ALTER TABLE IF EXISTS history.trial_snapshots
|
||||
OWNER to root;
|
||||
Loading…
Reference in New Issue