Permalink
Browse files

some depth first graph traversal

  • Loading branch information...
1 parent 4267fee commit 0f86d120e6b4da0f2f6b2c2418cbeb1fc4034b07 @bentut committed Feb 27, 2013
View
@@ -360,6 +360,10 @@ def scaled_data_no_pseudo_history(round_to = 3)
data_hash
end
+ def Series.new_from_data(frequency, data)
+ Series.new_transformation("One off data", data, frequency)
+ end
+
def Series.new_transformation(name, data, frequency)
Series.new(
:name => name,
@@ -779,6 +783,23 @@ def last_data_added_string
last_data_added.strftime("%B %e, %Y")
end
+ def Series.run_all_dependencies(series_list, already_run)
+ series_list.each do |s_name|
+ next unless already_run.index(s_name).nil?
+ s = s_name.ts
+ begin
+ already_run = Series.run_all_dependencies(s.new_dependencies, already_run)
+ rescue
+ puts "THIS IS THE ONE THAT BROKE"
+ puts s.id
+ puts s.name
+ end
+ s.reload_sources
+ already_run.push(s_name)
+ end
+ return already_run
+ end
+
def Series.smart_update(series_names_finished = [], series_to_finish = Series.all, depth = 0 )
return series_to_finish if series_to_finish.count == 0 or depth == 25
series_to_finish_new = []
@@ -33,7 +33,6 @@
Chart Boards: 
<a href="/construction">Construction (M)</a> |
<a href="/construction_q">Construction (Q)</a> |
- <a href="/permits">Permits</a> |
<a href="/hbr_mbr">HBR / MBR</a> |
<a href="/prudential">Prudential</a> |
<a href="/employment">Employment (HI)</a> |
@@ -48,7 +48,7 @@ google.visualization.events.addListener(chart, 'select', function() {
<%= link_to 'Blog Chart', :action => 'blog_graph', :id => @series %>
<div id="chart_div"></div>
-
+ <div id="notes"><p><%= @series.investigation_notes %></p></div>
</div>
</div>
View
@@ -146,11 +146,11 @@
#alternatives in case of emergency
-# every 1.day, :at => "12:00 pm" do
+# every 1.day, :at => "12:05 pm" do
# rake "update_bea_links"
# end
#
-# every 1.day, :at => "12:00 pm" do
+# every 1.day, :at => "12:05 pm" do
# rake "jp_upd_a"
# rake "jp_upd_q"
# rake "jp_upd_m"
View
@@ -89,7 +89,14 @@ def Series.find_first_order_circular
#puts series.name
fod = series.first_order_dependencies
fod.each do |dependent_series|
- circular_series.push(dependent_series) unless dependent_series.ts.first_order_dependencies.index(series.name).nil?
+ begin
+ circular_series.push(dependent_series) unless dependent_series.ts.first_order_dependencies.index(series.name).nil?
+ rescue
+ puts "THIS BROKE"
+ puts dependent_series
+ puts series.name
+ puts series.id
+ end
end
end
@@ -120,10 +127,11 @@ def Series.print_multi_sources
def reload_sources
begin
- self.data_sources_by_last_run.each do |ds|
- ds.print_eval_statement
- ds.reload_source
- end
+ puts self.name
+ # self.data_sources_by_last_run.each do |ds|
+ # ds.print_eval_statement
+ # ds.reload_source
+ # end
return 0
rescue Exception
puts "SOMETHING BROKE -----------------------------------------------"
View
@@ -53,11 +53,12 @@ end
task :const_upd_q => :environment do
t = Time.now
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" }|,
"KNRSDNS@MAU.Q" => %Q|Series.load_from_download "QSER_G@hawaii.gov", { :file_type => "xls", :start_date => "1993-01-01", :sheet => "G-27", :row => "block:5:1:4", :col => "repeat:2:5", :frequency => "Q" }|,
"KNRSDNS@KAU.Q" => %Q|Series.load_from_download "QSER_G@hawaii.gov", { :file_type => "xls", :start_date => "1993-01-01", :sheet => "G-28", :row => "block:5:1:4", :col => "repeat:2:5", :frequency => "Q" }|,
- "KPGOVNS@HI.Q" => %Q|Series.load_from_download "QSER_E@hawaii.gov", { :file_type => "xls", :start_date => "1998-01-01", :sheet => "E-1", :row => "increment:38:1", :col => 7, :frequency => "Q" }|,
+ "KPGOVNS@HI.Q" => %Q|Series.load_from_download "QSER_E@hawaii.gov", { :file_type => "xls", :start_date => "1998-01-01", :sheet => "E-1", :row => "increment:39:1", :col => 7, :frequency => "Q" }|,
"KNRSDNS@HI.Q" => %Q|Series.load_from_download "QSER_E@hawaii.gov", { :file_type => "xls", :start_date => "1982-01-01", :sheet => "E-3", :row => "block:5:1:4", :col => "repeat:2:5", :frequency => "Q" }|,
"KNRSDSGFNS@HI.Q" => %Q|Series.load_from_download "QSER_E@hawaii.gov", { :file_type => "xls", :start_date => "1982-01-01", :sheet => "E-4", :row => "block:5:1:4", :col => "repeat:2:5", :frequency => "Q" }|,
"KNRSDMLTNS@HI.Q" => %Q|Series.load_from_download "QSER_E@hawaii.gov", { :file_type => "xls", :start_date => "1982-01-01", :sheet => "E-5", :row => "block:5:1:4", :col => "repeat:2:5", :frequency => "Q" }|,
@@ -378,8 +379,9 @@ task :const_identities => :environment do
"PMKBSGF@HON.Q".ts_eval= %Q|"PMKBSGF@HON.M".ts.aggregate(:quarter, :average)|
"PMKBCON@HON.Q".ts_eval= %Q|"PMKBCON@HON.M".ts.aggregate(:quarter, :average)|
- "PMKBSGF@HON.Q".ts_eval= %Q|"PMKBSGF@HON.Q".ts.trim("1980-01-01","1986-12-01")|
- "PMKBCON@HON.Q".ts_eval= %Q|"PMKBCON@HON.Q".ts.trim("1980-01-01","1986-12-01")|
+ # Not sure why these were even here. Just circular references
+ # "PMKBSGF@HON.Q".ts_eval= %Q|"PMKBSGF@HON.Q".ts.trim("1980-01-01","1986-12-01")|
+ # "PMKBCON@HON.Q".ts_eval= %Q|"PMKBCON@HON.Q".ts.trim("1980-01-01","1986-12-01")|
"PMKRCON@HON.Q".ts_eval=%Q|"PMKRCON@HON.Q".ts.load_mean_corrected_sa_from "/Volumes/UHEROwork/data/misc/prud/seasadj/prud_sa.xls", "prud_sa" |
"PMKRSGF@HON.Q".ts_eval=%Q|"PMKRSGF@HON.Q".ts.load_mean_corrected_sa_from "/Volumes/UHEROwork/data/misc/prud/seasadj/prud_sa.xls", "prud_sa" |
Oops, something went wrong.

0 comments on commit 0f86d12

Please sign in to comment.