| | 1 | = Customisations made to i2b2 |
| | 2 | |
| | 3 | == 1. Remove primary key from Observation Fact table in Data database |
| | 4 | |
| | 5 | === Rationale |
| | 6 | |
| | 7 | The primary key creates a unique constraint on Encounter_Num, Concept_Cd, Provider_Id, Start_Date & Modifier_Code. However, we have genuine data that is duplicated on these fields. For example, a repeat test on the same sample where the first was inconclusive. |
| | 8 | |
| | 9 | === Applied To |
| | 10 | |
| | 11 | The customisation has been applied to the following i2b2 instances: |
| | 12 | |
| | 13 | * i2b2_b1_data |
| | 14 | |
| | 15 | === Customisation |
| | 16 | |
| | 17 | To apply the customisation, run the following SQL in the i2b2 data database: |
| | 18 | |
| | 19 | {{{ |
| | 20 | #!sql |
| | 21 | ALTER TABLE [dbo].[Observation_Fact] DROP CONSTRAINT [OBSERVATION_FACT_PK] |
| | 22 | GO |
| | 23 | }}} |
| | 24 | |
| | 25 | === Roll Back |
| | 26 | |
| | 27 | To roll back the customisation, run the following SQL in the i2b2 data database: |
| | 28 | |
| | 29 | {{{ |
| | 30 | #!sql |
| | 31 | ALTER TABLE [dbo].[Observation_Fact] ADD CONSTRAINT [OBSERVATION_FACT_PK] PRIMARY KEY NONCLUSTERED |
| | 32 | ( |
| | 33 | [Encounter_Num] ASC, |
| | 34 | [Concept_Cd] ASC, |
| | 35 | [Provider_Id] ASC, |
| | 36 | [Start_Date] ASC, |
| | 37 | [Modifier_Cd] ASC |
| | 38 | ) |
| | 39 | GO |
| | 40 | }}} |