Class: OpenTaxSolver

Overview

OpenTableExplorer

Defined Under Namespace

Modules: Assertions, Constants, Examples

Constant Summary

Constants included from Examples

Examples::Short_acquisition, Examples::Simple_acquisition

Constants included from Constants

Constants::All, Constants::Data_source_directory, Constants::Delimiter, Constants::Description_pattern, Constants::Description_regexp, Constants::Full_regexp, Constants::Full_regexp_array, Constants::OTS_template_filename, Constants::Open_Tax_Filler_Directory, Constants::Specific_types, Constants::Symbol_pattern, Constants::Symbol_regexp, Constants::Type_pattern, Constants::Type_regexp

Constants included from OpenTableExplorer::Finance::Constants

OpenTableExplorer::Finance::Constants::Command, OpenTableExplorer::Finance::Constants::Data_source_directory, OpenTableExplorer::Finance::Constants::Default_tax_year, OpenTableExplorer::Finance::Constants::OTS_template_filename, OpenTableExplorer::Finance::Constants::Open_Tax_Filler_Directory, OpenTableExplorer::Finance::Constants::Open_tax_solver_binary, OpenTableExplorer::Finance::Constants::Open_tax_solver_data_directory, OpenTableExplorer::Finance::Constants::Open_tax_solver_directory, OpenTableExplorer::Finance::Constants::Open_tax_solver_input, OpenTableExplorer::Finance::Constants::Open_tax_solver_sysout

Constants included from ColumnGroup::ClassMethods

ColumnGroup::ClassMethods::History_columns

Constants included from GenericGrep::ClassMethods

GenericGrep::ClassMethods::ASSOCIATION_MACRO_LETTERS, GenericGrep::ClassMethods::ASSOCIATION_MACRO_PATTERN

Constants included from NoDB

NoDB::DEFAULT_TYPE

Constants included from GenericTableAssociation::Examples

GenericTableAssociation::Examples::First_stream_method

Instance Attribute Summary

Attributes included from NoDB

#attributes

Class Method Summary collapse

Methods included from Assertions::ClassMethods

assert_full_match, assert_post_conditions, assert_pre_conditions

Methods included from GenericFiles::Assertions::ClassMethods

assert_post_conditions, assert_pre_conditions

Methods included from GenericFiles::ClassMethods

all_initialize, dump_sql_to_file, raw_acquisitions, table_name?

Methods included from NoDB::ClassMethods

#column_symbols, #data_source_yaml, #default_names, #dump, #get_field_names, #insert_sql, #table_class, #table_name

Methods included from Generic_Table::ClassMethods

#is_active_record_method?, #model_file_name, #nesting, #one_pass_statistics, #sample, #sample_burst

Methods included from ColumnGroup::ClassMethods

#attribute_ddl, #attribute_rails_type, #attribute_ruby_type, #candidate_logical_keys_from_indexes, #categorical?, #column_symbols, #default_logical_primary_key, #defaulted_primary_logical_key?, #history_type?, #is_logical_primary_key?, #logical_attributes, #logical_primary_key, #logical_primary_key_recursive, #numerical?, #probably_categorical?, #probably_numerical?, #sequential_id?

Methods included from GenericGrep::ClassMethods

#all_associations, #association_grep, #association_grep_pattern, #association_macro_type, #association_type, #belongs_to_association?, #grep_all_associations_command, #grep_command, #has_many_association?, #has_one_association?, #model_grep, #model_grep_command

Methods included from GenericTableHtml::ClassMethods

#column_order, #header_html, #table_html

Methods included from Assertions

#assert_pre_conditions

Methods included from GenericFiles::Assertions

#assert_post_conditions, #assert_pre_conditions

Methods included from NoDB

#[], #[]=, #clone, #each_pair, #has_key?, #initialize, #insert_sql, #keys, #table_class, #table_name

Methods included from Generic_Table

activeRecordTableNotCreatedYet?, classDefiniton, classReference, class_of_name, eval_constant, is_ActiveRecord_table?, is_generic_table?, is_generic_table_name?, is_table?, rails_MVC_class?, rubyClassName, table_exists?

Methods included from GenericTableAssociation

#associated_foreign_key_records, #associated_to_s, #association_class, #association_has_data, #association_state, #foreign_key_points_to_me?, #foreign_key_to_association, #foreign_key_value, #logical_primary_key_recursive_value, #logical_primary_key_value, #name_to_association

Methods included from GenericTableAssociation::Assertions::ClassMethods

#assert_foreign_keys_not_nil, #assert_invariant, #assert_post_conditions, #assert_pre_conditions

Methods included from GenericTableAssociation::Assertions

#assert_associated_foreign_key, #assert_associated_foreign_key_name, #assert_association, #assert_association_methods, #assert_association_to_many, #assert_association_to_one, #assert_foreign_key_association_names, #assert_foreign_key_name, #assert_foreign_key_not_nil, #assert_foreign_keys_not_nil, #assert_invariant, #assert_post_conditions, #assert_pre_conditions

Methods included from GenericTableHtml

#column_html, #rails_route, #row_html

Class Method Details

.allObject

coarse_rejections


155
156
157
# File 'app/models/open_tax_solver.rb', line 155

def self.all
	All
end

.coarse_filterObject

input_file_names


133
134
135
136
137
138
139
140
141
142
143
# File 'app/models/open_tax_solver.rb', line 133

def self.coarse_filter
	raw_acquisitions.map do |acquisition|
		matches=acquisition.lines.map do |line|
			if Type_regexp.match(line) && Description_regexp.match(line) then
				line
			else
				nil
			end #if
		end #each_line
	end.flatten.compact #select
end

.coarse_rejectionsObject

coarse_filter


144
145
146
147
148
149
150
151
152
153
154
# File 'app/models/open_tax_solver.rb', line 144

def self.coarse_rejections
	raw_acquisitions.map do |acquisition|
		matches=acquisition.lines.map do |line|
			if Type_regexp.match(line) && Description_regexp.match(line) then
				nil
			else
				line
			end #if
		end #each_line
	end.flatten.compact #select
end

.fine_rejectionsObject

all


158
159
160
161
162
# File 'app/models/open_tax_solver.rb', line 158

def self.fine_rejections
	coarse_filter.select do |r| #map
		!Full_regexp.match(r)
	end #select
end

.input_file_namesObject

parse


130
131
132
# File 'app/models/open_tax_solver.rb', line 130

def self.input_file_names
	"#{Open_tax_solver_data_directory}/US_1040_template.txt"
end

.parseObject

input_file_names


112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'app/models/open_tax_solver.rb', line 112

def self.parse
	sequence_number=0
	raw_acquisitions.map do |acquisition|
	lines=acquisition.lines.map do |line|
		regexp=Regexp.new(Full_regexp_array.join)
		matchData=regexp.match(line)
		if matchData then
			name=matchData[1]
			type_chars=(matchData[4] || matchData[6] || matchData[8] || matchData[2]).strip # 
			description=matchData[-1].strip
		end #if
		tax_year=2012
		hash={:name => name, :type_chars => type_chars, :description => description, :tax_year => tax_year}
		sequence_number=sequence_number+1
		hash=hash.merge({:id => sequence_number})
	end.compact #each_line
	end.flatten #each_acquisition
end