Permalink
Browse files

last set of changes

  • Loading branch information...
1 parent de3725b commit c48d8bcff5b47aa3c3a66b3e5161e712a5d1e621 @bentut committed May 25, 2012
View
@@ -42,7 +42,7 @@ gem 'nokogiri'
group :development, :test do
gem 'rspec-rails'
- gem 'cucumber-rails'
+ gem 'cucumber-rails', :require => false
gem 'watchr'
gem 'database_cleaner'
gem 'test-unit', '1.2.3'
View
@@ -105,7 +105,7 @@ GEM
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.4)
- rake (0.9.2)
+ rake (0.9.2.2)
rdoc (3.9.1)
roo (1.9.6)
choice (>= 0.1.4)
@@ -16,7 +16,8 @@ def rake_notification(rake_task, download_results, errors, series, output_path,
@dates = dates
subject = "UDAMAN Error (#{rake_task})" if is_error
subject = "UDAMAN New Download (#{rake_task})" unless is_error
- mail(:to => ["btrevino@hawaii.edu", "jchfung@hawaii.edu", "james29@hawaii.edu", "icintina@gmail.com", "fuleky@hawaii.edu", "bonham@hawaii.edu"], :subject => subject)
+ #"jchfung@hawaii.edu", "james29@hawaii.edu", "icintina@gmail.com", "fuleky@hawaii.edu", "bonham@hawaii.edu"
+ mail(:to => ["btrevino@hawaii.edu"], :subject => subject)
end
def rake_error(e, output_path)
@@ -12,11 +12,11 @@ def ts=(series)
end
def ts_eval=(eval_statement)
- #begin
+ # begin
Series.eval self, eval_statement
- # rescue Exception
- # puts "ERROR | #{self} | #{eval_statement}"
- # end
+ # rescue Exception
+ # puts "ERROR | #{self} | #{eval_statement}"
+ # end
end
def ts_append(series)
View
@@ -19,11 +19,11 @@
# Learn more: http://github.com/javan/whenever
-hour = "4"
+hour = "2"
set :output, "~/Documents/cronlog/udaman-download.log"
set :environment, "development"
#job_type :rake, "cd :path && rake :task :output"
-job_type :rake, "cd :path && rake :task"
+job_type :rake, "cd :path && rake :task :output"
#job_type :rake, "cd :path && RAILS_ENV=:environment bundle exec rake :task :output"
every 1.day, :at => "#{hour}:00 am" do
View
@@ -1,18 +1,5 @@
class Packager
- def Packager.temp
- const_q = {
- "KNRSDNS@HON.Q" => %Q|Series.load_from_download "QSER_G@hawaii.gov", { :file_type => "xls", :start_date => "1993-01-01", :sheet => "G-25", :row => "block:6:1:4", :col => "repeat:2:5", :frequency => "Q" }|,
- "KNRSDNS@HAW.Q" => %Q|Series.load_from_download "QSER_G@hawaii.gov", { :file_type => "xls", :start_date => "1993-01-01", :sheet => "G-26", :row => "block:5:1:4", :col => "repeat:2:5", :frequency => "Q" }|,
- "PICTCONNS@HON.Q" => %Q|Series.load_from_download "QSER_E@hawaii.gov", { :file_type => "xls", :start_date => "1982-01-01", :sheet => "E-7", :row => "block:6:1:4", :col => "repeat:2:5", :frequency => "Q" }|
- }
-
- p = Packager.new
- p.add_definitions const_q
- p.write_definitions_to "/Volumes/UHEROwork/data/misc/const/update/const_upd_q_NEW.xls"
- nil
- end
-
def definitions
@definitions
end
@@ -117,33 +104,36 @@ def write_xls
return if @definitions.nil?
@series = get_data_from_definitions
-
- old_file = File::exists?(@output_path) ? open(@output_path, "rb").read : nil
- old_file_xls = Excel.new(@output_path) if File::exists?(@output_path)
-
- xls = Spreadsheet::Workbook.new @output_path
- sheet1 = xls.create_worksheet
- write_dates(sheet1)
- col = 1
- @series.sort.each do |name, data|
- write_series(name, data, sheet1, col)
- col += 1
- end
+
+ # uncomment to get back to development version or do different branch
+ # old_file = File::exists?(@output_path) ? open(@output_path, "rb").read : nil
+ # old_file_xls = Excel.new(@output_path) if File::exists?(@output_path)
+ #
+ # xls = Spreadsheet::Workbook.new @output_path
+ # sheet1 = xls.create_worksheet
+ # write_dates(sheet1)
+ # col = 1
+ # @series.sort.each do |name, data|
+ # write_series(name, data, sheet1, col)
+ # col += 1
+ # end
+
puts download_results_string
puts errors_string
puts series_summary_string
- xls.write @output_path
- new_file_xls = Excel.new(@output_path)
+ # xls.write @output_path
+ # new_file_xls = Excel.new(@output_path)
- if new_file_xls.to_s != old_file_xls.to_s or errors != [] or download_problem?
- puts new_file_xls.to_s != old_file_xls.to_s
+# if new_file_xls.to_s != old_file_xls.to_s or errors != [] or download_problem?
+# puts new_file_xls.to_s != old_file_xls.to_s
puts errors != []
puts download_problem?
- backup(old_file) unless old_file.nil?
+#uncomment this one too
+# backup(old_file) unless old_file.nil?
puts "SENDING EMAIL"
job_name = @output_path.split("/")[-1].split(".")[0]
PackagerMailer.rake_notification(job_name, download_results, errors, @series, @output_path, dates, (errors != [] or download_problem?)).deliver
- end
+# end
end
View
@@ -679,11 +679,7 @@ task :hiwi_upd => :environment do
p = Packager.new
p.add_definitions hiwi_upd
p.write_definitions_to "/Volumes/UHEROwork/data/bls/update/hiwi_upd_HI_NEW.xls"
-
- p = Packager.new
- p.add_definitions hiwi_upd_hon_pre
- p.write_definitions_to "/Volumes/UHEROwork/data/bls/update/hiwi_upd_HON_PRE.xls"
-
+
p = Packager.new
p.add_definitions hiwi_upd_hon
p.write_definitions_to "/Volumes/UHEROwork/data/bls/update/hiwi_upd_HON_NEW.xls"
@@ -714,6 +710,56 @@ task :bls_identities => :environment do
"CPI@HON.A".ts_eval= %Q|"PC@HON.A".ts|
"CPI@HON.Q".ts_eval= %Q|"PC@HON.Q".ts|
+ 'PC_EN@HON.Q'.ts_eval= %Q|'PC_EN@HON.S'.ts.interpolate :quarter, :linear|
+ 'PC_FDEN@HON.Q'.ts_eval= %Q|'PC_FDEN@HON.S'.ts.interpolate :quarter, :linear|
+ 'PC_MD@HON.Q'.ts_eval= %Q|'PC_MD@HON.S'.ts.interpolate :quarter, :linear|
+ 'PC_SH@HON.Q'.ts_eval= %Q|'PC_SH@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCAP@HON.Q'.ts_eval= %Q|'PCAP@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCCM@HON.Q'.ts_eval= %Q|'PCCM@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCCM_FB@HON.Q'.ts_eval= %Q|'PCCM_FB@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCCM_FD@HON.Q'.ts_eval= %Q|'PCCM_FD@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCCMDR@HON.Q'.ts_eval= %Q|'PCCMDR@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCCMND@HON.Q'.ts_eval= %Q|'PCCMND@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCCMND_FB@HON.Q'.ts_eval= %Q|'PCCMND_FB@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCCMND_FD@HON.Q'.ts_eval= %Q|'PCCMND_FD@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCED@HON.Q'.ts_eval= %Q|'PCED@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCEN@HON.Q'.ts_eval= %Q|'PCEN@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCFB@HON.Q'.ts_eval= %Q|'PCFB@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCFBFD@HON.Q'.ts_eval= %Q|'PCFBFD@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCFBFDAW@HON.Q'.ts_eval= %Q|'PCFBFDAW@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCFBFDBV@HON.Q'.ts_eval= %Q|'PCFBFDBV@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCFBFDHM@HON.Q'.ts_eval= %Q|'PCFBFDHM@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCHS@HON.Q'.ts_eval= %Q|'PCHS@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCHSFU@HON.Q'.ts_eval= %Q|'PCHSFU@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCHSFUEL@HON.Q'.ts_eval= %Q|'PCHSFUEL@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCHSFUGS@HON.Q'.ts_eval= %Q|'PCHSFUGS@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCHSFUGSE@HON.Q'.ts_eval= %Q|'PCHSFUGSE@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCHSFUGSU@HON.Q'.ts_eval= %Q|'PCHSFUGSU@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCHSHF@HON.Q'.ts_eval= %Q|'PCHSHF@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCHSSH@HON.Q'.ts_eval= %Q|'PCHSSH@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCHSSHOW@HON.Q'.ts_eval= %Q|'PCHSSHOW@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCHSSHRT@HON.Q'.ts_eval= %Q|'PCHSSHRT@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCMD@HON.Q'.ts_eval= %Q|'PCMD@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCOT@HON.Q'.ts_eval= %Q|'PCOT@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCRE@HON.Q'.ts_eval= %Q|'PCRE@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCSV@HON.Q'.ts_eval= %Q|'PCSV@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCSV_MD@HON.Q'.ts_eval= %Q|'PCSV_MD@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCSV_RN@HON.Q'.ts_eval= %Q|'PCSV_RN@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCTR@HON.Q'.ts_eval= %Q|'PCTR@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCTRGS@HON.Q'.ts_eval= %Q|'PCTRGS@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCTRGSMD@HON.Q'.ts_eval= %Q|'PCTRGSMD@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCTRGSPR@HON.Q'.ts_eval= %Q|'PCTRGSPR@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCTRGSRG@HON.Q'.ts_eval= %Q|'PCTRGSRG@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCTRMF@HON.Q'.ts_eval= %Q|'PCTRMF@HON.S'.ts.interpolate :quarter, :linear|
+ 'PCTRPR@HON.Q'.ts_eval= %Q|'PCTRPR@HON.S'.ts.interpolate :quarter, :linear|
+
+ #special cases with more frequent data
+ "PCHSFUEL@HON.Q".ts_append_eval %Q|"PCHSFUEL@HON.M".ts.aggregate(:quarter, :average)|
+ "PCHSFUGSE@HON.Q".ts_append_eval %Q|"PCHSFUGSE@HON.M".ts.aggregate(:quarter, :average)|
+ "PCHSFUGS@HON.Q".ts_append_eval %Q|"PCHSFUGS@HON.M".ts.aggregate(:quarter, :average)|
+
+
+
#needs EMN up here....
["HI", "HON", "HAW", "MAU", "KAU"].each do |cnty|
View

Large diffs are not rendered by default.

Oops, something went wrong.

0 comments on commit c48d8bc

Please sign in to comment.