| 15 | | 3. Execute the stored procedure `[dbo].[CreateOntologyInStudy] @OntologyID, @MetaDatabaseName, @DataDatabaseName` for each project that requires the ontology |
| 16 | | - Where: |
| 17 | | - `@OntologyID` is the ID returned by the previous stored procedure. |
| 18 | | - `@MetaDatabaseName` is the name of the i2b2 meta database where the ontology should be created, e.g., 'project_MetaData' |
| 19 | | - `@DataDatabaseName` is the name of the i2b2 data database where the ontology should be created, e.g., 'project_Data' |
| 20 | | 4. Amend the stored procedure `[dbo].[LoadAllOntologiesIntoConceptDimension]` in the i2b2 data database to add the import of the codes into the `concept_dimension`. |
| 21 | | - The line should be of the form: `EXEC dbo.LoadOntologyIntoConceptDimension {Ontology ID};`, where `OntologyID` is the ID of the ontology created above. |
| 22 | | 5. Create a stored procedure to import the ontology codes into the i2b2 meta database. The procedure should follow the form: |
| 23 | | {{{ |
| 24 | | CREATE PROC [dbo].[Update{Ontology Name}] AS |
| 25 | | DELETE FROM dbo.{Ontology Table Name}; |
| 26 | | |
| 27 | | INSERT INTO dbo.{Ontology Table Name} |
| 28 | | SELECT [C_HLEVEL] |
| 29 | | ,[C_FULLNAME] |
| 30 | | ,[C_NAME] |
| 31 | | ,[C_SYNONYM_CD] |
| 32 | | ,[C_VISUALATTRIBUTES] |
| 33 | | ,[C_TOTALNUM] |
| 34 | | ,[C_BASECODE] |
| 35 | | ,[C_METADATAXML] |
| 36 | | ,[C_FACTTABLECOLUMN] |
| 37 | | ,[C_TABLENAME] |
| 38 | | ,[C_COLUMNNAME] |
| 39 | | ,[C_COLUMNDATATYPE] |
| 40 | | ,[C_OPERATOR] |
| 41 | | ,[C_DIMCODE] |
| 42 | | ,[C_COMMENT] |
| 43 | | ,[C_TOOLTIP] |
| 44 | | ,[UPDATE_DATE] |
| 45 | | ,[DOWNLOAD_DATE] |
| 46 | | ,[IMPORT_DATE] |
| 47 | | ,[SOURCESYSTEM_CD] |
| 48 | | ,[VALUETYPE_CD] |
| 49 | | ,[m_applied_path] |
| 50 | | ,[m_exclusive_cd] |
| 51 | | ,[C_PATH] |
| 52 | | ,[C_SYMBOL] |
| 53 | | FROM [i2b2ClinDataIntegration].[dbo].[i2b2Ontology] |
| 54 | | WHERE OntologyID = {Ontology ID} |
| 55 | | }}} |
| 56 | | - Where: |
| 57 | | - `Ontology Name` is the name used for the ontology above |
| 58 | | - `Ontology Table Name` is the name of the ontology table created in the i2b2 meta database. |
| 59 | | - `OntologyID` is the ID of the ontology created above |
| | 15 | 3. Create records in the table `OntologyUsage` in the `i2b2ClinDataIntegration` database for each study that will use the ontology. The `StudyName` is the unique portion of the i2b2 database names, for example `i2b2_app03_{studyName}_data`. |
| | 16 | 4. Run the command `EXECUTE [i2b2ClinDataIntegration].[dbo].[UpdateOntologyConceptCodes];` |