| 99 | == Deleting and re-importing data == |
| 100 | |
| 101 | When deleting and re-importing Onyx data (which includes the data for creating the patients in the i2b2 patient dimension), it is important to consider the data held against the other ontologies in i2b2. Either everything has to be deleted, which implies not having pathology, PATS or subsequent third-party data until the next time those routines load to i2b2, or the data has to be selectively deleted without damaging the data held against the other ontologies AND the patients need to be reloaded in the same order, to ensure that patients are allocated to the correct i2b2 identifiers. |
| 102 | Database preparation for a complete reload of Onyx data. |
| 103 | |
| 104 | Assuming all metadata is unchanged. |
| 105 | |
| 106 | Need to be sure that the patients are mapped consistently in the re-loading process. General approach is to delete all the data (patient dimension, observation facts, visit dimension) but not touch ANY metadata. |
| 107 | |
| 108 | |
| 109 | metadata database - NO CHANGES |
| 110 | |
| 111 | work database - NO CHANGES |
| 112 | |
| 113 | hive - NO CHANGES |
| 114 | |
| 115 | pm - NO CHANGES |
| 116 | |
| 117 | |
| 118 | data DATABASE TABLES: |
| 119 | |
| 120 | ARCHIVE_OBSERVATION_FACT |
| 121 | - Currently empty. Leave. |
| 122 | |
| 123 | CODE_LOOKUP |
| 124 | - Currently empty. Leave. |
| 125 | |
| 126 | concept_dimension |
| 127 | - Pointers to ontology. Leave alone because ontology is not changing. |
| 128 | |
| 129 | DATAMART_REPORT |
| 130 | - Currently empty. Leave. |
| 131 | |
| 132 | Encounter_Mapping |
| 133 | - Currently empty. Leave. |
| 134 | |
| 135 | Observation_Fact |
| 136 | - All observations included, from all ontologies. |
| 137 | Selective delete. |
| 138 | Need to delete where Concept_Cd LIKE 'CBO:%' |
| 139 | 19770 rows deleted. |
| 140 | ALSO THERE ARE FOUR ENTRIES WHERE Concept_Cd is empty. WHY?????? Delete them also. |
| 141 | 4 rows deleted. |
| 142 | |
| 143 | Patient_Dimension |
| 144 | - All patients |
| 145 | Need to delete all. |
| 146 | 110 rows deleted. |
| 147 | |
| 148 | Patient_Mapping |
| 149 | - All patients |
| 150 | Need to delete all. |
| 151 | 330 rows deleted. |
| 152 | |
| 153 | Provider_Dimension |
| 154 | - Currently empty. Leave. |
| 155 | |
| 156 | QT_* |
| 157 | - Are related to queries. Leave. |
| 158 | |
| 159 | SET_TYPE |
| 160 | Index of 'set' types. Leave. |
| 161 | |
| 162 | SET_UPLOAD_STATUS |
| 163 | - Currently empty. Leave. |
| 164 | |
| 165 | SOURCE_MASTER |
| 166 | - Currently empty. Leave. |
| 167 | |
| 168 | UPLOAD_STATUS |
| 169 | - Currently empty. Leave. |
| 170 | |
| 171 | Visit_Dimension |
| 172 | Only Onyx data is loaded against 'visit dimension', one per patient. It is built by the import process. DELETE ALL. |
| 173 | 110 rows deleted. |
| 174 | |
| 175 | |
| 176 | Looking to check which onyx export file(s) to use. |
| 177 | |
| 178 | procedures-1.0-SNAPSHOT-development-old alpha used test-BRICCS-20111021090857.zip, generated 8 patients. |
| 179 | |
| 180 | procedures-1.0-SNAPSHOT-development alpha used live-BRICCS-20111031180021.zip, generated 53 patients. |
| 181 | |
| 182 | procedures-1.0-SNAPSHOT-development beta used live-BRICCS-20111031184824.zip, generated 57 patients. |
| 183 | |
| 184 | procedures-development-trac92 used BRICCS-20110106095220.zip, generated 4 patients. |
| 185 | |
| 186 | procedures-trac108-SNAPSHOT_development ws-test used live-BRICCS-20111031184824.zip, generated 57 patients. |
| 187 | |
| 188 | Do two jobs: alpha and beta |
| 189 | |
| 190 | alpha: Use /home/nick/onyxexports/live-BRICCS-20111031180021.zip, generate 53 patients. |
| 191 | |
| 192 | beta: Use /home/nick/onyxexports/live-BRICCS-20111031184824.zip, generate 57 patients. |
| 193 | |
| 194 | This kind of worked, except that the TEST i2b2 on uhlbriccsapp02.xuhl-tr.nhs.uk had 110 patients loaded against pids from 2 to 111, and the above process re-loaded them against pids from 1 to 110. Oops. But either the other data (PATS and pathology) will be re-loaded against the new pids overnight, OR I can re-run this process tomorrow with pid=2 and eid=2 for the first batch. |
| 195 | |
| 196 | |
| 197 | = NOTE: PROCESS WILL BE DIFFERENT IF THE ONTOLOGY ITSELF IS CHANGED IN ANY WAY. = |
| 198 | |