Skip to content

Commit

Permalink
[Automated] Merged master into target k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
va-vsp-bot authored Apr 8, 2024
2 parents 4880a08 + cf9f579 commit 72f4890
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 33 deletions.
112 changes: 80 additions & 32 deletions modules/vaos/app/schemas/appointments_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,25 +91,22 @@
}
},
"reason_code": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"coding": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"system": { "type": "string" },
"code": { "type": "string" },
"display": { "type": "string" }
}
"type": "object",
"additionalProperties": false,
"properties": {
"coding": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"system": { "type": "string" },
"code": { "type": "string" },
"display": { "type": "string" }
}
},
"text": { "type": "string" }
}
}
},
"text": { "type": "string" }
}
},
"description": { "type": "string" },
Expand All @@ -135,7 +132,8 @@
"practitioners": {
"type": "array",
"items": {
"type": "array",
"type": "object",
"additionalProperties": false,
"properties": {
"identifier": {
"type": "array",
Expand All @@ -160,7 +158,7 @@
}
}
},
"practiceName": { "type": "string" },
"practice_name": { "type": "string" },
"address": {
"type": "object",
"additionalProperties": false,
Expand All @@ -175,13 +173,13 @@
},
"city": { "type": "string" },
"state": { "type": "string" },
"postalCode": { "type": "string" },
"postal_code": { "type": "string" },
"country": { "type": "string" },
"text": { "type": "string" }
}
},
"firstName": { "type": "string" },
"lastName": { "type": "string" }
"first_name": { "type": "string" },
"last_name": { "type": "string" }
}
}
},
Expand Down Expand Up @@ -290,20 +288,20 @@
"type": "object",
"additionalProperties": false,
"properties": {
"sitecode": { "type": "string" },
"confirmationCode": { "type": "string" },
"site_code": { "type": "string" },
"confirmation_code": { "type": "string" },
"address": {
"type": "object",
"additionalProperties": false,
"properties": {
"streetAddress": { "type": "string" },
"street_address": { "type": "string" },
"city": { "type": "string" },
"state": { "type": "string" },
"zipCode": { "type": "string" },
"zip_code": { "type": "string" },
"country": { "type": "string" },
"latitude": { "type": "number" },
"latitutde": { "type": "number" },
"longitude": { "type": "number" },
"additionalDetails": { "type": "string" }
"additional_details": { "type": "string" }
}
}
}
Expand All @@ -316,7 +314,10 @@
"type": "object",
"additionalProperties": false,
"properties": {
"ccLocation": {
"desired_date": {
"type": "string"
},
"cc_location": {
"type": "object",
"additionalProperties": false,
"properties": {
Expand All @@ -334,7 +335,7 @@
},
"city": { "type": "string" },
"state": { "type": "string" },
"postalCode": { "type": "string" },
"postal_code": { "type": "string" },
"country": { "type": "string" },
"text": { "type": "string" }
}
Expand All @@ -353,7 +354,54 @@
}
}
},
"practiceName": { "type": "string" }
"practice_name": { "type": "string" }
}
},
"cc_requested_cancellation": { "type": "boolean" },
"hsrm_tast_id": { "type": "string" },
"hsrm_consult_id": { "type": "string" },
"vista_status": {
"type": "array",
"items": { "type": "string" }
},
"cc_treating_specialty": { "type": "string" },
"modality": { "type": "string" },
"patient_has_mobile_gfe": { "type": "boolean" },
"pre_checkin_allowed": { "type": "boolean" },
"e_checkin_allowed": { "type": "boolean" },
"clinic": {
"type": "object",
"additionalProperties": false,
"properties": {
"vista_site": {
"type": "integer",
"maxLength": 3,
"minLength": 3
},
"id": { "type": "string" },
"service_name": { "type": "string" },
"physical_location": { "type": "string" },
"phone_number": { "type": "string" },
"station_id": { "type": "string" },
"station_name": { "type": "string" },
"primary_stop_code": {
"type": "integer",
"maxLength": 3,
"minLength": 3
},
"primary_stop_code_name": { "type": "string" },
"secondary_stop_code": {
"type": "integer",
"maxLength": 3,
"minLength": 3
},
"secondary_stop_code_name": { "type": "string" },
"patient_direct_scheduling": { "type": "boolean" },
"patient_display": { "type": "boolean" },
"char4": { "type": "string" },
"active": { "type": "boolean" },
"non_count": { "type": "boolean" },
"future_booking_maximum_days": { "type": "integer" }
}
}
}
Expand Down
8 changes: 7 additions & 1 deletion modules/vaos/app/services/vaos/v2/appointments_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def get_appointments(start_date, end_date, statuses = nil, pagination_params = {

with_monitoring do
response = perform(:get, appointments_base_path, params, headers)
SchemaContract::ValidationInitiator.call(user:, response:, contract_name: 'appointments_index')
validate_response_schema(response, 'appointments_index')
response.body[:data].each do |appt|
# for CnP and covid appointments set cancellable to false per GH#57824, GH#58690
set_cancellable_false(appt) if cnp?(appt) || covid?(appt)
Expand Down Expand Up @@ -538,6 +538,12 @@ def update_appointment_vaos(appt_id, status)
params = VAOS::V2::UpdateAppointmentForm.new(status:).params
perform(:put, url_path, params, headers)
end

def validate_response_schema(response, contract_name)
return unless response.success? && response.body[:data].present?

SchemaContract::ValidationInitiator.call(user:, response:, contract_name:)
end
end
end
end

0 comments on commit 72f4890

Please sign in to comment.