Closed burrowse closed 7 years ago
@burrowse Thanks, DMSA succeeds with this. I'll merge it. FWIW, here is the diff between 2.3.0 and this version.
11c11,27
< INSERT INTO version_history (operation, model, model_version, dms_version, dmsa_version) VALUES ('create tables', 'pedsnet', '2.3.0', '1.0.4-beta', '0.5.9');
---
> INSERT INTO version_history (operation, model, model_version, dms_version, dmsa_version) VALUES ('create tables', 'pedsnet', '2.4.0', '1.0.4-beta', '0.5.9');
>
> CREATE TABLE adt_occurrence (
> adt_date DATE,
> adt_occurrence_id SERIAL NOT NULL,
> adt_time TIMESTAMP WITHOUT TIME ZONE,
> adt_type_concept_id INTEGER NOT NULL,
> adt_type_source_value VARCHAR(256),
> care_site_id INTEGER NOT NULL,
> next_adt_occurrence_id INTEGER,
> person_id INTEGER NOT NULL,
> prior_adt_occurrence_id INTEGER,
> service_concept_id INTEGER NOT NULL,
> service_source_value VARCHAR(256),
> visit_occurrence_id INTEGER NOT NULL,
> CONSTRAINT xpk_adt_occurrence PRIMARY KEY (adt_occurrence_id)
> );
70a87,96
> CREATE TABLE condition_era (
> condition_concept_id INTEGER,
> condition_era_end_date DATE NOT NULL,
> condition_era_id SERIAL NOT NULL,
> condition_era_start_date DATE NOT NULL,
> condition_occurrence_count INTEGER,
> person_id INTEGER,
> CONSTRAINT xpk_condition_era PRIMARY KEY (condition_era_id)
> );
>
107a134,155
> CREATE TABLE dose_era (
> dose_era_end_date DATE NOT NULL,
> dose_era_id SERIAL NOT NULL,
> dose_era_start_date DATE NOT NULL,
> dose_value FLOAT NOT NULL,
> drug_concept_id INTEGER,
> person_id INTEGER,
> unit_concept_id INTEGER,
> CONSTRAINT xpk_dose_era PRIMARY KEY (dose_era_id)
> );
>
> CREATE TABLE drug_era (
> drug_concept_id INTEGER,
> drug_era_end_date DATE NOT NULL,
> drug_era_id SERIAL NOT NULL,
> drug_era_start_date DATE NOT NULL,
> drug_exposure_count INTEGER,
> gap_days INTEGER,
> person_id INTEGER,
> CONSTRAINT xpk_drug_era PRIMARY KEY (drug_era_id)
> );
>
141a190
> box_size INTEGER,
369c418,428
< INSERT INTO version_history (operation, model, model_version, dms_version, dmsa_version) VALUES ('create constraints', 'pedsnet', '2.3.0', '1.0.4-beta', '0.5.9');
---
> INSERT INTO version_history (operation, model, model_version, dms_version, dmsa_version) VALUES ('create constraints', 'pedsnet', '2.4.0', '1.0.4-beta', '0.5.9');
>
> ALTER TABLE adt_occurrence ADD CONSTRAINT fpk_adt_occ_caresite FOREIGN KEY(care_site_id) REFERENCES care_site (care_site_id) DEFERRABLE INITIALLY DEFERRED;
>
> ALTER TABLE adt_occurrence ADD CONSTRAINT fpk_adt_occ_person FOREIGN KEY(person_id) REFERENCES person (person_id) DEFERRABLE INITIALLY DEFERRED;
>
> ALTER TABLE adt_occurrence ADD CONSTRAINT fpk_adt_occ_visit FOREIGN KEY(visit_occurrence_id) REFERENCES visit_occurrence (visit_occurrence_id) DEFERRABLE INITIALLY DEFERRED;
>
> ALTER TABLE adt_occurrence ADD CONSTRAINT fpk_adt_ser_concept FOREIGN KEY(service_concept_id) REFERENCES concept (concept_id) DEFERRABLE INITIALLY DEFERRED;
>
> ALTER TABLE adt_occurrence ADD CONSTRAINT fpk_adt_type_concept FOREIGN KEY(adt_type_concept_id) REFERENCES concept (concept_id) DEFERRABLE INITIALLY DEFERRED;
396a456,459
> ALTER TABLE condition_era ADD CONSTRAINT fpk_cond_era_c_concept FOREIGN KEY(condition_concept_id) REFERENCES concept (concept_id) DEFERRABLE INITIALLY DEFERRED;
>
> ALTER TABLE condition_era ADD CONSTRAINT fpk_cond_era_person FOREIGN KEY(person_id) REFERENCES person (person_id) DEFERRABLE INITIALLY DEFERRED;
>
420a484,493
> ALTER TABLE dose_era ADD CONSTRAINT fpk_dose_era_d_concept FOREIGN KEY(drug_concept_id) REFERENCES concept (concept_id) DEFERRABLE INITIALLY DEFERRED;
>
> ALTER TABLE dose_era ADD CONSTRAINT fpk_dose_era_person FOREIGN KEY(person_id) REFERENCES person (person_id) DEFERRABLE INITIALLY DEFERRED;
>
> ALTER TABLE dose_era ADD CONSTRAINT fpk_dose_era_u_concept FOREIGN KEY(unit_concept_id) REFERENCES concept (concept_id) DEFERRABLE INITIALLY DEFERRED;
>
> ALTER TABLE drug_era ADD CONSTRAINT fpk_drug_era_d_concept FOREIGN KEY(drug_concept_id) REFERENCES concept (concept_id) DEFERRABLE INITIALLY DEFERRED;
>
> ALTER TABLE drug_era ADD CONSTRAINT fpk_drug_era_person FOREIGN KEY(person_id) REFERENCES person (person_id) DEFERRABLE INITIALLY DEFERRED;
>
580c653,663
< INSERT INTO version_history (operation, model, model_version, dms_version, dmsa_version) VALUES ('create indexes', 'pedsnet', '2.3.0', '1.0.4-beta', '0.5.9');
---
> INSERT INTO version_history (operation, model, model_version, dms_version, dmsa_version) VALUES ('create indexes', 'pedsnet', '2.4.0', '1.0.4-beta', '0.5.9');
>
> CREATE INDEX idx_adt_next_id ON adt_occurrence (next_adt_occurrence_id);
>
> CREATE INDEX idx_adt_prior_id ON adt_occurrence (prior_adt_occurrence_id);
>
> CREATE INDEX idx_adt_service_id ON adt_occurrence (service_concept_id);
>
> CREATE INDEX idx_adt_type_id ON adt_occurrence (adt_type_concept_id);
>
> CREATE INDEX idx_adt_visit_id ON adt_occurrence (visit_occurrence_id);
https://github.com/chop-dbhi/data-models/issues/154