department-of-veterans-affairs / ruby-bgs

VA Benefits Gateway Service SOAP client
Other
9 stars 2 forks source link

Get address using participant id #32

Closed amprokop closed 7 years ago

amprokop commented 7 years ago

Hypothesis: We can use findPtcpntAddrs from AddressWebService to get the POA address using the participant id we get from from findPOAsByFileNumber.

If that service doesn't work, take a look in the documentation and find one that will!

Example of how we get participant id:

bgs.org.find_poas_by_file_number("633792224")

{:file_number=>"633792224", :power_of_attorney=>{:legacy_poa_cd=>"3QQ", :nm=>"LYNDA  WHITEHEAD-TAYLOR", :org_type_nm=>"POA Attorney", :ptcpnt_id=>"600153863"}, :ptcpnt_id=>"600085544"}

Acceptance Criteria:

amprokop commented 7 years ago

actually, i think we might need this after all!

according to the BGS team, if the POA is a person and has a participant id (as opposed to a VSO), the address should be there for that POA. wanna merge this Anya?

ghost commented 7 years ago

sample output

{:addrs_one_txt=>"2215 Zorn Avenue", :city_nm=>"Louisville", :cntry_nm=>"USA", :efctv_dt=>#<DateTime: 2013-09-17T11:09:25-05:00 ((2456553j,58165s,0n),-18000s,2299161j)>, :jrn_dt=>#<DateTime: 2015-09-14T08:46:02-05:00 ((2457280j,49562s,0n),-18000s,2299161j)>, :jrn_lctn_id=>"101", :jrn_obj_id=>"RFAC109186_backfil", :jrn_status_type_cd=>"U", :jrn_user_id=>"DA", :postal_cd=>"KY", :ptcpnt_addrs_id=>"14794780", :ptcpnt_addrs_type_nm=>"Mailing", :ptcpnt_id=>"600058954", :shared_addrs_ind=>"N", :trsury_addrs_one_txt=>"Georgiana T Conway", :trsury_addrs_three_txt=>"Louisville KY", :trsury_addrs_two_txt=>"2215 Zorn Avenue", :trsury_seq_nbr=>"1", :zip_prefix_nbr=>"40206"}                                    
{:addrs_one_txt=>"6439 Garner Ferry Rd", :city_nm=>"Columbia", :cntry_nm=>"USA", :efctv_dt=>#<DateTime: 2013-09-17T11:28:42-05:00 ((2456553j,59322s,0n),-18000s,2299161j)>, :jrn_dt=>#<DateTime: 2015-09-14T08:46:02-05:00 ((2457280j,49562s,0n),-18000s,2299161j)>, :jrn_lctn_id=>"101", :jrn_obj_id=>"RFAC109186_backfil", :jrn_status_type_cd=>"U", :jrn_user_id=>"DA", :postal_cd=>"SC", :ptcpnt_addrs_id=>"14794794", :ptcpnt_addrs_type_nm=>"Mailing", :ptcpnt_id=>"600058956", :shared_addrs_ind=>"N", :trsury_addrs_one_txt=>"Chayim H Geoffrey", :trsury_addrs_three_txt=>"Columbia SC", :trsury_addrs_two_txt=>"6439 Garner Ferry Rd", :trsury_seq_nbr=>"1", :zip_prefix_nbr=>"29209"}                                 
{:addrs_one_txt=>"12 13TH ST", :city_nm=>"THIRTEEN", :cntry_nm=>"USA", :efctv_dt=>#<DateTime: 2013-09-19T12:15:32-05:00 ((2456555j,62132s,0n),-18000s,2299161j)>, :jrn_dt=>#<DateTime: 2015-09-14T08:46:02-05:00 ((2457280j,49562s,0n),-18000s,2299161j)>, :jrn_lctn_id=>"101", :jrn_obj_id=>"RFAC109186_backfil", :jrn_status_type_cd=>"U", :jrn_user_id=>"DA", :postal_cd=>"TN", :ptcpnt_addrs_id=>"14795305", :ptcpnt_addrs_type_nm=>"Mailing", :ptcpnt_id=>"600056847", :shared_addrs_ind=>"N", :trsury_addrs_one_txt=>"Deborah G Blain", :trsury_addrs_three_txt=>"THIRTEEN TN", :trsury_addrs_two_txt=>"12 13TH ST", :trsury_seq_nbr=>"2", :zip_prefix_nbr=>"22222"}                                                       
{:addrs_one_txt=>"1999 ABC ST.", :city_nm=>"ANYTOWN", :cntry_nm=>"USA", :efctv_dt=>#<DateTime: 2013-12-17T06:46:05-06:00 ((2456644j,45965s,0n),-21600s,2299161j)>, :jrn_dt=>#<DateTime: 2013-12-17T13:58:05-06:00 ((2456644j,71885s,0n),-21600s,2299161j)>, :jrn_lctn_id=>"317", :jrn_obj_id=>"SHARE  - PCLR", :jrn_status_type_cd=>"U", :jrn_user_id=>"VBACOALBERM", :postal_cd=>"MO", :ptcpnt_addrs_id=>"14805121", :ptcpnt_addrs_type_nm=>"Mailing", :ptcpnt_id=>"600060178", :shared_addrs_ind=>"N", :trsury_addrs_one_txt=>"Nina Nendorf Diana", :trsury_addrs_three_txt=>"ANYTOWN MO", :trsury_addrs_two_txt=>"1999 ABC ST.", :trsury_seq_nbr=>"6", :zip_prefix_nbr=>"12356"}                                              
{:addrs_one_txt=>"123 Main St", :city_nm=>"Fairfax", :cntry_nm=>"USA", :efctv_dt=>#<DateTime: 2013-12-02T11:05:55-06:00 ((2456629j,61555s,0n),-21600s,2299161j)>, :jrn_dt=>#<DateTime: 2015-09-14T08:46:03-05:00 ((2457280j,49563s,0n),-18000s,2299161j)>, :jrn_lctn_id=>"101", :jrn_obj_id=>"RFAC109186_backfil", :jrn_status_type_cd=>"U", :jrn_user_id=>"DA", :postal_cd=>"VA", :ptcpnt_addrs_id=>"14803527", :ptcpnt_addrs_type_nm=>"Mailing", :ptcpnt_id=>"600060263", :shared_addrs_ind=>"N", :trsury_addrs_one_txt=>"Irvin Egly Maryanne", :trsury_addrs_three_txt=>"Fairfax VA", :trsury_addrs_two_txt=>"123 Main St", :trsury_seq_nbr=>"1", :zip_prefix_nbr=>"12345"}                                                   
{:addrs_one_txt=>"112 HOLIDAY", :city_nm=>"CHARLESTON", :cntry_nm=>"USA", :efctv_dt=>#<DateTime: 2013-12-03T07:43:44-06:00 ((2456630j,49424s,0n),-21600s,2299161j)>, :jrn_dt=>#<DateTime: 2015-09-14T08:46:03-05:00 ((2457280j,49563s,0n),-18000s,2299161j)>, :jrn_lctn_id=>"101", :jrn_obj_id=>"RFAC109186_backfil", :jrn_status_type_cd=>"U", :jrn_user_id=>"DA", :postal_cd=>"SC", :ptcpnt_addrs_id=>"14803578", :ptcpnt_addrs_type_nm=>"Mailing", :ptcpnt_id=>"600048423", :shared_addrs_ind=>"N", :trsury_addrs_one_txt=>"Kiran Looney Gene", :trsury_addrs_three_txt=>"CHARLESTON SC", :trsury_addrs_two_txt=>"112 HOLIDAY", :trsury_seq_nbr=>"3", :zip_prefix_nbr=>"22222"}                                               
{:addrs_one_txt=>"5502 ARROYO RD", :city_nm=>"WACO", :cntry_nm=>"USA", :efctv_dt=>#<DateTime: 2013-12-03T14:30:32-06:00 ((2456630j,73832s,0n),-21600s,2299161j)>, :jrn_dt=>#<DateTime: 2015-09-14T08:47:31-05:00 ((2457280j,49651s,0n),-18000s,2299161j)>, :jrn_lctn_id=>"101", :jrn_obj_id=>"RFAC109186_backfil", :jrn_status_type_cd=>"U", :jrn_user_id=>"DA", :postal_cd=>"TX", :ptcpnt_addrs_id=>"14803621", :ptcpnt_addrs_type_nm=>"Mailing", :ptcpnt_id=>"600056875", :shared_addrs_ind=>"N", :trsury_addrs_one_txt=>"a b", :trsury_addrs_three_txt=>"WACO TX", :trsury_addrs_two_txt=>"5502 ARROYO RD", :trsury_seq_nbr=>"2", :zip_prefix_nbr=>"76710"}                                                                   {:addrs_one_txt=>"9966 Sparrow Ln", :city_nm=>"Expo", :cntry_nm=>"USA", :efctv_dt=>#<DateTime: 2013-12-04T09:24:11-06:00 ((2456631j,55451s,0n),-21600s,2299161j)>, :jrn_dt=>#<DateTime: 2015-09-14T08:46:03-05:00 ((2457280j,49563s,0n),-18000s,2299161j)>, :jrn_lctn_id=>"101", :jrn_obj_id=>"RFAC109186_backfil", :jrn_status_type_cd=>"U", :jrn_user_id=>"DA", :postal_cd=>"FL", :ptcpnt_addrs_id=>"14803678", :ptcpnt_addrs_type_nm=>"Mailing", :ptcpnt_id=>"600060272", :shared_addrs_ind=>"N", :trsury_addrs_one_txt=>"Aziza Alvord Nena", :trsury_addrs_three_txt=>"Expo FL", :trsury_addrs_two_txt=>"9966 Sparrow Ln", :trsury_seq_nbr=>"1", :zip_prefix_nbr=>"23889"}                                                   {:addrs_one_txt=>"123 What Street", :city_nm=>"Charleston", :cntry_nm=>"USA", :efctv_dt=>#<DateTime: 2013-12-09T07:48:11-06:00 ((2456636j,49691s,0n),-21600s,2299161j)>, :jrn_dt=>#<DateTime: 2015-09-14T08:46:03-05:00 ((2457280j,49563s,0n),-18000s,2299161j)>, :jrn_lctn_id=>"101", :jrn_obj_id=>"RFAC109186_backfil", :jrn_status_type_cd=>"U", :jrn_user_id=>"DA", :postal_cd=>"SC", :ptcpnt_addrs_id=>"14804004", :ptcpnt_addrs_type_nm=>"Mailing", :ptcpnt_id=>"600060300", :shared_addrs_ind=>"N", :trsury_addrs_one_txt=>"Clyde E Hermine", :trsury_addrs_three_txt=>"Charleston SC", :trsury_addrs_two_txt=>"123 What Street", :trsury_seq_nbr=>"1", :zip_prefix_nbr=>"22222"}                                         
{:addrs_one_txt=>"318 HUMMINGBIRD LANE", :city_nm=>"CHARLESTON", :cntry_nm=>"USA", :efctv_dt=>#<DateTime: 2013-12-11T08:18:07-06:00 ((2456638j,51487s,0n),-21600s,2299161j)>, :jrn_dt=>#<DateTime: 2015-09-14T08:46:03-05:00 ((2457280j,49563s,0n),-18000s,2299161j)>, :jrn_lctn_id=>"101", :jrn_obj_id=>"RFAC109186_backfil", :jrn_status_type_cd=>"U", :jrn_user_id=>"DA", :postal_cd=>"SC", :ptcpnt_addrs_id=>"14804223", :ptcpnt_addrs_type_nm=>"Mailing", :ptcpnt_id=>"600060020", :shared_addrs_ind=>"N", :trsury_addrs_one_txt=>"Irv Carrington Malia", :trsury_addrs_three_txt=>"CHARLESTON SC", :trsury_addrs_two_txt=>"318 HUMMINGBIRD LANE", :trsury_seq_nbr=>"2", :zip_prefix_nbr=>"22220"}                          
{:addrs_one_txt=>"10500 DEVONSHIRE RD", :addrs_two_txt=>"APT 318", :city_nm=>"BLOOMINGTON", :cntry_nm=>"USA", :efctv_dt=>#<DateTime: 2013-12-11T11:17:03-06:00 ((2456638j,62223s,0n),-21600s,2299161j)>, :jrn_dt=>#<DateTime: 2015-09-14T08:46:03-05:00 ((2457280j,49563s,0n),-18000s,2299161j)>, :jrn_lctn_id=>"101", :jrn_obj_id=>"RFAC109186_backfil", :jrn_status_type_cd=>"U", :jrn_user_id=>"DA", :postal_cd=>"MN", :ptcpnt_addrs_id=>"14804298", :ptcpnt_addrs_type_nm=>"Mailing", :ptcpnt_id=>"600060013", :shared_addrs_ind=>"N", :trsury_addrs_four_txt=>"BLOOMINGTON MN", :trsury_addrs_one_txt=>"Johnny Kramer Dawn", :trsury_addrs_three_txt=>"APT 318", :trsury_addrs_two_txt=>"10500 DEVONSHIRE RD", :trsury_seq_nbr=>"2", :zip_prefix_nbr=>"55123"}                                                                                                                                                                                                         {:addrs_one_txt=>"321 First ST", :city_nm=>"Lincoln", :cntry_nm=>"USA", :efctv_dt=>#<DateTime: 2013-12-20T09:11:49-06:00 ((2456647j,54709s,0n),-21600s,2299161j)>, :jrn_dt=>#<DateTime: 2015-09-14T08:46:03-05:00 ((2457280j,49563s,0n),-18000s,2299161j)>, :jrn_lctn_id=>"101", :jrn_obj_id=>"RFAC109186_backfil", :jrn_status_type_cd=>"U", :jrn_user_id=>"DA", :postal_cd=>"NE", :ptcpnt_addrs_id=>"14805532", :ptcpnt_addrs_type_nm=>"Mailing", :ptcpnt_id=>"600017627", :shared_addrs_ind=>"N", :trsury_addrs_one_txt=>"Matt Dillon", :trsury_addrs_three_txt=>"Lincoln NE", :trsury_addrs_two_txt=>"321 First ST", :trsury_seq_nbr=>"2", :zip_prefix_nbr=>"68510"}                                                         {:addrs_one_txt=>"3434", :city_nm=>"5tery", :cntry_nm=>"USA", :efctv_dt=>#<DateTime: 2012-09-24T14:49:20-05:00 ((2456195j,71360s,0n),-18000s,2299161j)>, :jrn_dt=>#<DateTime: 2015-09-14T08:45:54-05:00 ((2457280j,49554s,0n),-18000s,2299161j)>, :jrn_lctn_id=>"101", :jrn_obj_id=>"RFAC109186_backfil", :jrn_status_type_cd=>"U", :jrn_user_id=>"DA", :postal_cd=>"VA", :ptcpnt_addrs_id=>"14765391", :ptcpnt_addrs_type_nm=>"Mailing", :ptcpnt_id=>"600043494", :shared_addrs_ind=>"N", :trsury_addrs_one_txt=>"Raul Jeffrey Edgar", :trsury_addrs_three_txt=>"5tery VA", :trsury_addrs_two_txt=>"3434", :trsury_seq_nbr=>"1", :zip_prefix_nbr=>"34234"}                                                                      {:addrs_one_txt=>"45 SEMINARY LANE", :city_nm=>"FALLS CHURCH", :cntry_nm=>"USA", :efctv_dt=>#<DateTime: 2013-12-27T07:48:20-06:00 ((2456654j,49700s,0n),-21600s,2299161j)>, :jrn_dt=>#<DateTime: 2015-09-14T08:46:04-05:00 ((2457280j,49564s,0n),-18000s,2299161j)>, :jrn_lctn_id=>"101", :jrn_obj_id=>"RFAC109186_backfil", :jrn_status_type_cd=>"U", :jrn_user_id=>"DA", :postal_cd=>"VA", :ptcpnt_addrs_id=>"14806308", :ptcpnt_addrs_type_nm=>"Mailing", :ptcpnt_id=>"600043853", :shared_addrs_ind=>"N", :trsury_addrs_one_txt=>"Georgiana T Conway", :trsury_addrs_three_txt=>"FALLS CHURCH VA", :trsury_addrs_two_txt=>"45 SEMINARY LANE", :trsury_seq_nbr=>"3", :zip_prefix_nbr=>"20993"}                                
{:addrs_one_txt=>"1800 G STREET NE", :city_nm=>"WASHINGTON", :cntry_nm=>"USA", :efctv_dt=>#<DateTime: 2013-12-31T12:48:12-06:00 ((2456658j,67692s,0n),-21600s,2299161j)>, :jrn_dt=>#<DateTime: 2015-09-14T08:46:04-05:00 ((2457280j,49564s,0n),-18000s,2299161j)>, :jrn_lctn_id=>"101", :jrn_obj_id=>"RFAC109186_backfil", :jrn_status_type_cd=>"U", :jrn_user_id=>"DA", :postal_cd=>"DC", :ptcpnt_addrs_id=>"14806807", :ptcpnt_addrs_type_nm=>"Mailing", :ptcpnt_id=>"600042126", :shared_addrs_ind=>"N", :trsury_addrs_one_txt=>"LILLY L ARDEN", :trsury_addrs_three_txt=>"WASHINGTON DC", :trsury_addrs_two_txt=>"1800 G STREET NE", :trsury_seq_nbr=>"2", :zip_first_suffix_nbr=>"2092", :zip_prefix_nbr=>"20920"}          
{:addrs_one_txt=>"124 Main Street", :city_nm=>"Arlington", :cntry_nm=>"USA", :efctv_dt=>#<DateTime: 2014-01-16T09:05:22-06:00 ((2456674j,54322s,0n),-21600s,2299161j)>, :jrn_dt=>#<DateTime: 2015-09-14T08:46:04-05:00 ((2457280j,49564s,0n),-18000s,2299161j)>, :jrn_lctn_id=>"101", :jrn_obj_id=>"RFAC109186_backfil", :jrn_status_type_cd=>"U", :jrn_user_id=>"DA", :postal_cd=>"VA", :ptcpnt_addrs_id=>"14808954", :ptcpnt_addrs_type_nm=>"Mailing", :ptcpnt_id=>"600062339", :shared_addrs_ind=>"N", :trsury_addrs_one_txt=>"Johnny Kramer Dawn", :trsury_addrs_three_txt=>"Arlington VA", :trsury_addrs_two_txt=>"124 Main Street", :trsury_seq_nbr=>"1", :zip_prefix_nbr=>"22206"}

but....

where are you handling not found errors?:

pry(main)> address = bgs.address.find_by_participant_id("12925992")
Savon::SOAPFault: (S:Server) AddressWebService-->findPtcpntAddrs-->findPersonByPtcpntId-->No Person found for ptcpnt_id 12925992
from /Users/vhaisavovka/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/savon-2.11.1/lib/savon/response.rb:85:in `raise_soap_and_http_errors!'
ghost commented 7 years ago

Apparently the POA's ptcpnt_id is not a usable value

  1. Went to prod console
  2. Grabbed last 50 appeals
  3. Extracted their vbms_id and stripped S/C made into filenums array
  4. Spun up bgs service
  5. Ran the following loop:
    filenums.map do |file|
    poas = bgs.org.find_poas_by_file_number(file)
    puts "#{poas}"
    @participants << poas[:ptcpnt_id]
    begin
    address = bgs.address.find_by_participant_id(poas[:power_of_attorney][:ptcpnt_id])
    puts "\t\tIT WORKED #{address}"
    @addresses << address
    @workingFiles << file
    rescue Exception => e
    puts "SO MUCH CRAP ADDRES FROM #{file}"
    puts "error #{e}"
    end
    end

Every call to bgs.address returned AddressWebService-->findPtcpntAddrs-->findPersonByPtcpntId-->No Person found for ptcpnt_id ***** in the logger

This is prod

whereas looping through @participants returns normal addresses

but that address ends up being for the vet not his poa