Changes between Version 6 and Version 7 of i2b2 HowTo Create an Ontology


Ignore:
Timestamp:
03/13/14 11:41:56 (10 years ago)
Author:
Richard Bramley
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • i2b2 HowTo Create an Ontology

    v6 v7  
    119119
    120120DECLARE @OntologyName VARCHAR(50), -- The name of the ontology, e.g. 'Onyx'
    121                 @Prefix VARCHAR(10), -- The prefix for the concept code, e.g. 'ONX'
    122                 @OntologyDescription VARCHAR(100), -- A nice description, e.g. 'BRICCS Onyx Questionnaire'
    123                 @OntologyBaseNode VARCHAR(50), -- The name of the base node of the tree within i2b2, e.g. 'Onyx'
    124                 @SourceSystem VARCHAR(50), -- The system from where the data came, e.g. 'BRICCS Onyx'
    125                 @MetaDatabaseName VARCHAR(50), -- The name of the Meta Database in which to create the Ontology, e.g. 'i2b2_b1_metadata'
    126                 @DataDatabaseName VARCHAR(50) -- The name of the Data Database in which to create the Ontology, e.g. 'i2b2_b1_data'
    127                
    128 SET @OntologyName = 'TestCiviCRM' -- Must not contain spaces
    129 SET @Prefix = 'TestGenCV'
    130 SET @OntologyDescription = 'TestGenvasc Study Details from CiviCRM'
    131 SET @OntologyBaseNode = 'TestCiviCRM'
    132 SET @SourceSystem = 'TestGenvasc CiviCRM'
    133 SET @MetaDatabaseName = 'i2b2_b1_metadata'
    134 SET @DataDatabaseName = 'i2b2_b1_data'
     121                @Prefix VARCHAR(10), -- The prefix for the concept code, e.g. 'ONX'
     122                @OntologyDescription VARCHAR(100), -- A nice description, e.g. 'BRICCS Onyx Questionnaire'
     123                @OntologyBaseNode VARCHAR(50), -- The name of the base node of the tree within i2b2, e.g. 'Onyx'
     124                @SourceSystem VARCHAR(50), -- The system from where the data came, e.g. 'BRICCS Onyx'
     125                @MetaDatabaseName VARCHAR(50), -- The name of the Meta Database in which to create the Ontology, e.g. 'i2b2_b1_metadata'
     126                @DataDatabaseName VARCHAR(50) -- The name of the Data Database in which to create the Ontology, e.g. 'i2b2_b1_data'
     127               
     128SET @OntologyName = 'PrimaryCareData' -- Must not contain spaces
     129SET @Prefix = 'PCD'
     130SET @OntologyDescription = 'Primary Care Data from GEM'
     131SET @OntologyBaseNode = 'PrimaryCareData'
     132SET @SourceSystem = 'Gem Risk Stratification'
     133SET @MetaDatabaseName = 'i2b2_app03_genvasc_MetaData'
     134SET @DataDatabaseName = 'i2b2_app03_genvasc_Data'
    135135
    136136----------------------------------------------------------------
     
    179179SET @UpgradeOntology1_6A = '
    180180    ALTER TABLE ' + @OntologyName + '
    181         ADD m_applied_path varchar(700) NULL
     181        ADD m_applied_path varchar(700) NULL
    182182    ;
    183183   
    184184    ALTER TABLE ' + @OntologyName + '
    185         ADD m_exclusion_cd varchar(25) NULL
     185        ADD m_exclusion_cd varchar(25) NULL
    186186    ;
    187187   
    188188    ALTER TABLE ' + @OntologyName + '
    189         ADD     C_PATH  VARCHAR(700)   NULL
     189        ADD     C_PATH  VARCHAR(700)   NULL
    190190    ;
    191191   
    192192    ALTER TABLE ' + @OntologyName + '
    193         ADD     C_SYMBOL VARCHAR(50)    NULL
     193        ADD     C_SYMBOL VARCHAR(50)    NULL
    194194    ;
    195195'
     
    201201
    202202    ALTER TABLE ' + @OntologyName + '
    203         ALTER COLUMN [m_applied_path] varchar(700) NOT NULL
    204     ;
    205        
     203        ALTER COLUMN [m_applied_path] varchar(700) NOT NULL
     204    ;
     205       
    206206    CREATE INDEX ' + @OntologyName + '_META_FULLNAME_IDX ON ' + @OntologyName + '(C_FULLNAME);
    207207   
    208     CREATE INDEX ' + @OntologyName + '_META_APPLIED_PATH_IDX ON ' + @OntologyName + '(M_APPLIED_PATH); 
     208    CREATE INDEX ' + @OntologyName + '_META_APPLIED_PATH_IDX ON ' + @OntologyName + '(M_APPLIED_PATH); 
    209209'
    210210
     
    248248INSERT INTO [i2b2ClinDataIntegration].[dbo].[Ontology] ([Name],[Prefix],[SourceSystem])
    249249VALUES (
    250                         @OntologyName
     250                        @OntologyName
    251251           ,@Prefix
    252252           ,@SourceSystem);
     
    258258INSERT INTO [i2b2ClinDataIntegration].[dbo].[OntologyCode] ([ParentID],[OntologyID],[Code],[Name],[OntologyNodeTypeCode],[OntologyNodeStatusCode],[Editable],[MetaDataTypeCode],[MetaUnits])
    259259VALUES (
    260                         NULL
     260                        NULL
    261261           ,@OntologyID
    262262           ,1
     
    267267           ,NULL
    268268           ,NULL
    269         );
    270 
     269        );
     270*/
    271271-- Insert the base code into the Ontology table
    272272DECLARE @TCreateBaseInOntologyTable VARCHAR(MAX)
     
    274274   USE ' + @MetaDatabaseName + ';
    275275   
    276    INSERT INTO  Onyxv2
     276   INSERT INTO  ' + @OntologyName + '
    277277   SELECT [C_HLEVEL]
    278278      ,[C_FULLNAME]