Skip to content

Commit

Permalink
Merge branch 'master' into pensions-80659-schemaupdate
Browse files Browse the repository at this point in the history
  • Loading branch information
TaiWilkin authored Apr 17, 2024
2 parents 0628f12 + 74f39cf commit cb79acc
Show file tree
Hide file tree
Showing 9 changed files with 343 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ app/models/persistent_attachment.rb @department-of-veterans-affairs/benefits-no
app/models/persistent_attachments/dependency_claim.rb @department-of-veterans-affairs/benefits-dependents-management @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/models/persistent_attachments/lgy_claim.rb @department-of-veterans-affairs/benefits-non-disability @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/models/persistent_attachments/pension_burial.rb @department-of-veterans-affairs/benefits-non-disability @department-of-veterans-affairs/pensions @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/models/personal_information_log.rb @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/models/power_of_attorney.rb @department-of-veterans-affairs/Benefits-Team-1 @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/models/preneeds @department-of-veterans-affairs/mbs-core-team @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
app/models/prescription_preference.rb @department-of-veterans-affairs/vfs-mhv-medications @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
Expand Down Expand Up @@ -1291,7 +1292,7 @@ spec/lib/claim_status_tool @department-of-veterans-affairs/benefits-management-t
spec/lib/common/client/concerns/mhv_fhir_session_client_spec.rb @department-of-veterans-affairs/vfs-mhv-medical-records @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/lib/common/client/concerns/mhv_jwt_session_client_spec.rb @department-of-veterans-affairs/vfs-mhv-medical-records @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/lib/common/client/concerns/mhv_locked_session_client_spec.rb @department-of-veterans-affairs/vfs-mhv-medical-records @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/lib/common/client/middleware/response @department-of-veterans-affairs/backend-review-group
spec/lib/common/client/middleware @department-of-veterans-affairs/backend-review-group
spec/lib/debt_management_center @department-of-veterans-affairs/vsa-debt-resolution @department-of-veterans-affairs/backend-review-group
spec/lib/decision_review @department-of-veterans-affairs/Benefits-Team-1 @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/lib/disability_compensation @department-of-veterans-affairs/Disability-Experience @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
Expand Down Expand Up @@ -1460,6 +1461,7 @@ spec/models/mhv_opt_in_flag_spec.rb @department-of-veterans-affairs/vfs-mhv-secu
spec/models/mpi_data_spec.rb @department-of-veterans-affairs/octo-identity
spec/models/onsite_notification_spec.rb @department-of-veterans-affairs/vfs-authenticated-experience-backend @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/models/persistent_attachments @department-of-veterans-affairs/benefits-non-disability @department-of-veterans-affairs/pensions @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/models/personal_information_log_spec.rb @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/models/preneeds @department-of-veterans-affairs/mbs-core-team @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/models/prescription_spec.rb @department-of-veterans-affairs/vfs-mhv-medications @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
spec/models/prescription_details_spec.rb @department-of-veterans-affairs/vfs-mhv-medications @department-of-veterans-affairs/va-api-engineers @department-of-veterans-affairs/backend-review-group
Expand Down
2 changes: 1 addition & 1 deletion app/models/personal_information_log.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class PersonalInformationLog < ApplicationRecord
scope :last_week, -> { where('created_at >= :date', date: 1.week.ago) }

has_kms_key
has_encrypted :data, migrating: true, type: :json, key: :kms_key, **lockbox_options
has_encrypted :data, type: :json, key: :kms_key, **lockbox_options

validates :error_class, presence: true
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class DropDataInPersonalInformationLog < ActiveRecord::Migration[7.1]
def change
safety_assured { remove_column :personal_information_logs, :data, :jsonb }
end
end
33 changes: 33 additions & 0 deletions db/migrate/20240411160306_create_accredited_organizations.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# frozen_string_literal: true

class CreateAccreditedOrganizations < ActiveRecord::Migration[7.1]
def change
create_table :accredited_organizations, id: :uuid do |t|
t.uuid :ogc_id, null: false
t.string :poa_code, limit: 3, null: false, index: { unique: true }
t.string :name, index: true
t.string :phone
t.string :address_type
t.string :address_line1
t.string :address_line2
t.string :address_line3
t.string :city
t.string :country_code_iso3
t.string :country_name
t.string :county_name
t.string :county_code
t.string :international_postal_code
t.string :province
t.string :state_code
t.string :zip_code
t.string :zip_suffix
t.jsonb :raw_address
t.float :lat
t.float :long
t.geography :location, limit: { srid: 4326, type: 'st_point', geographic: true }
t.timestamps

t.index :location, using: :gist
end
end
end
31 changes: 30 additions & 1 deletion db/schema.rb

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

module CheckIn
module VAOS
class VAOSAppointmentDataSerializer
include JSONAPI::Serializer

keys_to_serialize = %i[id identifier kind status serviceType locationId clinic start end extension]

set_id(&:id)

attribute :appointments do |object|
object.data.map do |data|
data.select { |key| keys_to_serialize.include?(key) }
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe CheckIn::VAOS::VAOSAppointmentDataSerializer do
subject { described_class }

let(:vaos_appointment_data) do
{
data: [
{
id: '180765',
identifier: [
{
system: 'Appointment/',
value: '413938333130383735'
},
{
system: 'http://www.va.gov/Terminology/VistADefinedTerms/409_84',
value: '983:10875'
}
],
kind: 'clinic',
status: 'booked',
serviceType: 'amputation',
patientIcn: '1013125218V696863',
locationId: '983GC',
clinic: '1081',
start: '2023-11-06T16:00:00Z',
end: '2023-11-06T16:30:00Z',
minutesDuration: 30,
created: '2023-08-02T00:00:00Z',
cancellable: true,
extension: {
ccLocation: {
address: {}
},
vistaStatus: [
'NO ACTION TAKEN'
],
preCheckinAllowed: true,
eCheckinAllowed: true
}
},
{
id: '180766',
identifier: [
{
system: 'Appointment/',
value: '413938333130383736'
},
{
system: 'http://www.va.gov/Terminology/VistADefinedTerms/409_84',
value: '983:10876'
}
],
kind: 'clinic',
status: 'booked',
serviceType: 'amputation',
patientIcn: '1013125218V696863',
locationId: '983GC',
clinic: '1081',
start: '2023-11-13T16:00:00Z',
end: '2023-11-13T16:30:00Z',
minutesDuration: 30,
created: '2023-08-02T00:00:00Z',
cancellable: true,
extension: {
ccLocation: {
address: {}
},
vistaStatus: [
'FUTURE'
],
preCheckinAllowed: true,
eCheckinAllowed: true
}
}
]
}
end

context 'For valid vaos appointment data' do
let(:appointment1) do
{
id: '180765',
identifier: [
{
system: 'Appointment/',
value: '413938333130383735'
},
{
system: 'http://www.va.gov/Terminology/VistADefinedTerms/409_84',
value: '983:10875'
}
],
kind: 'clinic',
status: 'booked',
serviceType: 'amputation',
locationId: '983GC',
clinic: '1081',
start: '2023-11-06T16:00:00Z',
end: '2023-11-06T16:30:00Z',
extension: {
ccLocation: {
address: {}
},
vistaStatus: [
'NO ACTION TAKEN'
],
preCheckinAllowed: true,
eCheckinAllowed: true
}
}
end
let(:appointment2) do
{
id: '180766',
identifier: [
{
system: 'Appointment/',
value: '413938333130383736'
},
{
system: 'http://www.va.gov/Terminology/VistADefinedTerms/409_84',
value: '983:10876'
}
],
kind: 'clinic',
status: 'booked',
serviceType: 'amputation',
locationId: '983GC',
clinic: '1081',
start: '2023-11-13T16:00:00Z',
end: '2023-11-13T16:30:00Z',
extension: {
ccLocation: {
address: {}
},
vistaStatus: [
'FUTURE'
],
preCheckinAllowed: true,
eCheckinAllowed: true
}
}
end

let(:serialized_hash_response) do
{
data:
{
id: nil,
type: :vaos_appointment_data,
attributes:
{
appointments:
[
appointment1, appointment2
]
}
}
}
end

it 'returns a serialized hash' do
appt_struct = OpenStruct.new(vaos_appointment_data)
appt_serializer = subject.new(appt_struct)
expect(appt_serializer.serializable_hash).to eq(serialized_hash_response)
end
end

context 'Missing serialization key' do
let(:vaos_appointment_data_without_identifier) do
{
data: [
{
id: '180765',
kind: 'clinic',
status: 'booked',
serviceType: 'amputation',
patientIcn: '1013125218V696863',
locationId: '983GC',
clinic: '1081',
start: '2023-11-06T16:00:00Z',
end: '2023-11-06T16:30:00Z',
created: '2023-08-02T00:00:00Z',
cancellable: true,
extension: {
ccLocation: {
address: {}
},
vistaStatus: [
'NO ACTION TAKEN'
],
preCheckinAllowed: true,
eCheckinAllowed: true
}
}
]
}
end

let(:appointment_without_identifier) do
{
id: '180765',
kind: 'clinic',
status: 'booked',
serviceType: 'amputation',
locationId: '983GC',
clinic: '1081',
start: '2023-11-06T16:00:00Z',
end: '2023-11-06T16:30:00Z',
extension: {
ccLocation: {
address: {}
},
vistaStatus: [
'NO ACTION TAKEN'
],
preCheckinAllowed: true,
eCheckinAllowed: true
}
}
end
let(:serialized_hash_response) do
{
data:
{
id: nil,
type: :vaos_appointment_data,
attributes:
{
appointments:
[
appointment_without_identifier
]
}
}
}
end

it 'identifier not present' do
appt_struct = OpenStruct.new(vaos_appointment_data_without_identifier)
appt_serializer = subject.new(appt_struct)
expect(appt_serializer.serializable_hash).to eq(serialized_hash_response)
end
end
end
2 changes: 1 addition & 1 deletion spec/lib/common/client/middleware/logging_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

it 'creates a new personal information log record' do
expect { client.get('success') }.to change(PersonalInformationLog, :count).by(1)
expect(PersonalInformationLog.last.data.keys).to eq(%w[url method request_body response_body])
expect(PersonalInformationLog.last.data.keys).to eq(%w[method url request_body response_body])
end

it 'correctly records (no) request body on a GET request' do
Expand Down
Loading

0 comments on commit cb79acc

Please sign in to comment.