Jesper Rønn-Jensen wrote:
> Hi there
> (so silent in this forum??? Hope somebody is listening...
Yeah, I agree with you!  Silence is golden...ah, wait, that's the library! 
>
>
> Here are my final additions to the documentation (as you know i have 
> basically just copied from the user guide...)
> I am still not satisfied with the level of documentation... I still 
> think there could be more examples put in, some files/features are 
> still not documented, etc.
Perhaps I can help fill in some of those documentation gaps...here is a 
ctl script that demonstrates:

 - copy processor
 - rename processor (not sure what's different between the two!)
 - transforms via SQLResolver
 - database to database (instead of bulk load):
 - calculated a weighted column (needed for multi-dimensional data, 
which I'm still working through figuring out!)


source_columns =   [
    :uniqueid,
    :diagposition,
    :i9diag,
    :disdate,
    :weighted_value
  ]

dest_columns = [
  :patient_id,
  :icd9_diag_position,   
  :icd9_diag_id,
  :discharge_date_id,
  :weighted_value
    ]

weight_col = "1 / (select count(*) from jhhdiag_all where uniqueid = 
d.uniqueid) as weighted_value"

source :in, { 
  :type => :database,
  :database => "warehouse_staging", 
  :target => :staging, 
  :table => "diag_all d",
  :join => "join pat_main_onlyfirsticd9 m on d.uniqueid = m.uniqueid", 
  :select => "d.uniqueid, d.diagposition, d.i9diag, m.disdate, 
#{weight_col}"
  }, source_columns

rename :uniqueid, :patient_id
rename :diagposition, :icd9_diag_position
rename :i9diag, :icd9_diag_id
rename :disdate, :discharge_date_id
transform :icd9_diag_id, :foreign_key_lookup, {:resolver => 
SQLResolver.new("icd9_diagnosis_dimension", "icd9_diag_code", :warehouse)}
transform :discharge_date_id, :foreign_key_lookup, {:resolver => 
SQLResolver.new("date_dimension", "date_stamp", :warehouse)}
copy :weighted_value, :weighted_value

destination :out, {
  :type => :database,
  :database => "warehouse_development", 
  :target => :warehouse, 
  :table => "diagnosis_facts"
  },
  {
  :order => [:id, dest_columns].flatten
  }



Regards,

Michael
_______________________________________________
Activewarehouse-discuss mailing list
Activewarehouse-discuss@rubyforge.org
http://rubyforge.org/mailman/listinfo/activewarehouse-discuss

Reply via email to