Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to reflect updated GeoServices VHA attributes #425

Merged
merged 3 commits into from
Nov 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions app/models/vha_facility_adapter.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true
class VHAFacilityAdapter
VHA_URL = +ENV['VHA_MAPSERVER_URL']
VHA_ID_FIELD = 'StationNum'
VHA_ID_FIELD = 'StationNumber'
FACILITY_TYPE = 'va_health_facility'

def initialize
Expand Down Expand Up @@ -44,8 +44,8 @@ def service_whitelist
end

TOP_KEYMAP = {
unique_id: 'StationNum', name: 'StationNam', classification: 'CocClassif',
website: 'First_Inte', lat: 'Latitude', long: 'Longitude'
unique_id: 'StationNumber', name: 'StationName', classification: 'CocClassification',
website: 'First_InternetAddress', lat: 'Latitude', long: 'Longitude'
}.freeze

ADDR_KEYMAP = {
Expand All @@ -54,9 +54,10 @@ def service_whitelist
}.freeze

PHONE_KEYMAP = {
'main' => 'MainPhone', 'fax' => 'MainFax', 'after_hours' => 'AfterHours',
'patient_advocate' => 'PatientAdv', 'enrollment_coordinator' => 'Enrollment',
'pharmacy' => 'PharmacyPh'
'main' => 'MainPhone', 'fax' => 'MainFax', 'after_hours' => 'AfterHoursPhone',
'patient_advocate' => 'PatientAdvocatePhone',
'enrollment_coordinator' => 'EnrollmentCoordinatorPhone',
'pharmacy' => 'PharmacyPhone'
}.freeze

HOURS_KEYMAP = %w(
Expand Down Expand Up @@ -95,9 +96,10 @@ def service_whitelist
}.freeze

def self.mh_clinic_phone(attrs)
return '' if (attrs['MHClinicPh']).zero?
result = attrs['MHClinicPh'].to_s
result << ' x ' + attrs['Extension'].to_s unless (attrs['Extension']).zero?
return '' if (attrs['MHClinicPhone']).blank? || (attrs['MHClinicPhone']).zero?
result = attrs['MHClinicPhone'].to_s
result << ' x ' + attrs['Extension'].to_s unless
(attrs['Extension']).blank? || (attrs['Extension']).zero?
result
end

Expand Down
82 changes: 64 additions & 18 deletions spec/factories/vha_gis_records.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,29 @@
factory :vha_gis_record, class: Hash do
gis_attrs do
{
'FID' => 1049,
'OBJECTID' => 1736,
'FacilityDa' => '8-19-2016',
'Outpatient' => 1_472_428_800_000,
'OBJECTID' => 224,
'FacilityDataDate' => '10-31-2016',
'OutpatientServicesDataDate' => 1_477_872_000_000,
'StationID' => 538,
'VisnID' => 20,
'StationNum' => '648',
'StationNam' => 'Portland VA Medical Center',
'CommonStat' => 'Portland',
'CocClassif' => 'VA Medical Center (VAMC)',
'CocClass_1' => 'Firm',
'Building' => ' ',
'StationNumber' => '648',
'StationName' => 'Portland VA Medical Center',
'CommonStationName' => 'Portland',
'CocClassification' => 'VA Medical Center (VAMC)',
'CocClassificationAttribute' => 'Firm',
'Building' => '',
'Street' => '3710 Southwest US Veterans Hospital Road',
'Suite' => ' ',
'Suite' => nil,
'City' => 'Portland',
'State' => 'OR',
'Zip' => '97239',
'Zip4' => '2964',
'MainPhone' => '503-721-1498 x',
'MainFax' => '503-273-5319 x',
'AfterHours' => '503-220-8262 x',
'PatientAdv' => '503-273-5308 x',
'Enrollment' => '503-273-5069 x',
'PharmacyPh' => '503-273-5183 x',
'AfterHoursPhone' => '503-220-8262 x',
'PatientAdvocatePhone' => '503-273-5308 x',
'EnrollmentCoordinatorPhone' => '503-273-5069 x',
'PharmacyPhone' => '503-273-5183 x',
'Monday' => '24/7',
'Tuesday' => '24/7',
'Wednesday' => '24/7',
Expand All @@ -36,9 +35,56 @@
'Sunday' => '24/7',
'Latitude' => 45.49746145,
'Longitude' => -122.68287208,
'MHClinicPh' => 5_032_735_187,
'Extension' => 0,
'First_Inte' => 'http://www.portland.va.gov/'
'Audiology' => '',
'ComplementaryAlternativeMed' => '',
'DentalServices' => '',
'DiagnosticServices' => '',
'ImagingAndRadiology' => '',
'LabServices' => '',
'EmergencyDept' => '',
'EyeCare' => '',
'MentalHealthCare' => 'YES',
'OutpatientMHCare' => '',
'OutpatientSpecMHCare' => '',
'VocationalAssistance' => '',
'OutpatientMedicalSpecialty' => '',
'AllergyAndImmunology' => '',
'CardiologyCareServices' => '',
'DermatologyCareServices' => '',
'Diabetes' => '',
'Dialysis' => '',
'Endocrinology' => '',
'Gastroenterology' => '',
'Hematology' => '',
'InfectiousDisease' => '',
'InternalMedicine' => '',
'Nephrology' => '',
'Neurology' => '',
'Oncology' => '',
'PulmonaryRespiratoryDisease' => '',
'Rheumatology' => '',
'SleepMedicine' => '',
'OutpatientSurgicalSpecialty' => '',
'CardiacSurgery' => '',
'ColoRectalSurgery' => '',
'ENT' => '',
'GeneralSurgery' => '',
'Gynecology' => '',
'Neurosurgery' => '',
'Orthopedics' => '',
'PainManagement' => '',
'PlasticSurgery' => '',
'Podiatry' => '',
'ThoracicSurgery' => '',
'Urology' => '',
'VascularSurgery' => '',
'PrimaryCare' => 'YES',
'Rehabilitation' => '',
'UrgentCare' => '',
'WellnessAndPreventativeCare' => '',
'First_InternetAddress' => 'http://www.portland.va.gov/',
'MHClinicPhone' => 5_032_735_187,
'Extension' => nil
}
end
geometry do
Expand Down
18 changes: 16 additions & 2 deletions spec/models/vha_facility_adapter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,23 @@
expect(model.phone[:mental_health_clinic]).to eq('5032735187 x 12345')
end

it '#it handles no mh_phone' do
it '#it handles zero mh_phone' do
input = FactoryGirl.build(:vha_gis_record)
input['attributes']['MHClinicPh'] = 0
input['attributes']['MHClinicPhone'] = 0
model = described_class.from_gis(input)
expect(model.phone[:mental_health_clinic]).to eq('')
end

it '#it handles zero extension' do
input = FactoryGirl.build(:vha_gis_record)
input['attributes']['Extension'] = 0
model = described_class.from_gis(input)
expect(model.phone[:mental_health_clinic]).to eq('5032735187')
end

it '#it handles nil mh_phone' do
input = FactoryGirl.build(:vha_gis_record)
input['attributes']['MHClinicPhone'] = nil
model = described_class.from_gis(input)
expect(model.phone[:mental_health_clinic]).to eq('')
end
Expand Down
8 changes: 4 additions & 4 deletions spec/support/vcr_cassettes/facilities/va/ny_bbox.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading