From 352193837c0e7e88ae846869fd36ec6c7e3a24c0 Mon Sep 17 00:00:00 2001 From: Tonksthebear Date: Tue, 3 Sep 2024 15:11:36 -0700 Subject: [PATCH 1/5] Remove logic from adapter because appointments service now performs the same logic --- .../mobile/v0/adapters/vaos_v2_appointment.rb | 75 +- .../appointments_vaos_v2_adapter_spec.rb | 79 - .../mobile/v0/appointments/vaos_v2_spec.rb | 4 + .../fixtures/VAOS_v2_appointments.json | 1371 +++++++++-------- .../VAOS_v2/get_appointment_200.yml | 3 + 5 files changed, 724 insertions(+), 808 deletions(-) diff --git a/modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb b/modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb index 4543a237799..761c2d77aea 100644 --- a/modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb +++ b/modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb @@ -91,7 +91,7 @@ def build_appointment_model appointment_type:, appointment_ien: appointment[:ien], cancel_id:, - comment:, + comment: appointment[:patient_comments], facility_id:, sta6aid: facility_id, healthcare_provider:, @@ -106,7 +106,7 @@ def build_appointment_model status_detail: cancellation_reason(appointment[:cancelation_reason]), time_zone: timezone, vetext_id:, - reason:, + reason: appointment[:reason_for_appointment], is_covid_vaccine: appointment[:service_type] == COVID_SERVICE, is_pending: appointment_request?, proposed_times:, @@ -122,6 +122,7 @@ def build_appointment_model Mobile::V0::Appointment.new(adapted_appointment) end + # rubocop:enable Metrics/MethodLength private @@ -159,11 +160,7 @@ def friendly_location_name end def patient_phone_number - phone_number = if reason_code_contains_embedded_data? - embedded_data[:phone] - else - contact(appointment.dig(:contact, :telecom), CONTACT_TYPE[:phone]) - end + phone_number = contact(appointment.dig(:contact, :telecom), CONTACT_TYPE[:phone]) return nil unless phone_number @@ -237,14 +234,12 @@ def proposed_times return nil if requested_periods.nil? requested_periods.map do |period| - date, time = if reason_code_contains_embedded_data? - period.split(' ') - else - start_date = time_to_datetime(period[:start]) - date = start_date.strftime('%m/%d/%Y') - time = start_date.hour.zero? ? 'AM' : 'PM' - [date, time] - end + date, time = begin + start_date = time_to_datetime(period[:start]) + date = start_date.strftime('%m/%d/%Y') + time = start_date.hour.zero? ? 'AM' : 'PM' + [date, time] + end { date:, @@ -258,14 +253,7 @@ def status end def requested_periods - @requested_periods ||= begin - if reason_code_contains_embedded_data? - date_string = embedded_data[:preferred_dates] - return date_string&.split(',') - end - - appointment[:requested_periods] - end + @requested_periods ||= appointment[:requested_periods] end def start_date_utc @@ -449,51 +437,10 @@ def va_appointment? APPOINTMENT_TYPES[:va_video_connect_onsite]].include?(appointment_type) end - def comment - return embedded_data[:comment] if reason_code_contains_embedded_data? - - appointment[:comment] || appointment.dig(:reason_code, :text) - end - - def reason - return REASONS[embedded_data[:reason_code]] if reason_code_contains_embedded_data? - - appointment.dig(:reason_code, :coding, 0, :code) - end - def patient_email - return embedded_data[:email] if reason_code_contains_embedded_data? - contact(appointment.dig(:contact, :telecom), CONTACT_TYPE[:email]) end - # the upstream server that hosts VA appointment requests (acheron) does not support some fields - # so the front end puts all of that data into a comment, which is returned from upstream - # as reason_code text. We must parse out some parts of that data. If any of those values is - # present, we assume it's an acheron appointment and use only acheron values for relevant attributes. - def reason_code_contains_embedded_data? - @reason_code_contains_embedded_data ||= embedded_data.values.any? - end - - def embedded_data - @embedded_data ||= { - phone: embedded_data_match('phone number'), - email: embedded_data_match('email'), - preferred_dates: embedded_data_match('preferred dates'), - reason_code: embedded_data_match('reason code'), - comment: embedded_data_match('comments') - } - end - - def embedded_data_match(key) - camelized_key = key.gsub(' ', '_').camelize(:lower) - match = reason_code_match(key) || reason_code_match(camelized_key) - - return nil unless match - - match[2].strip.presence - end - def reason_code_match(key) appointment.dig(:reason_code, :text)&.match(/(^|\|)#{key}:?(.*?)(\||$)/) end diff --git a/modules/mobile/spec/models/adapters/appointments_vaos_v2_adapter_spec.rb b/modules/mobile/spec/models/adapters/appointments_vaos_v2_adapter_spec.rb index 8bd41166fb8..906f28c425a 100644 --- a/modules/mobile/spec/models/adapters/appointments_vaos_v2_adapter_spec.rb +++ b/modules/mobile/spec/models/adapters/appointments_vaos_v2_adapter_spec.rb @@ -859,85 +859,6 @@ def parse_appointment(appt) } ) end - - it 'handles empty fields safely' do - appointment = appointment_data[12] - appointment[:reason_code][:text] = 'phone number:|email:hello|preferred dates:|reason code:|comments:' - result = subject.parse([appointment]).first - # at least one of these has to be set to be inferred to be an acheron appointment - expect(result.patient_email).to eq('hello') - expect(result.patient_phone_number).to be_nil - expect(result.proposed_times).to be_nil - expect(result.comment).to be_nil - expect(result.reason).to be_nil - end - - it 'handles fields at the beginning and end of the reason code text' do - appointment = appointment_data[12] - appointment[:reason_code][:text] = 'email:person@example.com|comments:at the end' - result = subject.parse([appointment]).first - - expect(result.patient_email).to eq('person@example.com') - expect(result.comment).to eq('at the end') - end - - it 'handles order changes and extra fields' do - appointment = appointment_data[12] - appointment[:reason_code][:text] = "fax number: 8675309|comments:look i'm not at the end for once|\ -reason code:OTHER_REASON|work email:worker@example.com|email:person@example.com|phone number:1112223333|\ -preferred dates:12/13/2022 PM|pager number:8675309" - result = subject.parse([appointment]).first - - expect(result.patient_email).to eq('person@example.com') - expect(result.patient_phone_number).to eq('111-222-3333') - expect(result.proposed_times).to eq([{ date: '12/13/2022', time: 'PM' }]) - expect(result.comment).to eq("look i'm not at the end for once") - expect(result.reason).to eq('My reason isn’t listed') - end - - it 'disambiguates similarly named fields' do - appointment = appointment_data[12] - appointment[:reason_code][:text] = "work email:worker@example.com|spouse email:honey@example.com\ -|email:person@example.com" - result = subject.parse([appointment]).first - - expect(result.patient_email).to eq('person@example.com') - end - - context 'when non-acheron values and any acheron values are present' do - it 'uses only acheron values' do - appointment = appointment_data[12] - appointment[:reason_code][:coding] = [{ code: 'will not be used' }] - appointment[:contact] = { telecom: { email: 'will not be used', phone: '1112223333' } } - appointment[:comment] = 'will not be used' - # setting preferred dates to indicate that this is acheron - appointment[:reason_code][:text] = 'phone number:|email:|preferred dates:12/13/2022 AM|reason code:|comments:' - result = subject.parse([appointment]).first - - expect(result.patient_email).to be_nil - expect(result.patient_phone_number).to be_nil - expect(result.proposed_times).to eq([{ date: '12/13/2022', time: 'AM' }]) - expect(result.comment).to be_nil - expect(result.reason).to be_nil - end - end - - context 'when some acheron field keys are camel case' do - it 'parses both camel case and non camel case fields' do - appointment = appointment_data[12] - appointment[:reason_code][:coding] = [{ code: 'will not be used' }] - appointment[:contact] = { telecom: { email: 'will not be used', phone: '1112223333' } } - appointment[:comment] = 'will not be used' - appointment[:reason_code][:text] = - 'email:melissa.gra@va.gov|preferred dates:12/13/2022 AM|reasonCode:ROUTINEVISIT|comments:My leg!' - - result = subject.parse([appointment]).first - expect(result.patient_email).to eq('melissa.gra@va.gov') - expect(result.proposed_times).to eq([{ date: '12/13/2022', time: 'AM' }]) - expect(result.comment).to eq('My leg!') - expect(result.reason).to eq('Routine Follow-up') - end - end end describe 'healthcare provider' do diff --git a/modules/mobile/spec/requests/mobile/v0/appointments/vaos_v2_spec.rb b/modules/mobile/spec/requests/mobile/v0/appointments/vaos_v2_spec.rb index 66974eb0951..7c7b4011c13 100644 --- a/modules/mobile/spec/requests/mobile/v0/appointments/vaos_v2_spec.rb +++ b/modules/mobile/spec/requests/mobile/v0/appointments/vaos_v2_spec.rb @@ -77,6 +77,8 @@ expect(response).to have_http_status(:ok) location = response.parsed_body.dig('data', 0, 'attributes', 'location') physical_location = response.parsed_body.dig('data', 0, 'attributes', 'physicalLocation') + comments = response.parsed_body.dig('data', 0, 'attributes', 'comment') + reason = response.parsed_body.dig('data', 0, 'attributes', 'reason') expect(response.body).to match_json_schema('VAOS_v2_appointments') expect(location).to eq({ 'id' => '983', 'name' => 'Cheyenne VA Medical Center', @@ -93,6 +95,8 @@ 'url' => nil, 'code' => nil }) expect(physical_location).to eq('MTZ OPC, LAB') + expect(comments).to eq('My leg!') + expect(reason).to eq('Routine/Follow-up') expect(response.parsed_body['meta']).to eq({ 'pagination' => { 'currentPage' => 1, 'perPage' => 10, diff --git a/modules/mobile/spec/support/fixtures/VAOS_v2_appointments.json b/modules/mobile/spec/support/fixtures/VAOS_v2_appointments.json index 9bd9e844361..fc16e037351 100644 --- a/modules/mobile/spec/support/fixtures/VAOS_v2_appointments.json +++ b/modules/mobile/spec/support/fixtures/VAOS_v2_appointments.json @@ -1,96 +1,94 @@ [ { - "id":"121133", - "identifier":[ - { - "system":"http://med.va.gov/fhir/urn/vaos/vista/983/appointment/id", - "value":"999;20220827.094500" - } - ], - "kind":"clinic", - "status":"cancelled", - "service_type":"optometry", - "patient_icn":"1012846043V576341", - "location_id":"983", - "clinic":"999", - "minutes_duration":30, - "comment":"This is a free form comment", - "start":"2022-08-27T15:45:00Z", - "cancelation_reason":{ - "coding":[ + "id": "121133", + "identifier": [ + { + "system": "http://med.va.gov/fhir/urn/vaos/vista/983/appointment/id", + "value": "999;20220827.094500" + } + ], + "kind": "clinic", + "status": "cancelled", + "service_type": "optometry", + "patient_icn": "1012846043V576341", + "location_id": "983", + "clinic": "999", + "minutes_duration": 30, + "patient_comments": "This is a free form comment", + "start": "2022-08-27T15:45:00Z", + "cancelation_reason": { + "coding": [ { - "system":"http://terminology.hl7.org/CodeSystem/appointment-cancellation-reason", - "code":"pat", - "display":"The appointment was cancelled by the patient" + "system": "http://terminology.hl7.org/CodeSystem/appointment-cancellation-reason", + "code": "pat", + "display": "The appointment was cancelled by the patient" } ] }, - "cancellable":false, - "extension":{ - "cc_location":{ - "address":{ - + "cancellable": false, + "extension": { + "cc_location": { + "address": { } }, - "vista_status":[ + "vista_status": [ "CANCELLED BY PATIENT", "FUTURE" ] }, - "service_name":"Friendly Name Optometry", - "location":{ - "id":"442", - "name":"Cheyenne VA Medical Center", - "time_zone" : { - "time_zone_id" : "America/Denver" + "service_name": "Friendly Name Optometry", + "location": { + "id": "442", + "name": "Cheyenne VA Medical Center", + "time_zone": { + "time_zone_id": "America/Denver" }, - "physical_address":{ - "type":"physical", - "line":[ + "physical_address": { + "type": "physical", + "line": [ "2360 East Pershing Boulevard" ], - "city":"Cheyenne", - "state":"WY", - "postal_code":"82001-5356" + "city": "Cheyenne", + "state": "WY", + "postal_code": "82001-5356" }, - "lat":41.148026, - "long":-104.786255, - "phone":{ - "main":"307-778-7550" + "lat": 41.148026, + "long": -104.786255, + "phone": { + "main": "307-778-7550" }, - "url":null, - "code":null + "url": null, + "code": null } }, { - "id":"121134", - "identifier":[ - { - "system":"http://med.va.gov/fhir/urn/vaos/vista/983/appointment/id", - "value":"408;20180307.080000" - } - ], - "kind":"clinic", - "status":"booked", - "service_type":"optometry", - "patient_icn":"1012853802V084487", - "location_id":"442", - "clinic":"408", - "start":"2018-03-07T07:00:00Z", - "end":"2018-03-07T15:30:00Z", - "minutes_duration":30, - "slot":{ - "id":"3230313830333037313530303A323031383033303731353330", - "start":"2018-03-07T07:00:00Z", - "end":"2018-03-07T15:30:00Z" - }, - "extension":{ - "cc_location":{ - "address":{ - + "id": "121134", + "identifier": [ + { + "system": "http://med.va.gov/fhir/urn/vaos/vista/983/appointment/id", + "value": "408;20180307.080000" + } + ], + "kind": "clinic", + "status": "booked", + "service_type": "optometry", + "patient_icn": "1012853802V084487", + "location_id": "442", + "clinic": "408", + "start": "2018-03-07T07:00:00Z", + "end": "2018-03-07T15:30:00Z", + "minutes_duration": 30, + "slot": { + "id": "3230313830333037313530303A323031383033303731353330", + "start": "2018-03-07T07:00:00Z", + "end": "2018-03-07T15:30:00Z" + }, + "extension": { + "cc_location": { + "address": { } }, - "vista_status":[ + "vista_status": [ "CHECKED OUT", "ACT REQ/CHECKED OUT", "NO ACTION TAKEN", @@ -104,863 +102,906 @@ "FUTURE" ] }, - "service_name":"Friendly Name Optometry", - "location":{ - "id":"442", - "name":"Cheyenne VA Medical Center", - "time_zone" : { - "time_zone_id" : "America/Denver" + "service_name": "Friendly Name Optometry", + "location": { + "id": "442", + "name": "Cheyenne VA Medical Center", + "time_zone": { + "time_zone_id": "America/Denver" }, - "physical_address":{ - "type":"physical", - "line":[ + "physical_address": { + "type": "physical", + "line": [ "2360 East Pershing Boulevard" ], - "city":"Cheyenne", - "state":"WY", - "postal_code":"82001-5356" + "city": "Cheyenne", + "state": "WY", + "postal_code": "82001-5356" }, - "lat":41.148026, - "long":-104.786255, - "phone":{ - "main":"307-778-7550" + "lat": 41.148026, + "long": -104.786255, + "phone": { + "main": "307-778-7550" }, - "url":null, - "code":null + "url": null, + "code": null } }, { - "id":"72106", - "identifier":[ + "id": "72106", + "identifier": [ { - "system":"http://med.va.gov/fhir/urn/vaos/hsrm/id", - "value":"256471||180||1" + "system": "http://med.va.gov/fhir/urn/vaos/hsrm/id", + "value": "256471||180||1" } ], - "kind":"cc", - "status":"booked", - "service_type":"primaryCare", - "patient_Icn":"1012846043V576341", - "location_id":"984", - "start":"2022-01-11T15:00:00Z", - "created":"2022-01-10T22:02:08Z", + "kind": "cc", + "status": "booked", + "service_type": "primaryCare", + "patient_Icn": "1012846043V576341", + "location_id": "984", + "start": "2022-01-11T15:00:00Z", + "created": "2022-01-10T22:02:08Z", "minutes_duration": 60, - "cancellation_reason":{ - "code":"other" - }, - "cancellable":true, - "extension":{ - "cc_location":{ - "practice_name":"CC practice name", - "address":{ - "line":[ + "cancellation_reason": { + "code": "other" + }, + "cancellable": true, + "extension": { + "cc_location": { + "practice_name": "CC practice name", + "address": { + "line": [ "1601 Needmore Rd Ste 1" ], - "city":"Dayton", - "state":"OH", - "postal_code":"45414", - "text":"1601\nNeedmore Rd Ste 1\nDayton OH 45414" + "city": "Dayton", + "state": "OH", + "postal_code": "45414", + "text": "1601\nNeedmore Rd Ste 1\nDayton OH 45414" }, - "telecom":[ + "telecom": [ { - "system":"phone", - "value":"3214170822" + "system": "phone", + "value": "3214170822" } ] } }, - "location":{ - "id":"442", - "name":"Cheyenne VA Medical Center", - "time_zone" : { - "time_zone_id" : "America/Denver" + "location": { + "id": "442", + "name": "Cheyenne VA Medical Center", + "time_zone": { + "time_zone_id": "America/Denver" }, - "physical_address":{ - "type":"physical", - "line":[ + "physical_address": { + "type": "physical", + "line": [ "2360 East Pershing Boulevard" ], - "city":"Cheyenne", - "state":"WY", - "postal_code":"82001-5356" + "city": "Cheyenne", + "state": "WY", + "postal_code": "82001-5356" }, - "lat":41.148026, - "long":-104.786255, - "phone":{ - "main":"307-778-7550" + "lat": 41.148026, + "long": -104.786255, + "phone": { + "main": "307-778-7550" }, - "url":null, - "code":null + "url": null, + "code": null } }, { - "id":"72105", - "identifier":[ + "id": "72105", + "identifier": [ { - "system":"http://med.va.gov/fhir/urn/vaos/hsrm/id", - "value":"11812" + "system": "http://med.va.gov/fhir/urn/vaos/hsrm/id", + "value": "11812" } ], - "kind":"cc", - "status":"proposed", - "service_type":"primaryCare", - "patient_icn":"1012846043V576341", - "location_id":"984", + "kind": "cc", + "status": "proposed", + "service_type": "primaryCare", + "patient_icn": "1012846043V576341", + "location_id": "984", "minutes_duration": 60, - "practitioners":[ - + "practitioners": [ ], - "created":"2022-01-10T20:49:00Z", - "requested_periods":[ + "created": "2022-01-10T20:49:00Z", + "requested_periods": [ { - "start":"2022-01-26T00:00:00Z" + "start": "2022-01-26T00:00:00Z" } ], - "contact":{ - "telecom":[ + "contact": { + "telecom": [ { - "type":"phone", - "value":"2566832029" + "type": "phone", + "value": "2566832029" }, { - "type":"email", - "value":"Aarathi.poldass@va.gov" + "type": "email", + "value": "Aarathi.poldass@va.gov" } ] }, - "preferred_times_for_phone_call":[ + "preferred_times_for_phone_call": [ "Morning" ], - "preferred_location":{ - "city":"Juneau", - "state":"AK" + "preferred_location": { + "city": "Juneau", + "state": "AK" }, - "cancellation_reason":{ - "code":"other" + "cancellation_reason": { + "code": "other" }, - "comment":"this is a comment", - "preferred_language":"French", - "cancellable":true, - "extension":{ - "cc_location":{ - "address":{ - + "patient_comments": "this is a comment", + "preferred_language": "French", + "cancellable": true, + "extension": { + "cc_location": { + "address": { } } }, - "location":{ - "id":"442", - "name":"Cheyenne VA Medical Center", - "time_zone" : { - "time_zone_id" : "America/Denver" + "location": { + "id": "442", + "name": "Cheyenne VA Medical Center", + "time_zone": { + "time_zone_id": "America/Denver" }, - "physical_address":{ - "type":"physical", - "line":[ + "physical_address": { + "type": "physical", + "line": [ "2360 East Pershing Boulevard" ], - "city":"Cheyenne", - "state":"WY", - "postal_code":"82001-5356" + "city": "Cheyenne", + "state": "WY", + "postal_code": "82001-5356" }, - "lat":41.148026, - "long":-104.786255, - "phone":{ - "main":"307-778-7550" + "lat": 41.148026, + "long": -104.786255, + "phone": { + "main": "307-778-7550" }, - "url":null, - "code":null + "url": null, + "code": null } }, { - "id":"50956", - "identifier":[ + "id": "50956", + "identifier": [ { - "system":"http://med.va.gov/fhir/urn/vaos/ars/id", - "value":"8a48d8a47ba18356017ba7b8f666001c" + "system": "http://med.va.gov/fhir/urn/vaos/ars/id", + "value": "8a48d8a47ba18356017ba7b8f666001c" } ], - "service_name":"Friendly Name Optometry", - "location":{ - "id":"442", - "name":"Cheyenne VA Medical Center", - "time_zone" : { - "time_zone_id" : "America/Denver" + "service_name": "Friendly Name Optometry", + "location": { + "id": "442", + "name": "Cheyenne VA Medical Center", + "time_zone": { + "time_zone_id": "America/Denver" }, - "physical_address":{ - "type":"physical", - "line":[ + "physical_address": { + "type": "physical", + "line": [ "2360 East Pershing Boulevard" ], - "city":"Cheyenne", - "state":"WY", - "postal_code":"82001-5356" - }, - "lat":41.148026, - "long":-104.786255, - "phone":{ - "main":"307-778-7550" - }, - "url":null, - "code":null - }, - "kind":"clinic", - "status":"proposed", - "service_type":"socialWork", - "patient_icn":"1012845331V153043", - "location_id":"983", - "reason":"RoutineFollow-up", - "requested_periods":[ - { - "start":"2021-09-28T00:00:00Z", - "end":"2021-09-28T11:59:59.999Z" + "city": "Cheyenne", + "state": "WY", + "postal_code": "82001-5356" + }, + "lat": 41.148026, + "long": -104.786255, + "phone": { + "main": "307-778-7550" + }, + "url": null, + "code": null + }, + "kind": "clinic", + "status": "proposed", + "service_type": "socialWork", + "patient_icn": "1012845331V153043", + "location_id": "983", + "reason": "RoutineFollow-up", + "requested_periods": [ + { + "start": "2021-09-28T00:00:00Z", + "end": "2021-09-28T11:59:59.999Z" } ], - "contact":{ - "telecom":[ + "contact": { + "telecom": [ { - "type":"email", - "value":"Aarathi.poldass@va.gov" + "type": "email", + "value": "Aarathi.poldass@va.gov" }, { - "type":"phone", - "value":"7175555555" + "type": "phone", + "value": "7175555555" } ] }, - "preferred_times_for_phone_call":[ + "preferred_times_for_phone_call": [ "Evening" ], - "cancellation_reason":{ - "code":"other" + "cancellation_reason": { + "code": "other" }, - "cancellable":true + "cancellable": true }, { - "id":"53352", - "identifier":[ + "id": "53352", + "identifier": [ { - "system":"http://med.va.gov/fhir/urn/vaos/ars/id", - "value":"8a48a6147be6a5c2017be74b99220000" + "system": "http://med.va.gov/fhir/urn/vaos/ars/id", + "value": "8a48a6147be6a5c2017be74b99220000" } ], - "kind":"phone", - "service_name":"Friendly Name Optometry", - "location":{ - "id":"442", - "name":"Cheyenne VA Medical Center", - "time_zone" : { - "time_zone_id" : "America/Denver" - }, - "physical_address":{ - "type":"physical", - "line":[ + "kind": "phone", + "service_name": "Friendly Name Optometry", + "location": { + "id": "442", + "name": "Cheyenne VA Medical Center", + "time_zone": { + "time_zone_id": "America/Denver" + }, + "physical_address": { + "type": "physical", + "line": [ "2360 East Pershing Boulevard" ], - "city":"Cheyenne", - "state":"WY", - "postal_code":"82001-5356" - }, - "lat":41.148026, - "long":-104.786255, - "phone":{ - "main":"307-778-7550" - }, - "url":null, - "code":null - }, - "status":"proposed", - "service_type":"primaryCare", - "patient_icn":"1012845331V153043", - "location_id":"983", - "reason":"NewIssue", - "requested_periods":[ - { - "start":"2021-10-01T12:00:00Z", - "end":"2021-10-01T23:59:59.999Z" + "city": "Cheyenne", + "state": "WY", + "postal_code": "82001-5356" + }, + "lat": 41.148026, + "long": -104.786255, + "phone": { + "main": "307-778-7550" + }, + "url": null, + "code": null + }, + "status": "proposed", + "service_type": "primaryCare", + "patient_icn": "1012845331V153043", + "location_id": "983", + "reason": "NewIssue", + "requested_periods": [ + { + "start": "2021-10-01T12:00:00Z", + "end": "2021-10-01T23:59:59.999Z" } ], - "contact":{ - "telecom":[ + "contact": { + "telecom": [ { - "type":"email", - "value":"judy.morrison@id.me" + "type": "email", + "value": "judy.morrison@id.me" }, { - "type":"phone", - "value":"7175555555" + "type": "phone", + "value": "7175555555" } ] }, - "preferred_times_for_phone_call":[ + "preferred_times_for_phone_call": [ "Morning" ], - "cancellation_reason":{ - "code":"other" + "cancellation_reason": { + "code": "other" }, - "cancellable":true + "cancellable": true }, { - "id":"50094", - "identifier":[ + "id": "50094", + "identifier": [ { - "system":"http://med.va.gov/fhir/urn/vaos/arsid", - "value":"8a487fd67ba6a62d017bc0cc86d80002" + "system": "http://med.va.gov/fhir/urn/vaos/arsid", + "value": "8a487fd67ba6a62d017bc0cc86d80002" } ], - "kind":"telehealth", - "location":{ - "id":"442", - "name":"Cheyenne VA Medical Center", - "time_zone" : { - "time_zone_id" : "America/Denver" + "kind": "telehealth", + "location": { + "id": "442", + "name": "Cheyenne VA Medical Center", + "time_zone": { + "time_zone_id": "America/Denver" }, - "physical_address":{ - "type":"physical", - "line":[ + "physical_address": { + "type": "physical", + "line": [ "2360 East Pershing Boulevard" ], - "city":"Cheyenne", - "state":"WY", - "postal_code":"82001-5356" - }, - "lat":41.148026, - "long":-104.786255, - "phone":{ - "main":"307-778-7550" - }, - "url":null, - "code":null - }, - "status":"proposed", - "service_type":"PrimaryCare", - "patient_icn":"1012845331V153043", - "location_id":"983", - "reason":"Test_SM test (tele)", - "requested_periods":[ - { - "start":"2021-09-08T12:00:00Z", - "end":"2021-09-08T23:59:59.999Z" + "city": "Cheyenne", + "state": "WY", + "postal_code": "82001-5356" + }, + "lat": 41.148026, + "long": -104.786255, + "phone": { + "main": "307-778-7550" + }, + "url": null, + "code": null + }, + "status": "proposed", + "service_type": "PrimaryCare", + "patient_icn": "1012845331V153043", + "location_id": "983", + "reason": "Test_SM test (tele)", + "requested_periods": [ + { + "start": "2021-09-08T12:00:00Z", + "end": "2021-09-08T23:59:59.999Z" } ], - "contact":{ - "telecom":[ + "contact": { + "telecom": [ { - "type":"phone", - "value":"9999999992" + "type": "phone", + "value": "9999999992" } ] }, - "cancellation_reason":{ - "code":"other" + "cancellation_reason": { + "code": "other" }, - "cancellable":true, - "telehealth":{ - "vvs_kind":"MOBILE_ANY", - "url":"http://www.meeting.com" + "cancellable": true, + "telehealth": { + "vvs_kind": "MOBILE_ANY", + "url": "http://www.meeting.com" }, - "extension":{ + "extension": { "patient_has_mobile_gfe": false } }, { - "id":"50095", - "identifier":[ + "id": "50095", + "identifier": [ { - "system":"http://med.va.gov/fhir/urn/vaos/arsid", - "value":"8a487fd67ba6a62d017bc0cc86d80002" + "system": "http://med.va.gov/fhir/urn/vaos/arsid", + "value": "8a487fd67ba6a62d017bc0cc86d80002" } ], - "kind":"telehealth", - "location":{ - "id":"442", - "name":"Cheyenne VA Medical Center", - "time_zone" : { - "time_zone_id" : "America/Denver" + "kind": "telehealth", + "location": { + "id": "442", + "name": "Cheyenne VA Medical Center", + "time_zone": { + "time_zone_id": "America/Denver" }, - "physical_address":{ - "type":"physical", - "line":[ + "physical_address": { + "type": "physical", + "line": [ "2360 East Pershing Boulevard" ], - "city":"Cheyenne", - "state":"WY", - "postal_code":"82001-5356" - }, - "lat":41.148026, - "long":-104.786255, - "phone":{ - "main":"307-778-7550" - }, - "url":null, - "code":null - }, - "status":"proposed", - "service_type":"PrimaryCare", - "patient_icn":"1012845331V153043", - "location_id":"983", - "reason":"Test_SM test (tele)", - "requested_periods":[ - { - "start":"2021-09-08T12:00:00Z", - "end":"2021-09-08T23:59:59.999Z" + "city": "Cheyenne", + "state": "WY", + "postal_code": "82001-5356" + }, + "lat": 41.148026, + "long": -104.786255, + "phone": { + "main": "307-778-7550" + }, + "url": null, + "code": null + }, + "status": "proposed", + "service_type": "PrimaryCare", + "patient_icn": "1012845331V153043", + "location_id": "983", + "reason": "Test_SM test (tele)", + "requested_periods": [ + { + "start": "2021-09-08T12:00:00Z", + "end": "2021-09-08T23:59:59.999Z" } ], - "contact":{ - "telecom":[ + "contact": { + "telecom": [ { - "type":"phone", - "value":"9999999992" + "type": "phone", + "value": "9999999992" } ] }, - "cancellation_reason":{ - "code":"other" - }, - "cancellable":true, - "telehealth":{ - "url":"http://www.meeting.com", - "atlas":{ - "site_code":"9931", - "confirmation_code":"420835", - "address":{ - "street_address":"114 Dewey Ave", - "city":"Eureka", - "state":"MT", - "zip_code":"59917", - "country":"USA", - "latitutde":48.87956, - "longitude":-115.05251, - "additional_details":"" + "cancellation_reason": { + "code": "other" + }, + "cancellable": true, + "telehealth": { + "url": "http://www.meeting.com", + "atlas": { + "site_code": "9931", + "confirmation_code": "420835", + "address": { + "street_address": "114 Dewey Ave", + "city": "Eureka", + "state": "MT", + "zip_code": "59917", + "country": "USA", + "latitutde": 48.87956, + "longitude": -115.05251, + "additional_details": "" } } } }, { - "id":"50094", - "identifier":[ + "id": "50094", + "identifier": [ { - "system":"http://med.va.gov/fhir/urn/vaos/arsid", - "value":"8a487fd67ba6a62d017bc0cc86d80002" + "system": "http://med.va.gov/fhir/urn/vaos/arsid", + "value": "8a487fd67ba6a62d017bc0cc86d80002" } ], - "kind":"telehealth", - "location":{ - "id":"442", - "name":"Cheyenne VA Medical Center", - "time_zone" : { - "time_zone_id" : "America/Denver" + "kind": "telehealth", + "location": { + "id": "442", + "name": "Cheyenne VA Medical Center", + "time_zone": { + "time_zone_id": "America/Denver" }, - "physical_address":{ - "type":"physical", - "line":[ + "physical_address": { + "type": "physical", + "line": [ "2360 East Pershing Boulevard" ], - "city":"Cheyenne", - "state":"WY", - "postal_code":"82001-5356" - }, - "lat":41.148026, - "long":-104.786255, - "phone":{ - "main":"307-778-7550" - }, - "url":null, - "code":null - }, - "status":"proposed", - "service_type":"PrimaryCare", - "patient_icn":"1012845331V153043", - "location_id":"983", - "reason":"Test_SM test (tele)", - "requested_periods":[ - { - "start":"2021-09-08T12:00:00Z", - "end":"2021-09-08T23:59:59.999Z" + "city": "Cheyenne", + "state": "WY", + "postal_code": "82001-5356" + }, + "lat": 41.148026, + "long": -104.786255, + "phone": { + "main": "307-778-7550" + }, + "url": null, + "code": null + }, + "status": "proposed", + "service_type": "PrimaryCare", + "patient_icn": "1012845331V153043", + "location_id": "983", + "reason": "Test_SM test (tele)", + "requested_periods": [ + { + "start": "2021-09-08T12:00:00Z", + "end": "2021-09-08T23:59:59.999Z" } ], - "contact":{ - "telecom":[ + "contact": { + "telecom": [ { - "type":"phone", - "value":"9999999992" + "type": "phone", + "value": "9999999992" } ] }, - "cancellation_reason":{ - "code":"other" + "cancellation_reason": { + "code": "other" }, - "cancellable":true, - "telehealth":{ - "vvs_kind":"MOBILE_ANY", - "url":"http://www.meeting.com" + "cancellable": true, + "telehealth": { + "vvs_kind": "MOBILE_ANY", + "url": "http://www.meeting.com" }, - "extension":{ + "extension": { "patient_has_mobile_gfe": true } }, { - "id":"53359", - "identifier":[ + "id": "53359", + "identifier": [ { - "system":"http://med.va.gov/fhir/urn/vaos/ars/id", - "value":"8a48a6147be6a5c2017be74b99220000" + "system": "http://med.va.gov/fhir/urn/vaos/ars/id", + "value": "8a48a6147be6a5c2017be74b99220000" } ], - "kind":"phone", - "service_name":"Friendly Name Optometry", - "location":{ - "id":"442", - "name":"Cheyenne VA Medical Center", - "time_zone" : { - "time_zone_id" : "America/Denver" - }, - "physical_address":{ - "type":"physical", - "line":[ + "kind": "phone", + "service_name": "Friendly Name Optometry", + "location": { + "id": "442", + "name": "Cheyenne VA Medical Center", + "time_zone": { + "time_zone_id": "America/Denver" + }, + "physical_address": { + "type": "physical", + "line": [ "2360 East Pershing Boulevard" ], - "city":"Cheyenne", - "state":"WY", - "postal_code":"82001-5356" + "city": "Cheyenne", + "state": "WY", + "postal_code": "82001-5356" }, - "lat":41.148026, - "long":-104.786255, - "phone":{ - "main":"307-778-7550" + "lat": 41.148026, + "long": -104.786255, + "phone": { + "main": "307-778-7550" }, - "url":null, - "code":null + "url": null, + "code": null }, - "status":"proposed", - "service_type":"primaryCare", - "patient_icn":"1012845331V153043", - "location_id":"983", - "reason":"NewIssue", - "requested_periods":[ + "status": "proposed", + "service_type": "primaryCare", + "patient_icn": "1012845331V153043", + "location_id": "983", + "reason": "NewIssue", + "requested_periods": [ { - "start":"2022-08-20T12:00:00Z", - "end":"2022-08-20T23:59:59.999Z" + "start": "2022-08-20T12:00:00Z", + "end": "2022-08-20T23:59:59.999Z" }, { - "start":"2022-08-27T12:00:00Z", - "end":"2022-08-27T23:59:59.999Z" + "start": "2022-08-27T12:00:00Z", + "end": "2022-08-27T23:59:59.999Z" }, { - "start":"2022-10-03T12:00:00Z", - "end":"2022-10-03T23:59:59.999Z" + "start": "2022-10-03T12:00:00Z", + "end": "2022-10-03T23:59:59.999Z" } ], - "contact":{ - "telecom":[ + "contact": { + "telecom": [ { - "type":"email", - "value":"judy.morrison@id.me" + "type": "email", + "value": "judy.morrison@id.me" }, { - "type":"phone", - "value":"7175555555" + "type": "phone", + "value": "7175555555" } ] }, - "preferred_times_for_phone_call":[ + "preferred_times_for_phone_call": [ "Morning" ], - "cancellation_reason":{ - "code":"other" + "cancellation_reason": { + "code": "other" }, - "cancellable":true + "cancellable": true }, { - "id":"53360", - "identifier":[ + "id": "53360", + "identifier": [ { - "system":"http://med.va.gov/fhir/urn/vaos/ars/id", - "value":"8a48a6147be6a5c2017be74b99220000" + "system": "http://med.va.gov/fhir/urn/vaos/ars/id", + "value": "8a48a6147be6a5c2017be74b99220000" } ], - "kind":"phone", - "service_name":"Friendly Name Optometry", - "location":{ - "id":"442", - "name":"Cheyenne VA Medical Center", - "time_zone" : { - "time_zone_id" : "America/Denver" - }, - "physical_address":{ - "type":"physical", - "line":[ + "kind": "phone", + "service_name": "Friendly Name Optometry", + "location": { + "id": "442", + "name": "Cheyenne VA Medical Center", + "time_zone": { + "time_zone_id": "America/Denver" + }, + "physical_address": { + "type": "physical", + "line": [ "2360 East Pershing Boulevard" ], - "city":"Cheyenne", - "state":"WY", - "postal_code":"82001-5356" + "city": "Cheyenne", + "state": "WY", + "postal_code": "82001-5356" }, - "lat":41.148026, - "long":-104.786255, - "phone":{ - "main":"307-778-7550" + "lat": 41.148026, + "long": -104.786255, + "phone": { + "main": "307-778-7550" }, - "url":null, - "code":null + "url": null, + "code": null }, - "status":"proposed", - "service_type":"primaryCare", - "patient_icn":"1012845331V153043", - "location_id":"983", - "reason":"NewIssue", - "requested_periods":[ + "status": "proposed", + "service_type": "primaryCare", + "patient_icn": "1012845331V153043", + "location_id": "983", + "reason": "NewIssue", + "requested_periods": [ { - "start":"2021-08-20T12:00:00Z", - "end":"2021-08-20T23:59:59.999Z" + "start": "2021-08-20T12:00:00Z", + "end": "2021-08-20T23:59:59.999Z" }, { - "start":"2021-08-27T12:00:00Z", - "end":"2021-08-27T23:59:59.999Z" + "start": "2021-08-27T12:00:00Z", + "end": "2021-08-27T23:59:59.999Z" }, { - "start":"2021-10-03T12:00:00Z", - "end":"2021-10-03T23:59:59.999Z" + "start": "2021-10-03T12:00:00Z", + "end": "2021-10-03T23:59:59.999Z" } ], - "contact":{ - "telecom":[ + "contact": { + "telecom": [ { - "type":"email", - "value":"judy.morrison@id.me" + "type": "email", + "value": "judy.morrison@id.me" }, { - "type":"phone", - "value":"7175555555" + "type": "phone", + "value": "7175555555" } ] }, - "preferred_times_for_phone_call":[ + "preferred_times_for_phone_call": [ "Morning" ], - "cancellation_reason":{ - "code":"other" + "cancellation_reason": { + "code": "other" }, - "cancellable":true + "cancellable": true }, { - "id":"53241", - "identifier":[ + "id": "53241", + "identifier": [ { - "system":"http://med.va.gov/fhir/urn/vaos/ars/id", - "value":"8a759b255ba1a41b015bf2eeb5c7000f" + "system": "http://med.va.gov/fhir/urn/vaos/ars/id", + "value": "8a759b255ba1a41b015bf2eeb5c7000f" } ], - "kind":"clinic", - "status":"cancelled", - "service_type":"primaryCare", - "reason_code":{ - "coding":[ + "kind": "clinic", + "status": "cancelled", + "service_type": "primaryCare", + "reason_for_appointment": "Routine Follow-up", + "reason_code": { + "coding": [ { - "code":"Routine Follow-up" + "code": "Routine Follow-up" } ] }, - "patient_icn":"1012853802V084487", - "location_id":"442", - "location":{ - "id":"442", - "name":"Cheyenne VA Medical Center", - "time_zone" : { - "time_zone_id" : "America/Denver" - }, - "physical_address":{ - "type":"physical", - "line":[ + "patient_icn": "1012853802V084487", + "location_id": "442", + "location": { + "id": "442", + "name": "Cheyenne VA Medical Center", + "time_zone": { + "time_zone_id": "America/Denver" + }, + "physical_address": { + "type": "physical", + "line": [ "2360 East Pershing Boulevard" ], - "city":"Cheyenne", - "state":"WY", - "postal_code":"82001-5356" + "city": "Cheyenne", + "state": "WY", + "postal_code": "82001-5356" }, - "lat":41.148026, - "long":-104.786255, - "phone":{ - "main":"307-778-7550" + "lat": 41.148026, + "long": -104.786255, + "phone": { + "main": "307-778-7550" }, - "url":null, - "code":null + "url": null, + "code": null }, - "created":"2017-05-10T11:16:21Z", - "requested_periods":[ + "created": "2017-05-10T11:16:21Z", + "requested_periods": [ { - "start":"2017-05-16T00:00:00Z", - "end":"2017-05-16T11:59:59.999Z" + "start": "2017-05-16T00:00:00Z", + "end": "2017-05-16T11:59:59.999Z" }, { - "start":"2017-05-17T00:00:00Z", - "end":"2017-05-17T11:59:59.999Z" + "start": "2017-05-17T00:00:00Z", + "end": "2017-05-17T11:59:59.999Z" }, { - "start":"2017-05-31T00:00:00Z", - "end":"2017-05-31T11:59:59.999Z" + "start": "2017-05-31T00:00:00Z", + "end": "2017-05-31T11:59:59.999Z" } ], - "contact":{ - "telecom":[ + "contact": { + "telecom": [ { - "type":"phone", - "value":"(788) 999-9999" + "type": "phone", + "value": "(788) 999-9999" } ] }, - "preferred_times_for_phone_call":[ + "preferred_times_for_phone_call": [ "Afternoon" ], - "cancelation_reason":{ - "coding":[ + "cancelation_reason": { + "coding": [ { - "system":"http://terminology.hl7.org/CodeSystem/appointment-cancellation-reason", - "code":"prov", - "display":"The appointment was cancelled by the provider" + "system": "http://terminology.hl7.org/CodeSystem/appointment-cancellation-reason", + "code": "prov", + "display": "The appointment was cancelled by the provider" } ] }, - "comment":"testing", - "extension":{ - "cc_location":{ - "address":{ - + "patient_comments": "testing", + "extension": { + "cc_location": { + "address": { } } } }, { - "id":"145078", - "identifier":[ + "id": "145078", + "identifier": [ { - "system":"Appointment/", - "value":"5239383433383731" + "system": "Appointment/", + "value": "5239383433383731" } ], - "kind":"clinic", - "status":"proposed", - "service_type":"amputation", - "service_types":[ + "kind": "clinic", + "status": "proposed", + "service_type": "amputation", + "service_types": [ { - "coding":[ + "coding": [ { - "system":"http://veteran.apps.va.gov/terminologies/fhir/CodeSystem/vats-service-type", - "code":"amputation" + "system": "http://veteran.apps.va.gov/terminologies/fhir/CodeSystem/vats-service-type", + "code": "amputation" } ] } ], - "service_category":[ + "service_category": [ { - "coding":[ + "coding": [ { - "system":"http://www.va.gov/Terminology/VistADefinedTerms/409_1", - "code":"REGULAR", - "display":"REGULAR" + "system": "http://www.va.gov/Terminology/VistADefinedTerms/409_1", + "code": "REGULAR", + "display": "REGULAR" } ], - "text":"REGULAR" - } - ], - "reason_code":{ - "text":"preferred modality: clinic|phone number: 3174485062|email: melissa.gra@va.gov|preferred dates:12/13/2022 PM,12/21/2022 AM|reason code:ROUTINEVISIT|comments:My leg!" - }, - "patient_icn":"1012845331V153043", - "location_id":"984", - "start":"2022-12-13T00:00:00Z", - "created":"2022-11-29T00:00:00Z", - "requested_periods":[ - { - "start":"2022-12-13T00:00:00Z", - "end":"2022-12-13T00:00:00Z" - } - ], - "cancellable":true, - "extension":{"cc_location":{"address":{}}}, - "location":{ - "id":"984", - "vista_site":"984", - "vast_parent":"984", - "type":"va_health_facility", - "name":"Dayton VA Medical Center", - "classification":"VA Medical Center (VAMC)", - "timezone":{"time_zone_id":"America/New_York"}, - "lat":39.74935, - "long":-84.2532, - "website":"https://www.dayton.va.gov/locations/directions.asp", - "phone":{"main":"937-268-6511"}, - "physical_address":{ - "type":"physical", - "line":["4100 West Third Street"], - "city":"Dayton", - "state":"OH", - "postal_code":"45428-9000" - }, - "health_service":["Audiology", "Cardiology", "DentalServices", "Dermatology", "Gastroenterology", "Gynecology", "MentalHealthCare", "Nutrition", "Ophthalmology", "Optometry", "Orthopedics", "Podiatry", "PrimaryCare", "SpecialtyCare", "Urology", "WomensHealth"], - "healthcare_provider":null + "text": "REGULAR" + } + ], + "contact": { + "telecom": [ + { + "type": "phone", + "value": "317-448-5062" + }, + { + "type": "email", + "value": "melissa.gra@va.gov" + } + ] + }, + "reason_for_appointment": "Routine Follow-up", + "patient_comments": "My leg!", + "reason_code": { + "text": "preferred modality: clinic|phone number: 3174485062|email: melissa.gra@va.gov|preferred dates:12/13/2022 PM,12/21/2022 AM|reason code:ROUTINEVISIT|comments:My leg!" + }, + "patient_icn": "1012845331V153043", + "location_id": "984", + "start": "2022-12-13T00:00:00Z", + "created": "2022-11-29T00:00:00Z", + "requested_periods": [ + { + "start": "2022-12-13T12:00:00Z", + "end": "2022-12-13T13:00:00Z" + }, + { + "start": "2022-12-21T00:00:00Z", + "end": "2022-12-21T01:00:00Z" + } + ], + "cancellable": true, + "extension": { + "cc_location": { + "address": {} + } + }, + "location": { + "id": "984", + "vista_site": "984", + "vast_parent": "984", + "type": "va_health_facility", + "name": "Dayton VA Medical Center", + "classification": "VA Medical Center (VAMC)", + "timezone": { + "time_zone_id": "America/New_York" + }, + "lat": 39.74935, + "long": -84.2532, + "website": "https://www.dayton.va.gov/locations/directions.asp", + "phone": { + "main": "937-268-6511" + }, + "physical_address": { + "type": "physical", + "line": [ + "4100 West Third Street" + ], + "city": "Dayton", + "state": "OH", + "postal_code": "45428-9000" + }, + "health_service": [ + "Audiology", + "Cardiology", + "DentalServices", + "Dermatology", + "Gastroenterology", + "Gynecology", + "MentalHealthCare", + "Nutrition", + "Ophthalmology", + "Optometry", + "Orthopedics", + "Podiatry", + "PrimaryCare", + "SpecialtyCare", + "Urology", + "WomensHealth" + ], + "healthcare_provider": null } }, { - "id":"50094", - "identifier":[ + "id": "50094", + "identifier": [ { - "system":"http://med.va.gov/fhir/urn/vaos/arsid", - "value":"8a487fd67ba6a62d017bc0cc86d80002" + "system": "http://med.va.gov/fhir/urn/vaos/arsid", + "value": "8a487fd67ba6a62d017bc0cc86d80002" } ], - "kind":"telehealth", - "location":{ - "id":"442", - "name":"Cheyenne VA Medical Center", - "time_zone" : { - "time_zone_id" : "America/Denver" + "kind": "telehealth", + "location": { + "id": "442", + "name": "Cheyenne VA Medical Center", + "time_zone": { + "time_zone_id": "America/Denver" }, - "physical_address":{ - "type":"physical", - "line":[ + "physical_address": { + "type": "physical", + "line": [ "2360 East Pershing Boulevard" ], - "city":"Cheyenne", - "state":"WY", - "postal_code":"82001-5356" - }, - "lat":41.148026, - "long":-104.786255, - "phone":{ - "main":"307-778-7550" - }, - "url":null, - "code":null - }, - "status":"proposed", - "service_type":"PrimaryCare", - "patient_icn":"1012845331V153043", - "location_id":"983", - "reason":"Test_SM test (tele)", - "requested_periods":[ - { - "start":"2021-09-08T12:00:00Z", - "end":"2021-09-08T23:59:59.999Z" + "city": "Cheyenne", + "state": "WY", + "postal_code": "82001-5356" + }, + "lat": 41.148026, + "long": -104.786255, + "phone": { + "main": "307-778-7550" + }, + "url": null, + "code": null + }, + "status": "proposed", + "service_type": "PrimaryCare", + "patient_icn": "1012845331V153043", + "location_id": "983", + "reason": "Test_SM test (tele)", + "requested_periods": [ + { + "start": "2021-09-08T12:00:00Z", + "end": "2021-09-08T23:59:59.999Z" } ], - "contact":{ - "telecom":[ + "contact": { + "telecom": [ { - "type":"phone", - "value":"9999999992" + "type": "phone", + "value": "9999999992" } ] }, - "cancellation_reason":{ - "code":"other" + "cancellation_reason": { + "code": "other" }, - "cancellable":true, - "telehealth":{ - "vvs_kind":"CLINIC_BASED", - "url":"http://www.meeting.com" + "cancellable": true, + "telehealth": { + "vvs_kind": "CLINIC_BASED", + "url": "http://www.meeting.com" }, - "extension":{ + "extension": { "patient_has_mobile_gfe": true } } diff --git a/spec/support/vcr_cassettes/mobile/appointments/VAOS_v2/get_appointment_200.yml b/spec/support/vcr_cassettes/mobile/appointments/VAOS_v2/get_appointment_200.yml index 887eea1c489..688f351bda6 100644 --- a/spec/support/vcr_cassettes/mobile/appointments/VAOS_v2/get_appointment_200.yml +++ b/spec/support/vcr_cassettes/mobile/appointments/VAOS_v2/get_appointment_200.yml @@ -81,6 +81,9 @@ http_interactions: } ] }, + "reason_code":{ + "text":"preferred modality: clinic|phone number: 3174485062|email: melissa.gra@va.gov|preferred dates:12/13/2022 PM,12/21/2022 AM|reason code:ROUTINEVISIT|comments:My leg!" + }, "cancellable":false, "extension":{ "cc_location":{ From d9b6929d356cc84f63b022b54236f2316c764024 Mon Sep 17 00:00:00 2001 From: Tonksthebear Date: Tue, 3 Sep 2024 15:17:09 -0700 Subject: [PATCH 2/5] Defensively check contact --- .../mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb b/modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb index 761c2d77aea..c80b7104d59 100644 --- a/modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb +++ b/modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb @@ -227,7 +227,7 @@ def cancellation_reason(cancellation_reason) def contact(telecom, type) return nil if telecom.blank? - telecom.select { |contact| contact[:type] == type }&.dig(0, :value) + telecom.select { |contact| contact&.try(:dig, :type) == type }&.dig(0, :value) end def proposed_times From 5eddccad20c92a2e62cdd7f33f05a9872e9fc3b0 Mon Sep 17 00:00:00 2001 From: Tonksthebear Date: Wed, 4 Sep 2024 14:59:40 -0700 Subject: [PATCH 3/5] Changes --- .../mobile/v0/adapters/vaos_v2_appointment.rb | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb b/modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb index c80b7104d59..8561bd357dd 100644 --- a/modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb +++ b/modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb @@ -128,7 +128,7 @@ def build_appointment_model private def appointment_request? - requested_periods.present? + appointment[:requested_periods].present? end # to match web behavior, prefer the value found in the practitioners list over the preferred_provider_name. @@ -231,20 +231,13 @@ def contact(telecom, type) end def proposed_times - return nil if requested_periods.nil? - - requested_periods.map do |period| - date, time = begin - start_date = time_to_datetime(period[:start]) - date = start_date.strftime('%m/%d/%Y') - time = start_date.hour.zero? ? 'AM' : 'PM' - [date, time] - end + return nil if appointment[:requested_periods].nil? - { - date:, - time: - } + appointment[:requested_periods].map do |period| + start_date = time_to_datetime(period[:start]) + date = start_date.strftime('%m/%d/%Y') + time = start_date.hour.zero? ? 'AM' : 'PM' + { date:, time: } end end @@ -252,15 +245,12 @@ def status STATUSES[appointment[:status].to_sym] end - def requested_periods - @requested_periods ||= appointment[:requested_periods] - end def start_date_utc @start_date_utc ||= begin start = appointment[:start] if start.nil? - sorted_dates = requested_periods.map do |period| + sorted_dates = appointment[:requested_periods].map do |period| time_to_datetime(period[:start]) end.sort future_dates = sorted_dates.select { |period| period > DateTime.now } From 4b5afcd0184001f06353e77789fd6d675da3c216 Mon Sep 17 00:00:00 2001 From: Tonksthebear Date: Wed, 4 Sep 2024 15:04:26 -0700 Subject: [PATCH 4/5] Remove nil check --- .../mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb b/modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb index 8561bd357dd..0bdd22cf69d 100644 --- a/modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb +++ b/modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb @@ -231,7 +231,7 @@ def contact(telecom, type) end def proposed_times - return nil if appointment[:requested_periods].nil? + return nil unless appointment[:requested_periods] appointment[:requested_periods].map do |period| start_date = time_to_datetime(period[:start]) From af60db8499acdbec667dd3394cef1d9efa915f82 Mon Sep 17 00:00:00 2001 From: Tonksthebear Date: Thu, 5 Sep 2024 10:49:33 -0700 Subject: [PATCH 5/5] Rubocop --- .../mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb b/modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb index 0bdd22cf69d..fa1c40b7274 100644 --- a/modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb +++ b/modules/mobile/app/models/mobile/v0/adapters/vaos_v2_appointment.rb @@ -245,7 +245,6 @@ def status STATUSES[appointment[:status].to_sym] end - def start_date_utc @start_date_utc ||= begin start = appointment[:start]