143 | | === 5. Create the ontology |
| 144 | {{{ |
| 145 | IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[Encounter_Mapping]') AND name = N'ENCOUNTER_MAPPING_PK') |
| 146 | ALTER TABLE [dbo].[Encounter_Mapping] DROP CONSTRAINT [ENCOUNTER_MAPPING_PK] |
| 147 | GO |
| 148 | |
| 149 | IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[Encounter_Mapping]') AND name = N'IX_Encounter_Mapping') |
| 150 | DROP INDEX [IX_Encounter_Mapping] ON [dbo].[Encounter_Mapping] WITH ( ONLINE = OFF ) |
| 151 | GO |
| 152 | |
| 153 | CREATE UNIQUE NONCLUSTERED INDEX [IX_Encounter_Mapping] ON [dbo].[Encounter_Mapping] |
| 154 | ( |
| 155 | [ENCOUNTER_NUM] ASC, |
| 156 | [ENCOUNTER_IDE_SOURCE] ASC |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] |
| 162 | GO |
| 163 | |
| 164 | IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[Patient_Mapping]') AND name = N'IX_Patient_Mapping') |
| 165 | DROP INDEX [IX_Patient_Mapping] ON [dbo].[Patient_Mapping] WITH ( ONLINE = OFF ) |
| 166 | GO |
| 167 | |
| 168 | IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[Patient_Mapping]') AND name = N'PATIENT_MAPPING_PK') |
| 169 | ALTER TABLE [dbo].[Patient_Mapping] DROP CONSTRAINT [PATIENT_MAPPING_PK] |
| 170 | GO |
| 171 | |
| 172 | |
| 173 | IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[Patient_Mapping]') AND name = N'IX_Patient_Mapping_1') |
| 174 | DROP INDEX [IX_Patient_Mapping_1] ON [dbo].[Patient_Mapping] WITH ( ONLINE = OFF ) |
| 175 | GO |
| 176 | |
| 177 | CREATE NONCLUSTERED INDEX [IX_Patient_Mapping_1] ON [dbo].[Patient_Mapping] |
| 178 | ( |
| 179 | [PATIENT_IDE] ASC, |
| 180 | [PATIENT_IDE_SOURCE] ASC |
| 181 | )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] |
| 182 | GO |
| 183 | |
| 184 | |
| 185 | IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[Observation_Fact]') AND name = N'OBSERVATION_FACT_PK') |
| 186 | ALTER TABLE [dbo].[Observation_Fact] DROP CONSTRAINT [OBSERVATION_FACT_PK] |
| 187 | GO |
| 188 | }}} |
| 189 | |
| 190 | === 6. Create the ontology |