loadmop 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a7029b044d93f41028317ac778c8b24e75300a9
4
- data.tar.gz: 54cfc07a3bb6728e92c943f34fa43b82cf4ddc2e
3
+ metadata.gz: 29603109f634075f4bb3db87f6603f365c97a974
4
+ data.tar.gz: 56326ee8b9aa7310ec40c5a30e4d8840bb85fec3
5
5
  SHA512:
6
- metadata.gz: e7627ac22cb4226135881d79167176c2589daefdcb0e2ecbfe9f01f0cc66771c6c23c5515b53fcbf9265cc16a4482d0e40ed70e810247c2d762fbe881ededd29
7
- data.tar.gz: 7edcd242425a3f20aeaef07f258c854fa3600139ece6037a0332e71a5485793dc14b385545cf4ab9cda3e876421cf98e878f47ecfff1b3ca296bb5012f8f5f41
6
+ metadata.gz: ee75959db2094edbc48f1912dd3572be6e0a0934bbea869204b26dd92946d63fc5f7f64c63c979062dac3291a8a668897b4b8e81ef2bc1f651d1a5904f0347c6
7
+ data.tar.gz: d080e12de2980d8fd1de0a57cadef04a7d29774886c9f4a7d0fc1891d69460c600ba9e70890e8360247e799d544036772985ea7b2932971b42a743512fc51db8
@@ -1,6 +1,21 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## 0.0.5 - 2014-09-03
5
+
6
+ ### Added
7
+ - Support for SQL Server.
8
+
9
+ ### Deprecated
10
+ - Nothing.
11
+
12
+ ### Removed
13
+ - Nothing.
14
+
15
+ ### Fixed
16
+ - Bumped Sequelizer version to 0.0.5
17
+
18
+
4
19
  ## 0.0.4 - 2014-08-29
5
20
 
6
21
  ### Added
data/README.md CHANGED
@@ -54,6 +54,7 @@ Then:
54
54
  - **Create the database you just specified in your .env file**
55
55
  - loadmop isn't (yet) cool enough to actually create the database for you
56
56
  - If you're using SQLite, you don't have to create the database file
57
+ - **If your database defaults to using case-insensitive storage of text, (I'm looking at you MySQL and SQL Server), make sure to set a case-sensitive collation on your database**
57
58
  - cd into a directory where you've defined a config/database.yml or .env file that is compatible with Sequelizer
58
59
  - run `bundle install` to make sure you have all the needed dependencies installed
59
60
  - run `bundle exec sequelizer config` to ensure your connection parameters are correctly set
@@ -3,28 +3,12 @@ require_relative 'loader'
3
3
  module Loadmop
4
4
  class CDMv4Loader < Loader
5
5
 
6
- def initialize(*args)
7
- super(*args)
8
- set_schema_if_necessary
9
- end
10
-
11
6
  private
12
7
 
13
- def schemas_dir
14
- 'schemas/cdmv4'
15
- end
16
-
17
- def files
8
+ def files_of_interest
18
9
  ordered_file_names.map { |name| data_files_dir + name }.select(&:exist?)
19
10
  end
20
11
 
21
- def set_schema_if_necessary
22
- return unless adapter == 'postgres'
23
- return unless options[:schema]
24
- db.create_schema(options[:schema], if_not_exists: true)
25
- db.execute("SET search_path TO #{options[:schema]}")
26
- end
27
-
28
12
  def ordered_tables
29
13
  %w(
30
14
  person
@@ -50,5 +34,410 @@ module Loadmop
50
34
  def ordered_file_names
51
35
  ordered_tables.map { |f| f + '.csv' }
52
36
  end
37
+
38
+ def create_tables
39
+ create_schema_if_necessary
40
+ location_table = table_name(:location)
41
+ provider_table = table_name(:provider)
42
+ person_table = table_name(:person)
43
+ drug_exposure_table = table_name(:drug_exposure)
44
+ procedure_occurrence_table = table_name(:procedure_occurrence)
45
+ db.create_table!(table_name(:care_site), :ignore_index_errors=>true) do
46
+ Bignum :care_site_id, :null=>false
47
+ Bignum :location_id, :null=>false
48
+ Bignum :organization_id, :null=>false
49
+ Bignum :place_of_service_concept_id
50
+ String :care_site_source_value, :size=>50
51
+ String :place_of_service_source_value, :size=>50, :null=>false
52
+
53
+ primary_key [:care_site_id]
54
+ end
55
+
56
+ db.create_table!(table_name(:cohort), :ignore_index_errors=>true) do
57
+ Bignum :cohort_id, :null=>false
58
+ Bignum :cohort_concept_id, :null=>false
59
+ Date :cohort_start_date, :null=>false
60
+ Date :cohort_end_date
61
+ Bignum :subject_id, :null=>false
62
+ String :stop_reason, :size=>20
63
+
64
+ primary_key [:cohort_id]
65
+ end
66
+
67
+ db.create_table!(table_name(:location), :ignore_index_errors=>true) do
68
+ Bignum :location_id, :null=>false
69
+ String :address_1, :size=>50
70
+ String :address_2, :size=>50
71
+ String :city, :size=>50
72
+ String :state, :size=>2, :fixed=>true
73
+ String :zip, :size=>9
74
+ String :county, :size=>20
75
+ String :location_source_value, :size=>50
76
+
77
+ primary_key [:location_id]
78
+ end
79
+
80
+ db.create_table!(table_name(:provider), :ignore_index_errors=>true) do
81
+ Bignum :provider_id, :null=>false
82
+ String :npi, :size=>20
83
+ String :dea, :size=>20
84
+ Bignum :specialty_concept_id
85
+ Bignum :care_site_id, :null=>false
86
+ String :provider_source_value, :size=>50, :null=>false
87
+ String :specialty_source_value, :size=>50
88
+
89
+ primary_key [:provider_id]
90
+ end
91
+
92
+ db.create_table!(table_name(:organization), :ignore_index_errors=>true) do
93
+ Bignum :organization_id, :null=>false
94
+ Bignum :place_of_service_concept_id
95
+ foreign_key :location_id, location_table, :type=>Bignum, :key=>[:location_id]
96
+ String :organization_source_value, :size=>50, :null=>false
97
+ String :place_of_service_source_value, :size=>50
98
+
99
+ primary_key [:organization_id]
100
+ end
101
+
102
+ db.create_table!(table_name(:person), :ignore_index_errors=>true) do
103
+ Bignum :person_id, :null=>false
104
+ Bignum :gender_concept_id, :null=>false
105
+ Integer :year_of_birth, :null=>false
106
+ Integer :month_of_birth
107
+ Integer :day_of_birth
108
+ Bignum :race_concept_id
109
+ Bignum :ethnicity_concept_id
110
+ foreign_key :location_id, location_table, :type=>Bignum, :key=>[:location_id]
111
+ foreign_key :provider_id, provider_table, :type=>Bignum, :key=>[:provider_id]
112
+ Bignum :care_site_id
113
+ String :person_source_value, :size=>50
114
+ String :gender_source_value, :size=>50
115
+ String :race_source_value, :size=>50
116
+ String :ethnicity_source_value, :size=>50
117
+
118
+ primary_key [:person_id]
119
+ end
120
+
121
+ db.create_table!(table_name(:condition_era), :ignore_index_errors=>true) do
122
+ Bignum :condition_era_id, :null=>false
123
+ foreign_key :person_id, person_table, :type=>Bignum, :null=>false, :key=>[:person_id]
124
+ Bignum :condition_concept_id, :null=>false
125
+ Date :condition_era_start_date, :null=>false
126
+ Date :condition_era_end_date, :null=>false
127
+ Bignum :condition_type_concept_id, :null=>false
128
+ Integer :condition_occurrence_count
129
+
130
+ primary_key [:condition_era_id]
131
+ end
132
+
133
+ db.create_table!(table_name(:condition_occurrence), :ignore_index_errors=>true) do
134
+ Bignum :condition_occurrence_id, :null=>false
135
+ foreign_key :person_id, person_table, :type=>Bignum, :null=>false, :key=>[:person_id]
136
+ Bignum :condition_concept_id, :null=>false
137
+ Date :condition_start_date, :null=>false
138
+ Date :condition_end_date
139
+ Bignum :condition_type_concept_id, :null=>false
140
+ String :stop_reason, :size=>20
141
+ Bignum :associated_provider_id
142
+ Bignum :visit_occurrence_id
143
+ String :condition_source_value, :size=>50
144
+
145
+ primary_key [:condition_occurrence_id]
146
+ end
147
+
148
+ db.create_table!(table_name(:death), :ignore_index_errors=>true) do
149
+ foreign_key :person_id, person_table, :type=>Bignum, :null=>false, :key=>[:person_id]
150
+ Date :death_date, :null=>false
151
+ Bignum :death_type_concept_id, :null=>false
152
+ Bignum :cause_of_death_concept_id
153
+ String :cause_of_death_source_value, :size=>50
154
+
155
+ primary_key [:person_id]
156
+ end
157
+
158
+ db.create_table!(table_name(:drug_era), :ignore_index_errors=>true) do
159
+ Bignum :drug_era_id, :null=>false
160
+ foreign_key :person_id, person_table, :type=>Bignum, :null=>false, :key=>[:person_id]
161
+ Bignum :drug_concept_id, :null=>false
162
+ Date :drug_era_start_date, :null=>false
163
+ Date :drug_era_end_date, :null=>false
164
+ Bignum :drug_type_concept_id, :null=>false
165
+ Integer :drug_exposure_count
166
+
167
+ primary_key [:drug_era_id]
168
+ end
169
+
170
+ db.create_table!(table_name(:drug_exposure), :ignore_index_errors=>true) do
171
+ Bignum :drug_exposure_id, :null=>false
172
+ foreign_key :person_id, person_table, :type=>Bignum, :null=>false, :key=>[:person_id]
173
+ Bignum :drug_concept_id, :null=>false
174
+ Date :drug_exposure_start_date, :null=>false
175
+ Date :drug_exposure_end_date
176
+ Bignum :drug_type_concept_id, :null=>false
177
+ String :stop_reason, :size=>20
178
+ Integer :refills
179
+ Integer :quantity
180
+ Integer :days_supply
181
+ String :sig, :size=>500
182
+ Bignum :prescribing_provider_id
183
+ Bignum :visit_occurrence_id
184
+ Bignum :relevant_condition_concept_id
185
+ String :drug_source_value, :size=>50
186
+
187
+ primary_key [:drug_exposure_id]
188
+ end
189
+
190
+ db.create_table!(table_name(:observation), :ignore_index_errors=>true) do
191
+ Bignum :observation_id, :null=>false
192
+ foreign_key :person_id, person_table, :type=>Bignum, :null=>false, :key=>[:person_id]
193
+ Bignum :observation_concept_id, :null=>false
194
+ Date :observation_date, :null=>false
195
+ Date :observation_time
196
+ Float :value_as_number
197
+ String :value_as_string, :size=>60
198
+ Bignum :value_as_concept_id
199
+ Bignum :unit_concept_id
200
+ Float :range_low
201
+ Float :range_high
202
+ Bignum :observation_type_concept_id, :null=>false
203
+ Bignum :associated_provider_id
204
+ Bignum :visit_occurrence_id
205
+ Bignum :relevant_condition_concept_id
206
+ String :observation_source_value, :size=>50
207
+ String :units_source_value, :size=>50
208
+
209
+ primary_key [:observation_id]
210
+ end
211
+
212
+ db.create_table!(table_name(:observation_period), :ignore_index_errors=>true) do
213
+ Bignum :observation_period_id, :null=>false
214
+ foreign_key :person_id, person_table, :type=>Bignum, :null=>false, :key=>[:person_id]
215
+ Date :observation_period_start_date, :null=>false
216
+ Date :observation_period_end_date, :null=>false
217
+ Date :prev_ds_period_end_date
218
+
219
+ primary_key [:observation_period_id]
220
+ end
221
+
222
+ db.create_table!(table_name(:payer_plan_period), :ignore_index_errors=>true) do
223
+ Bignum :payer_plan_period_id, :null=>false
224
+ foreign_key :person_id, person_table, :type=>Bignum, :null=>false, :key=>[:person_id]
225
+ Date :payer_plan_period_start_date, :null=>false
226
+ Date :payer_plan_period_end_date, :null=>false
227
+ String :payer_source_value, :size=>50
228
+ String :plan_source_value, :size=>50
229
+ String :family_source_value, :size=>50
230
+ Date :prev_ds_period_end_date
231
+
232
+ primary_key [:payer_plan_period_id]
233
+ end
234
+
235
+ db.create_table!(table_name(:procedure_occurrence), :ignore_index_errors=>true) do
236
+ Bignum :procedure_occurrence_id, :null=>false
237
+ foreign_key :person_id, person_table, :type=>Bignum, :null=>false, :key=>[:person_id]
238
+ Bignum :procedure_concept_id, :null=>false
239
+ Date :procedure_date, :null=>false
240
+ Bignum :procedure_type_concept_id, :null=>false
241
+ Bignum :associated_provider_id
242
+ Bignum :visit_occurrence_id
243
+ Bignum :relevant_condition_concept_id
244
+ String :procedure_source_value, :size=>50
245
+
246
+ primary_key [:procedure_occurrence_id]
247
+ end
248
+
249
+ db.create_table!(table_name(:visit_occurrence), :ignore_index_errors=>true) do
250
+ Bignum :visit_occurrence_id, :null=>false
251
+ foreign_key :person_id, person_table, :type=>Bignum, :null=>false, :key=>[:person_id]
252
+ Date :visit_start_date, :null=>false
253
+ Date :visit_end_date, :null=>false
254
+ Bignum :place_of_service_concept_id, :null=>false
255
+ Bignum :care_site_id
256
+ String :place_of_service_source_value, :size=>50
257
+
258
+ primary_key [:visit_occurrence_id]
259
+ end
260
+
261
+ db.create_table!(table_name(:drug_cost), :ignore_index_errors=>true) do
262
+ Bignum :drug_cost_id, :null=>false
263
+ foreign_key :drug_exposure_id, drug_exposure_table, :type=>Bignum, :null=>false, :key=>[:drug_exposure_id]
264
+ Float :paid_copay
265
+ Float :paid_coinsurance
266
+ Float :paid_toward_deductible
267
+ Float :paid_by_payer
268
+ Float :paid_by_coordination_benefits
269
+ Float :total_out_of_pocket
270
+ Float :total_paid
271
+ Float :ingredient_cost
272
+ Float :dispensing_fee
273
+ Float :average_wholesale_price
274
+ Bignum :payer_plan_period_id
275
+
276
+ primary_key [:drug_cost_id]
277
+ end
278
+
279
+ db.create_table!(table_name(:procedure_cost), :ignore_index_errors=>true) do
280
+ Bignum :procedure_cost_id, :null=>false
281
+ foreign_key :procedure_occurrence_id, procedure_occurrence_table, :type=>Bignum, :null=>false, :key=>[:procedure_occurrence_id]
282
+ Float :paid_copay
283
+ Float :paid_coinsurance
284
+ Float :paid_toward_deductible
285
+ Float :paid_by_payer
286
+ Float :paid_by_coordination_benefits
287
+ Float :total_out_of_pocket
288
+ Float :total_paid
289
+ Bignum :disease_class_concept_id
290
+ Bignum :revenue_code_concept_id
291
+ Bignum :payer_plan_period_id
292
+ String :disease_class_source_value, :size=>50
293
+ String :revenue_code_source_value, :size=>50
294
+
295
+ primary_key [:procedure_cost_id]
296
+ end
297
+ end
298
+
299
+ def create_indexes
300
+ db.alter_table(table_name(:care_site)) do
301
+ add_index [:location_id, :organization_id, :place_of_service_source_value], :name=>:care_site_location_id_organization_id_place_of_service_sour_key, :unique=>true, :ignore_add_index_errors=>true
302
+ add_index [:care_site_id], :name=>:carsit_carsitid, :ignore_add_index_errors=>true
303
+ add_index [:location_id], :name=>:carsit_locid, :ignore_add_index_errors=>true
304
+ add_index [:organization_id], :name=>:carsit_orgid, :ignore_add_index_errors=>true
305
+ add_index [:place_of_service_concept_id], :name=>:carsit_plaofserconid, :ignore_add_index_errors=>true
306
+ add_index [:location_id, :organization_id, :place_of_service_source_value, :care_site_id], :name=>:idx_care_site_org_sources, :ignore_add_index_errors=>true
307
+ end
308
+
309
+ db.alter_table(table_name(:cohort)) do
310
+ add_index [:cohort_concept_id], :name=>:coh_cohconid, :ignore_add_index_errors=>true
311
+ add_index [:cohort_id], :name=>:coh_cohid, :ignore_add_index_errors=>true
312
+ add_index [:subject_id], :name=>:coh_subid, :ignore_add_index_errors=>true
313
+ end
314
+
315
+ db.alter_table(table_name(:location)) do
316
+ add_index [:location_id], :name=>:loc_locid, :ignore_add_index_errors=>true
317
+ add_index [:zip, :county], :name=>:location_zip_county_key, :unique=>true, :ignore_add_index_errors=>true
318
+ end
319
+
320
+ db.alter_table(table_name(:provider)) do
321
+ add_index [:provider_source_value, :specialty_source_value, :provider_id, :care_site_id], :name=>:idx_provider_lkp, :ignore_add_index_errors=>true
322
+ add_index [:care_site_id], :name=>:pro_carsitid, :ignore_add_index_errors=>true
323
+ add_index [:provider_id], :name=>:pro_proid, :ignore_add_index_errors=>true
324
+ add_index [:specialty_concept_id], :name=>:pro_speconid, :ignore_add_index_errors=>true
325
+ end
326
+
327
+ db.alter_table(table_name(:organization)) do
328
+ add_index [:location_id], :name=>:org_locid, :ignore_add_index_errors=>true
329
+ add_index [:organization_id], :name=>:org_orgid, :ignore_add_index_errors=>true
330
+ add_index [:place_of_service_concept_id], :name=>:org_plaofserconid, :ignore_add_index_errors=>true
331
+ end
332
+
333
+ db.alter_table(table_name(:person)) do
334
+ add_index [:care_site_id], :name=>:per_carsitid, :ignore_add_index_errors=>true
335
+ add_index [:ethnicity_concept_id], :name=>:per_ethconid, :ignore_add_index_errors=>true
336
+ add_index [:gender_concept_id], :name=>:per_genconid, :ignore_add_index_errors=>true
337
+ add_index [:location_id], :name=>:per_locid, :ignore_add_index_errors=>true
338
+ add_index [:person_id], :name=>:per_perid, :ignore_add_index_errors=>true
339
+ add_index [:provider_id], :name=>:per_proid, :ignore_add_index_errors=>true
340
+ add_index [:race_concept_id], :name=>:per_racconid, :ignore_add_index_errors=>true
341
+ end
342
+
343
+ db.alter_table(table_name(:condition_era)) do
344
+ add_index [:condition_concept_id], :name=>:conera_conconid, :ignore_add_index_errors=>true
345
+ add_index [:condition_era_id], :name=>:conera_coneraid, :ignore_add_index_errors=>true
346
+ add_index [:condition_type_concept_id], :name=>:conera_contypconid, :ignore_add_index_errors=>true
347
+ add_index [:person_id], :name=>:conera_perid, :ignore_add_index_errors=>true
348
+ end
349
+
350
+ db.alter_table(table_name(:condition_occurrence)) do
351
+ add_index [:condition_concept_id], :name=>:cci, :ignore_add_index_errors=>true
352
+ add_index [:associated_provider_id], :name=>:conocc_assproid, :ignore_add_index_errors=>true
353
+ add_index [:condition_concept_id], :name=>:conocc_conconid, :ignore_add_index_errors=>true
354
+ add_index [:condition_occurrence_id], :name=>:conocc_conoccid, :ignore_add_index_errors=>true
355
+ add_index [:condition_source_value], :name=>:conocc_consouval, :ignore_add_index_errors=>true
356
+ add_index [:condition_type_concept_id], :name=>:conocc_contypconid, :ignore_add_index_errors=>true
357
+ add_index [:person_id], :name=>:conocc_perid, :ignore_add_index_errors=>true
358
+ add_index [:visit_occurrence_id], :name=>:conocc_visoccid, :ignore_add_index_errors=>true
359
+ add_index [:visit_occurrence_id], :name=>:voi, :ignore_add_index_errors=>true
360
+ end
361
+
362
+ db.alter_table(table_name(:death)) do
363
+ add_index [:cause_of_death_concept_id], :name=>:dea_cauofdeaconid, :ignore_add_index_errors=>true
364
+ add_index [:death_type_concept_id], :name=>:dea_deatypconid, :ignore_add_index_errors=>true
365
+ add_index [:person_id], :name=>:dea_perid, :ignore_add_index_errors=>true
366
+ end
367
+
368
+ db.alter_table(table_name(:drug_era)) do
369
+ add_index [:drug_concept_id], :name=>:druera_druconid, :ignore_add_index_errors=>true
370
+ add_index [:drug_era_id], :name=>:druera_drueraid, :ignore_add_index_errors=>true
371
+ add_index [:drug_type_concept_id], :name=>:druera_drutypconid, :ignore_add_index_errors=>true
372
+ add_index [:person_id], :name=>:druera_perid, :ignore_add_index_errors=>true
373
+ end
374
+
375
+ db.alter_table(table_name(:drug_exposure)) do
376
+ add_index [:drug_concept_id], :name=>:druexp_druconid, :ignore_add_index_errors=>true
377
+ add_index [:drug_exposure_id], :name=>:druexp_druexpid, :ignore_add_index_errors=>true
378
+ add_index [:drug_type_concept_id], :name=>:druexp_drutypconid, :ignore_add_index_errors=>true
379
+ add_index [:person_id], :name=>:druexp_perid, :ignore_add_index_errors=>true
380
+ add_index [:prescribing_provider_id], :name=>:druexp_preproid, :ignore_add_index_errors=>true
381
+ add_index [:relevant_condition_concept_id], :name=>:druexp_relconconid, :ignore_add_index_errors=>true
382
+ add_index [:visit_occurrence_id], :name=>:druexp_visoccid, :ignore_add_index_errors=>true
383
+ end
384
+
385
+ db.alter_table(table_name(:observation)) do
386
+ add_index [:associated_provider_id], :name=>:obs_assproid, :ignore_add_index_errors=>true
387
+ add_index [:observation_concept_id], :name=>:obs_obsconid, :ignore_add_index_errors=>true
388
+ add_index [:observation_id], :name=>:obs_obsid, :ignore_add_index_errors=>true
389
+ add_index [:observation_type_concept_id], :name=>:obs_obstypconid, :ignore_add_index_errors=>true
390
+ add_index [:person_id], :name=>:obs_perid, :ignore_add_index_errors=>true
391
+ add_index [:relevant_condition_concept_id], :name=>:obs_relconconid, :ignore_add_index_errors=>true
392
+ add_index [:unit_concept_id], :name=>:obs_uniconid, :ignore_add_index_errors=>true
393
+ add_index [:value_as_concept_id], :name=>:obs_valasconid, :ignore_add_index_errors=>true
394
+ add_index [:visit_occurrence_id], :name=>:obs_visoccid, :ignore_add_index_errors=>true
395
+ end
396
+
397
+ db.alter_table(table_name(:observation_period)) do
398
+ add_index [:person_id, :observation_period_start_date, :observation_period_end_date], :name=>:idx_observation_period_lkp, :ignore_add_index_errors=>true
399
+ add_index [:observation_period_id], :name=>:obsper_obsperid, :ignore_add_index_errors=>true
400
+ add_index [:person_id], :name=>:obsper_perid, :ignore_add_index_errors=>true
401
+ end
402
+
403
+ db.alter_table(table_name(:payer_plan_period)) do
404
+ add_index [:person_id, :plan_source_value, :payer_plan_period_start_date, :payer_plan_period_end_date], :name=>:idx_payer_plan_period_lkp, :ignore_add_index_errors=>true
405
+ add_index [:payer_plan_period_id], :name=>:payplaper_payplaperid, :ignore_add_index_errors=>true
406
+ add_index [:person_id], :name=>:payplaper_perid, :ignore_add_index_errors=>true
407
+ end
408
+
409
+ db.alter_table(table_name(:procedure_occurrence)) do
410
+ add_index [:associated_provider_id], :name=>:proocc_assproid, :ignore_add_index_errors=>true
411
+ add_index [:person_id], :name=>:proocc_perid, :ignore_add_index_errors=>true
412
+ add_index [:procedure_concept_id], :name=>:proocc_proconid, :ignore_add_index_errors=>true
413
+ add_index [:procedure_occurrence_id], :name=>:proocc_prooccid, :ignore_add_index_errors=>true
414
+ add_index [:procedure_source_value], :name=>:proocc_prosouval, :ignore_add_index_errors=>true
415
+ add_index [:procedure_type_concept_id], :name=>:proocc_protypconid, :ignore_add_index_errors=>true
416
+ add_index [:relevant_condition_concept_id], :name=>:proocc_relconconid, :ignore_add_index_errors=>true
417
+ add_index [:visit_occurrence_id], :name=>:proocc_visoccid, :ignore_add_index_errors=>true
418
+ end
419
+
420
+ db.alter_table(table_name(:visit_occurrence)) do
421
+ add_index [:person_id, :visit_start_date, :place_of_service_concept_id], :name=>:visit_occurrence_person_id_visit_start_date_place_of_servic_key, :ignore_add_index_errors=>true
422
+ add_index [:care_site_id], :name=>:visocc_carsitid, :ignore_add_index_errors=>true
423
+ add_index [:person_id], :name=>:visocc_perid, :ignore_add_index_errors=>true
424
+ add_index [:place_of_service_concept_id], :name=>:visocc_plaofserconid, :ignore_add_index_errors=>true
425
+ add_index [:visit_occurrence_id], :name=>:visocc_visoccid, :ignore_add_index_errors=>true
426
+ end
427
+
428
+ db.alter_table(table_name(:drug_cost)) do
429
+ add_index [:drug_cost_id], :name=>:drucos_drucosid, :ignore_add_index_errors=>true
430
+ add_index [:drug_exposure_id], :name=>:drucos_druexpid, :ignore_add_index_errors=>true
431
+ add_index [:payer_plan_period_id], :name=>:drucos_payplaperid, :ignore_add_index_errors=>true
432
+ end
433
+
434
+ db.alter_table(table_name(:procedure_cost)) do
435
+ add_index [:disease_class_concept_id], :name=>:procos_disclaconid, :ignore_add_index_errors=>true
436
+ add_index [:payer_plan_period_id], :name=>:procos_payplaperid, :ignore_add_index_errors=>true
437
+ add_index [:procedure_cost_id], :name=>:procos_procosid, :ignore_add_index_errors=>true
438
+ add_index [:procedure_occurrence_id], :name=>:procos_prooccid, :ignore_add_index_errors=>true
439
+ add_index [:revenue_code_concept_id], :name=>:procos_revcodconid, :ignore_add_index_errors=>true
440
+ end
441
+ end
53
442
  end
54
443
  end