@ -85,6 +85,12 @@ module Imports
( 2 .. 8 ) . each do | index |
( 2 .. 8 ) . each do | index |
attributes [ " relat #{ index } " ] = relat ( xml_doc , index )
attributes [ " relat #{ index } " ] = relat ( xml_doc , index )
attributes [ " details_known_ #{ index } " ] = details_known ( index , attributes )
attributes [ " details_known_ #{ index } " ] = details_known ( index , attributes )
# Trips validation
if attributes [ " age #{ index } " ] . present? && attributes [ " age #{ index } " ] < 16 && attributes [ " relat #{ index } " ] . present? && attributes [ " relat #{ index } " ] != " C " && attributes [ " relat #{ index } " ] != " R "
attributes [ " age #{ index } " ] = nil
attributes [ " relat #{ index } " ] = nil
end
end
end
attributes [ " ethnic " ] = unsafe_string_as_integer ( xml_doc , " P1Eth " )
attributes [ " ethnic " ] = unsafe_string_as_integer ( xml_doc , " P1Eth " )
attributes [ " ethnic_group " ] = ethnic_group ( attributes [ " ethnic " ] )
attributes [ " ethnic_group " ] = ethnic_group ( attributes [ " ethnic " ] )
@ -137,6 +143,12 @@ module Imports
attributes [ " rp_hardship " ] = unsafe_string_as_integer ( xml_doc , " Q14b4 " ) . present? ? 1 : nil
attributes [ " rp_hardship " ] = unsafe_string_as_integer ( xml_doc , " Q14b4 " ) . present? ? 1 : nil
attributes [ " rp_dontknow " ] = unsafe_string_as_integer ( xml_doc , " Q14b5 " ) . present? ? 1 : nil
attributes [ " rp_dontknow " ] = unsafe_string_as_integer ( xml_doc , " Q14b5 " ) . present? ? 1 : nil
# Trips validation
if attributes [ " homeless " ] == 1 && attributes [ " rp_homeless " ] == 1
attributes [ " homeless " ] = nil
attributes [ " rp_homeless " ] = nil
end
attributes [ " cbl " ] = allocation_system ( unsafe_string_as_integer ( xml_doc , " Q15CBL " ) )
attributes [ " cbl " ] = allocation_system ( unsafe_string_as_integer ( xml_doc , " Q15CBL " ) )
attributes [ " chr " ] = allocation_system ( unsafe_string_as_integer ( xml_doc , " Q15CHR " ) )
attributes [ " chr " ] = allocation_system ( unsafe_string_as_integer ( xml_doc , " Q15CHR " ) )
attributes [ " cap " ] = allocation_system ( unsafe_string_as_integer ( xml_doc , " Q15CAP " ) )
attributes [ " cap " ] = allocation_system ( unsafe_string_as_integer ( xml_doc , " Q15CAP " ) )