Last active
September 2, 2020 00:05
-
-
Save emailrhoads/50d1d711be800e08bb7ad9010213339b to your computer and use it in GitHub Desktop.
[Export Mercury AVM results] #mercury
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| avm_r = ::Mercury::AvmResult.last(2500).map{ |r| r.slice('id', 'address_line_text', 'city_name', 'property_postal_code', 'property_state', 'result') } | |
| results = avm_r.map do |r| | |
| r.except('result') + { | |
| 'fsd' => r.dig('result','fsd'), | |
| 'valuation' => r.dig('result','valuation'), | |
| 'total_monthly_income_amount' => rand(1000..25000) # for CRAPE if you need | |
| } | |
| end | |
| CSV.open("mercury_avm_results.tsv", "w", write_headers: true, headers: results.first.keys, col_sep: "\t") do |csv| | |
| results.each do |h| | |
| csv << h.values | |
| end | |
| end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment