- Make sure the information is correct. Then confirm your appointment.
- If you need to update any details, click Edit to go back to the
- screen where you entered the information. After you update your
- information, you'll need to go through the tool again to schedule
- your appointment.
-
- >
- )}
- >
- );
-}
-Description.propTypes = {
- data: PropTypes.object,
- flowType: PropTypes.string,
-};
diff --git a/src/applications/vaos/new-appointment/components/ReviewPage/ReviewRequestInfo/ReviewDirectScheduleInfo/ReviewDirectScheduleInfo.jsx b/src/applications/vaos/new-appointment/components/ReviewPage/ReviewRequestInfo/ReviewDirectScheduleInfo/ReviewDirectScheduleInfo.jsx
index 2c82f028474c..de1da4ca24c7 100644
--- a/src/applications/vaos/new-appointment/components/ReviewPage/ReviewRequestInfo/ReviewDirectScheduleInfo/ReviewDirectScheduleInfo.jsx
+++ b/src/applications/vaos/new-appointment/components/ReviewPage/ReviewRequestInfo/ReviewDirectScheduleInfo/ReviewDirectScheduleInfo.jsx
@@ -1,12 +1,10 @@
import React from 'react';
import PropTypes from 'prop-types';
-import { FLOW_TYPES } from '../../../../../utils/constants';
import ReasonForAppointmentSection from '../ReasonForAppointmentSection';
import ContactDetailSection from '../ContactDetailSection';
import AppointmentDate from '../../AppointmentDate';
-import Description from './Description';
import TypeOfAppointmentSection from '../TypeOfAppointmentSection';
-import State from '../../../../../components/State';
+import FacilitySection from '../VAAppointmentSection/FacilitySection';
export default function ReviewDirectScheduleInfo({
data,
@@ -17,19 +15,16 @@ export default function ReviewDirectScheduleInfo({
return (
{pageTitle}
-
+
+
-
{clinic.serviceName}
- {facility.name}
-
- {facility.address?.city},
-
diff --git a/src/applications/vaos/new-appointment/components/ReviewPage/ReviewRequestInfo/TypeOfAppointmentSection.jsx b/src/applications/vaos/new-appointment/components/ReviewPage/ReviewRequestInfo/TypeOfAppointmentSection.jsx
index 8d9f56cc3ced..94a441914f32 100644
--- a/src/applications/vaos/new-appointment/components/ReviewPage/ReviewRequestInfo/TypeOfAppointmentSection.jsx
+++ b/src/applications/vaos/new-appointment/components/ReviewPage/ReviewRequestInfo/TypeOfAppointmentSection.jsx
@@ -1,34 +1,17 @@
import React from 'react';
import PropTypes from 'prop-types';
-import { FLOW_TYPES } from '../../../../utils/constants';
+import { sentenceCase } from '../../../../utils/formatters';
import { getTypeOfCare } from '../../../redux/selectors';
-export default function TypeOfAppointmentSection({ data, flowType }) {
- const typeOfCare = getTypeOfCare(data)?.name;
-
- let typeOfAppt = 'VA Appointment';
-
- if (FLOW_TYPES.REQUEST === flowType) {
- typeOfAppt = 'Type of care';
-
- return (
- <>
-
- {typeOfAppt}
-
-
{typeOfCare}
- >
- );
- }
+export default function TypeOfAppointmentSection({ data }) {
+ const typeOfCare = sentenceCase(getTypeOfCare(data)?.name);
return (
<>
- {typeOfAppt}
+ Type of care
-
- {typeOfCare}
-
+
{typeOfCare}
>
);
}
diff --git a/src/applications/vaos/new-appointment/components/ReviewPage/ReviewRequestInfo/VAAppointmentSection/FacilitySection.jsx b/src/applications/vaos/new-appointment/components/ReviewPage/ReviewRequestInfo/VAAppointmentSection/FacilitySection.jsx
index 6e30a6598f5e..f2884ad78a45 100644
--- a/src/applications/vaos/new-appointment/components/ReviewPage/ReviewRequestInfo/VAAppointmentSection/FacilitySection.jsx
+++ b/src/applications/vaos/new-appointment/components/ReviewPage/ReviewRequestInfo/VAAppointmentSection/FacilitySection.jsx
@@ -5,26 +5,26 @@ import { FLOW_TYPES } from '../../../../../utils/constants';
import State from '../../../../../components/State';
import { getFlowType } from '../../../../redux/selectors';
-export default function FacilitySection({ facility }) {
+export default function FacilitySection({ facility, clinic }) {
const flowType = useSelector(getFlowType);
- if (FLOW_TYPES.DIRECT === flowType)
- return (
- <>
-
{facility.name}
- {facility.address?.city},
- >
- );
-
return (
<>
Facility
{facility.name}
{facility.address?.city},
+ {FLOW_TYPES.DIRECT === flowType && (
+ <>
+
+
+
Clinic: {clinic.serviceName || 'Not available'}
+ >
+ )}
>
);
}
FacilitySection.propTypes = {
facility: PropTypes.object.isRequired,
+ clinic: PropTypes.object,
};
diff --git a/src/applications/vaos/new-appointment/components/ReviewPage/ReviewRequestInfo/index.jsx b/src/applications/vaos/new-appointment/components/ReviewPage/ReviewRequestInfo/index.jsx
index bdd502d0d85d..3390ca644560 100644
--- a/src/applications/vaos/new-appointment/components/ReviewPage/ReviewRequestInfo/index.jsx
+++ b/src/applications/vaos/new-appointment/components/ReviewPage/ReviewRequestInfo/index.jsx
@@ -1,10 +1,9 @@
import React from 'react';
import PropTypes from 'prop-types';
-import { FACILITY_TYPES, FLOW_TYPES } from '../../../../utils/constants';
+import { FACILITY_TYPES } from '../../../../utils/constants';
import TypeOfAppointmentSection from './TypeOfAppointmentSection';
import VAAppointmentSection from './VAAppointmentSection';
import CommunityCareSection from './CommunityCareSection/CommunityCareSection';
-import Description from './ReviewDirectScheduleInfo/Description';
export default function ReviewRequestInfo({
data,
@@ -18,8 +17,7 @@ export default function ReviewRequestInfo({
return (
{pageTitle}
-
-
+
{isCommunityCare && (
{
+describe('VAOS Page: ReviewPage direct scheduling', () => {
let store;
let start;
@@ -116,36 +116,43 @@ describe('VAOS Page: ReviewPage direct scheduling with v2 api', () => {
store,
});
- await screen.findByText(/scheduling a primary care appointment/i);
+ await screen.findByText('Primary care');
expect(screen.getByText('Primary care')).to.have.tagName('span');
const [
pageHeading,
- descHeading,
typeOfCareHeading,
+ facilityHeading,
dateHeading,
- clinicHeading,
reasonHeading,
contactHeading,
] = screen.getAllByRole('heading');
- expect(pageHeading).to.contain.text('Review your appointment details');
- expect(descHeading).to.contain.text(
- 'scheduling a primary care appointment',
+ expect(pageHeading).to.contain.text(
+ 'Review and confirm your appointment details',
);
- expect(typeOfCareHeading).to.contain.text('VA Appointment');
+ expect(typeOfCareHeading).to.contain.text('Type of care');
expect(screen.baseElement).to.contain.text('Primary care');
- expect(dateHeading).to.contain.text(
- start.tz('America/Denver').format('dddd, MMMM D, YYYY [at] h:mm a'),
- );
-
- expect(clinicHeading).to.contain.text('Some VA clinic');
+ expect(facilityHeading).to.contain.text('Facility');
expect(screen.baseElement).to.contain.text('Cheyenne VA Medical Center');
+ expect(screen.baseElement).to.contain.text('Cheyenne, WyomingWY');
+ expect(screen.baseElement).to.contain.text('Clinic: Some VA clinic');
+
+ expect(dateHeading).to.contain.text('Date and time');
+ expect(screen.baseElement).to.contain.text(
+ start.tz('America/Denver').format('dddd, MMMM D, YYYY'),
+ );
+ expect(screen.baseElement).to.contain.text(
+ start.tz('America/Denver').format('h:mm a'),
+ );
- expect(reasonHeading).to.contain.text('Routine/Follow-up');
+ expect(reasonHeading).to.contain.text(
+ 'Details you’d like to share with your provider',
+ );
+ expect(screen.baseElement).to.contain.text('Routine/Follow-up');
expect(screen.baseElement).to.contain.text('I need an appt');
- expect(contactHeading).to.contain.text('Your contact details');
- expect(screen.baseElement).to.contain.text('joeblow@gmail.com');
+ expect(contactHeading).to.contain.text('Your contact information');
+ expect(screen.baseElement).to.contain.text('Email: joeblow@gmail.com');
expect(screen.getByTestId('patient-telephone')).to.exist;
expect(screen.baseElement).to.not.contain.text(
'Call anytime during the day',
@@ -172,7 +179,7 @@ describe('VAOS Page: ReviewPage direct scheduling with v2 api', () => {
store,
});
- await screen.findByText(/scheduling a primary care appointment/i);
+ await screen.findByText('Primary care');
userEvent.click(screen.getByText(/Confirm appointment/i));
await waitFor(() => {
@@ -214,7 +221,7 @@ describe('VAOS Page: ReviewPage direct scheduling with v2 api', () => {
store,
});
- await screen.findByText(/scheduling a primary care appointment/i);
+ await screen.findByText('Primary care');
userEvent.click(screen.getByText(/Confirm appointment/i));
@@ -259,7 +266,7 @@ describe('VAOS Page: ReviewPage direct scheduling with v2 api', () => {
store,
});
- await screen.findByText(/scheduling a primary care appointment/i);
+ await screen.findByText('Primary care');
userEvent.click(screen.getByText(/Confirm appointment/i));
@@ -298,7 +305,7 @@ describe('VAOS Page: ReviewPage direct scheduling with v2 api', () => {
store,
});
- await screen.findByText(/scheduling a primary care appointment/i);
+ await screen.findByText('Primary care');
userEvent.click(screen.getByText(/Confirm appointment/i));
@@ -337,7 +344,7 @@ describe('VAOS Page: ReviewPage direct scheduling with v2 api', () => {
store,
});
- await screen.findByText(/scheduling a primary care appointment/i);
+ await screen.findByText('Primary care');
userEvent.click(screen.getByText(/Confirm appointment/i));
diff --git a/src/applications/vaos/new-appointment/newAppointmentFlow.js b/src/applications/vaos/new-appointment/newAppointmentFlow.js
index 0ed089541a73..ff7546089f95 100644
--- a/src/applications/vaos/new-appointment/newAppointmentFlow.js
+++ b/src/applications/vaos/new-appointment/newAppointmentFlow.js
@@ -317,7 +317,7 @@ const flow = {
},
review: {
url: '/new-appointment/review',
- label: 'Review your appointment details',
+ label: 'Review and confirm your appointment details',
},
};
@@ -416,7 +416,7 @@ export default function getNewAppointmentFlow(state) {
...flow.review,
label:
FLOW_TYPES.DIRECT === flowType
- ? 'Review your appointment details'
+ ? 'Review and confirm your appointment details'
: 'Review and submit your request',
url: featureBreadcrumbUrlUpdate ? 'review' : '/new-appointment/review',
},
diff --git a/src/applications/vaos/new-appointment/redux/actions.js b/src/applications/vaos/new-appointment/redux/actions.js
index 68e31d45d931..aa4abf2ce044 100644
--- a/src/applications/vaos/new-appointment/redux/actions.js
+++ b/src/applications/vaos/new-appointment/redux/actions.js
@@ -43,7 +43,7 @@ import {
transformFormToVAOSAppointment,
transformFormToVAOSCCRequest,
transformFormToVAOSVARequest,
-} from './helpers/formSubmitTransformers.v2';
+} from './helpers/formSubmitTransformers';
import {
resetDataLayer,
recordItemsRetrieved,
diff --git a/src/applications/vaos/new-appointment/redux/helpers/formSubmitTransformers.js b/src/applications/vaos/new-appointment/redux/helpers/formSubmitTransformers.js
index 374b48fbe12b..4de0467d499b 100644
--- a/src/applications/vaos/new-appointment/redux/helpers/formSubmitTransformers.js
+++ b/src/applications/vaos/new-appointment/redux/helpers/formSubmitTransformers.js
@@ -1,238 +1,167 @@
-import moment from 'moment';
-import environment from '@department-of-veterans-affairs/platform-utilities/environment';
import titleCase from 'platform/utilities/data/titleCase';
import { selectVAPResidentialAddress } from 'platform/user/selectors';
-import { getTimezoneByFacilityId } from '../../../utils/timezone';
-import {
- PURPOSE_TEXT_V2,
- TYPE_OF_VISIT,
- LANGUAGES,
-} from '../../../utils/constants';
+import moment from '../../../lib/moment-tz';
+import { LANGUAGES } from '../../../utils/constants';
import {
getTypeOfCare,
getFormData,
- getChosenClinicInfo,
- getChosenFacilityInfo,
- getSiteIdForChosenFacility,
getChosenCCSystemById,
+ getChosenClinicInfo,
getChosenSlot,
} from '../selectors';
-import { getClinicId, getSiteCode } from '../../../services/healthcare-service';
-
-const CC_PURPOSE = 'other';
-
-function getUserMessage(data) {
- const label = PURPOSE_TEXT_V2.find(
- purpose => purpose.id === data.reasonForAppointment,
- ).short;
-
- return `${label}: ${data.reasonAdditionalInfo}`;
-}
-
-function getTestFacilityName(id, name) {
- if (!environment.isProduction() && id.startsWith('983')) {
- return `CHYSHR-${name}`;
- }
-
- if (!environment.isProduction() && id.startsWith('984')) {
- // The extra space here is intentional, that appears to be how it is named
- // in CDW
- return `DAYTSHR -${name}`;
- }
-
- return name;
-}
-
-function getRequestedDates(data) {
- return data.selectedDates.reduce(
- (acc, date, index) => ({
- ...acc,
- [`optionDate${index + 1}`]: moment(date).format('MM/DD/YYYY'),
- [`optionTime${index + 1}`]: moment(date).hour() >= 12 ? 'PM' : 'AM',
- }),
- {
- optionDate1: 'No Date Selected',
- optionDate2: 'No Date Selected',
- optionDate3: 'No Date Selected',
- optionTime1: 'No Time Selected',
- optionTime2: 'No Time Selected',
- optionTime3: 'No Time Selected',
- },
- );
-}
-
-export function transformFormToVARequest(state) {
- const facility = getChosenFacilityInfo(state);
- const data = getFormData(state);
- const typeOfCare = getTypeOfCare(data);
- const siteId = getSiteIdForChosenFacility(state);
- const facilityId = facility.id;
- const facilityName = getTestFacilityName(facilityId, facility.name);
-
- return {
- typeOfCare: typeOfCare.id,
- typeOfCareId: typeOfCare.id,
- appointmentType: typeOfCare.name,
- facility: {
- name: facilityName,
- facilityCode: facilityId,
- parentSiteCode: siteId,
- },
- purposeOfVisit: PURPOSE_TEXT_V2.find(
- purpose => purpose.id === data.reasonForAppointment,
- )?.serviceName,
- otherPurposeOfVisit:
- data.reasonForAppointment === 'other'
- ? 'See additional information'
- : null,
- visitType: TYPE_OF_VISIT.find(type => type.id === data.visitType)
- ?.serviceName,
- phoneNumber: data.phoneNumber,
- verifyPhoneNumber: data.phoneNumber,
- ...getRequestedDates(data),
- // The bad camel casing here is intentional, to match downstream
- // system
- bestTimetoCall: Object.entries(data.bestTimeToCall)
- .filter(item => item[1])
- .map(item => titleCase(item[0])),
- emailPreferences: {
- emailAddress: data.email,
- // defaulted values
- notificationFrequency: 'Each new message',
- emailAllowed: true,
- textMsgAllowed: false,
- textMsgPhNumber: '',
- },
- email: data.email,
- // defaulted values
- status: 'Submitted',
- schedulingMethod: 'clerk',
- requestedPhoneCall: false,
- providerId: '0',
- providerOption: '',
- };
-}
+import { getClinicId } from '../../../services/healthcare-service';
+import { getTimezoneByFacilityId } from '../../../utils/timezone';
+import { getReasonCode } from './getReasonCode';
-export function transformFormToCCRequest(state) {
+export function transformFormToVAOSCCRequest(state) {
const data = getFormData(state);
const provider = data.communityCareProvider;
- let preferredProviders = [];
+ const residentialAddress = selectVAPResidentialAddress(state);
+ const parentFacility = getChosenCCSystemById(state);
+ let practitioners = [];
- if (
- !!data.communityCareProvider &&
- Object.keys(data.communityCareProvider).length
- ) {
- preferredProviders = [
+ if (provider?.identifier) {
+ practitioners = [
{
+ identifier: [
+ {
+ system: 'http://hl7.org/fhir/sid/us-npi',
+ value: data.communityCareProvider.identifier.find(
+ item => item.system === 'PPMS',
+ )?.value,
+ },
+ ],
address: {
- street: provider.address.line.join(', '),
+ line: provider.address.line,
city: provider.address.city,
state: provider.address.state,
- zipCode: provider.address.postalCode,
+ postalCode: provider.address.postalCode,
},
- practiceName: provider.name,
},
];
}
- const residentialAddress = selectVAPResidentialAddress(state);
- const organization = getChosenCCSystemById(state);
- let cityState;
+ let preferredLocation;
if (
residentialAddress &&
- residentialAddress.addressType !== 'MILITARY OVERSEAS'
+ residentialAddress.addressType !== 'OVERSEAS MILITARY'
) {
- cityState = {
- preferredCity: residentialAddress.city,
- preferredState: residentialAddress.stateCode,
+ preferredLocation = {
+ city: residentialAddress.city,
+ state: residentialAddress.stateCode,
};
- } else {
- cityState = {
- preferredCity: organization.address?.city,
- preferredState: organization.address?.state,
+ } else if (parentFacility.address) {
+ preferredLocation = {
+ city: parentFacility.address.city,
+ state: parentFacility.address.state,
};
}
const typeOfCare = getTypeOfCare(data);
-
+ const facilityTimezone = getTimezoneByFacilityId(data.communityCareSystemId);
return {
- typeOfCare: typeOfCare.ccId,
- typeOfCareId: typeOfCare.ccId,
- appointmentType: typeOfCare.name,
- facility: {
- name: organization.name,
- facilityCode: organization.id,
- parentSiteCode: organization.vistaId,
+ kind: 'cc',
+ status: 'proposed',
+ locationId: data.communityCareSystemId,
+ serviceType: typeOfCare.idV2 || typeOfCare.ccId,
+ // comment: data.reasonAdditionalInfo,
+ reasonCode: getReasonCode({
+ data,
+ isCC: true,
+ isDS: false,
+ }),
+ contact: {
+ telecom: [
+ {
+ type: 'phone',
+ value: data.phoneNumber,
+ },
+ {
+ type: 'email',
+ value: data.email,
+ },
+ ],
},
- purposeOfVisit: CC_PURPOSE,
- phoneNumber: data.phoneNumber,
- verifyPhoneNumber: data.phoneNumber,
- // The bad camel casing here is intentional, to match downstream
- // system
- bestTimetoCall: Object.entries(data.bestTimeToCall)
+ requestedPeriods: data.selectedDates.map(date => ({
+ start: moment
+ .tz(date, facilityTimezone)
+ .utc()
+ .format(),
+ end: moment
+ .tz(date, facilityTimezone)
+ .utc()
+ .add(12, 'hours')
+ .subtract(1, 'minute')
+ .format(),
+ })),
+ // These four fields aren't in the current schema, but probably should be
+ preferredTimesForPhoneCall: Object.entries(data.bestTimeToCall || {})
.filter(item => item[1])
.map(item => titleCase(item[0])),
- preferredProviders,
- newMessage: data.reasonAdditionalInfo,
preferredLanguage: LANGUAGES.find(
lang => lang.id === data.preferredLanguage,
)?.value,
- ...getRequestedDates(data),
- ...cityState,
- // defaulted values
- visitType: 'Office Visit',
- requestedPhoneCall: false,
- email: data.email,
- officeHours: [],
- reasonForVisit: '',
- distanceWillingToTravel: 40,
- secondRequest: false,
- secondRequestSubmitted: false,
- inpatient: false,
- status: 'Submitted',
- providerId: '0',
- providerOption: '',
+ preferredLocation,
+ practitioners,
};
}
-export function transformFormToAppointment(state) {
+export function transformFormToVAOSVARequest(state) {
const data = getFormData(state);
- const clinic = getChosenClinicInfo(state);
- const timezone = getTimezoneByFacilityId(data.vaFacility);
+ const typeOfCare = getTypeOfCare(data);
+ return {
+ kind: data.visitType,
+ status: 'proposed',
+ locationId: data.vaFacility,
+ // This may need to change when we get the new service type ids
+ serviceType: typeOfCare.idV2,
+ reasonCode: getReasonCode({
+ data,
+ isCC: false,
+ isDS: false,
+ }),
+ // comment: data.reasonAdditionalInfo,
+ requestedPeriods: [
+ {
+ start: moment.utc(data.selectedDates[0]).format(),
+ end: moment
+ .utc(data.selectedDates[0])
+ .add(12, 'hours')
+ .subtract(1, 'minute')
+ .format(),
+ },
+ ],
+ // This field isn't in the schema yet
+ preferredTimesForPhoneCall: Object.entries(data.bestTimeToCall || {})
+ .filter(item => item[1])
+ .map(item => titleCase(item[0])),
+ };
+}
+
+export function transformFormToVAOSAppointment(state) {
+ const data = getFormData(state);
+ const clinic = getChosenClinicInfo(state);
const slot = getChosenSlot(state);
- const purpose = getUserMessage(data);
- const appointmentLength = moment(slot.end).diff(slot.start, 'minutes');
+
+ // slot start and end times are not allowed on a booked va appointment.
+ delete slot.start;
+ delete slot.end;
+
return {
- appointmentType: getTypeOfCare(data).name,
- clinic: {
- siteCode: getSiteCode(clinic),
- clinicId: getClinicId(clinic),
- clinicName: clinic.serviceName,
- clinicFriendlyLocationName: clinic.serviceName,
- institutionName: clinic.stationName,
- institutionCode: clinic.stationId,
+ kind: 'clinic',
+ status: 'booked',
+ clinic: getClinicId(clinic),
+ slot,
+ extension: {
+ desiredDate: `${data.preferredDate}T00:00:00+00:00`,
},
-
- // These times are a lie, they're actually in local time, but the upstream
- // service expects the 0 offset.
- desiredDate: `${data.preferredDate}T00:00:00+00:00`,
- dateTime: `${slot.start}+00:00`,
- duration: appointmentLength,
- bookingNotes: purpose,
- preferredEmail: data.email,
- timeZone: timezone,
- // defaulted values
- apptType: 'P',
- purpose: '9',
- lvl: '1',
- ekg: '',
- lab: '',
- xRay: '',
- schedulingRequestType: 'NEXT_AVAILABLE_APPT',
- type: 'REGULAR',
- appointmentKind: 'TRADITIONAL',
- schedulingMethod: 'direct',
+ locationId: data.vaFacility,
+ reasonCode: getReasonCode({
+ data,
+ isCC: false,
+ isDS: true,
+ }),
};
}
diff --git a/src/applications/vaos/new-appointment/redux/helpers/formSubmitTransformers.unit.spec.js b/src/applications/vaos/new-appointment/redux/helpers/formSubmitTransformers.unit.spec.js
index 50dd9eaa328e..0fd36480ec83 100644
--- a/src/applications/vaos/new-appointment/redux/helpers/formSubmitTransformers.unit.spec.js
+++ b/src/applications/vaos/new-appointment/redux/helpers/formSubmitTransformers.unit.spec.js
@@ -1,490 +1,154 @@
import { expect } from 'chai';
import {
- transformFormToCCRequest,
- transformFormToVARequest,
- transformFormToAppointment,
+ transformFormToVAOSAppointment,
+ transformFormToVAOSVARequest,
} from './formSubmitTransformers';
-import {
- FETCH_STATUS,
- FLOW_TYPES,
- VHA_FHIR_ID,
-} from '../../../utils/constants';
+import { FLOW_TYPES, VHA_FHIR_ID } from '../../../utils/constants';
+import { getReasonCode } from './getReasonCode';
-describe('VAOS data transformation', () => {
- it('should transform form into VA request', () => {
- const state = {
- newAppointment: {
- data: {
- phoneNumber: '5035551234',
- bestTimeToCall: {
- morning: true,
- },
- email: 'test@va.gov',
- visitType: 'clinic',
- reasonForAppointment: 'other',
- reasonAdditionalInfo: 'Testing',
- selectedDates: ['2019-11-20T12:00:00.000'],
- vaParent: '983A6',
- vaFacility: '983GB',
- facilityType: 'vamc',
- typeOfCareId: '323',
- },
- parentFacilities: [
- {
- id: '983A6',
- identifier: [
- {
- system: VHA_FHIR_ID,
- value: '983A6',
- },
- ],
- partOf: {
- reference: 'Organization/983',
+describe('VAOS V2 data transformation', () => {
+ describe('VA booked', () => {
+ it('remove slot.start and slot.end from new appointment object', () => {
+ const state = {
+ user: {
+ profile: {
+ vapContactInfo: {},
+ },
+ },
+ newAppointment: {
+ data: {
+ phoneNumber: '5035551234',
+ bestTimeToCall: {
+ morning: true,
+ },
+ email: 'test@va.gov',
+ reasonForAppointment: 'routine-follow-up',
+ reasonAdditionalInfo: 'asdfasdf',
+ selectedDates: ['2019-11-22T09:30:00'],
+ preferredDate: '2019-12-02',
+ clinicId: '983_308',
+ vaParent: '983',
+ vaFacility: '983',
+ facilityType: 'vamc',
+ typeOfCareId: '323',
+ },
+ availableSlots: [
+ {
+ start: '2019-12-22T09:30:00',
+ end: '2019-12-22T10:00:00',
},
- },
- ],
- facilities: {
- '323': [
{
- id: '983GB',
+ start: '2019-11-22T09:30:00',
+ end: '2019-11-22T10:00:00',
+ },
+ ],
+ parentFacilities: [
+ {
+ id: '983',
identifier: [
{
system: VHA_FHIR_ID,
- value: '983GB',
+ value: '983',
},
],
- name: 'Cheyenne VA Medical Center',
address: {
city: 'Cheyenne',
state: 'WY',
},
- legacyVAR: {
- institutionTimezone: 'America/Denver',
- },
},
],
- },
- flowType: FLOW_TYPES.REQUEST,
- },
- featureToggles: {},
- };
- const data = transformFormToVARequest(state);
- expect(data).to.deep.equal({
- typeOfCare: '323',
- typeOfCareId: '323',
- appointmentType: 'Primary care',
- status: 'Submitted',
- facility: {
- name: 'CHYSHR-Cheyenne VA Medical Center',
- facilityCode: '983GB',
- parentSiteCode: '983',
- },
- purposeOfVisit: 'Other',
- otherPurposeOfVisit: 'See additional information',
- visitType: 'Office Visit',
- phoneNumber: '5035551234',
- verifyPhoneNumber: '5035551234',
- optionDate1: '11/20/2019',
- optionDate2: 'No Date Selected',
- optionDate3: 'No Date Selected',
- optionTime1: 'PM',
- optionTime2: 'No Time Selected',
- optionTime3: 'No Time Selected',
- bestTimetoCall: ['Morning'],
- emailPreferences: {
- emailAddress: 'test@va.gov',
- notificationFrequency: 'Each new message',
- emailAllowed: true,
- textMsgAllowed: false,
- textMsgPhNumber: '',
- },
- email: 'test@va.gov',
- schedulingMethod: 'clerk',
- requestedPhoneCall: false,
- providerId: '0',
- providerOption: '',
- });
- });
- it('should transform form for Sleep Care into VA request', () => {
- const state = {
- newAppointment: {
- data: {
- phoneNumber: '5035551234',
- bestTimeToCall: {
- morning: true,
- },
- email: 'test@va.gov',
- visitType: 'clinic',
- reasonForAppointment: 'routine-follow-up',
- reasonAdditionalInfo: 'Testing',
- selectedDates: ['2019-11-20T12:00:00.000'],
- vaParent: '983',
- vaFacility: '983GB',
- facilityType: 'vamc',
- typeOfCareId: 'SLEEP',
- typeOfSleepCareId: '349',
- },
- parentFacilities: [
- {
- id: '983',
- identifier: [
+ facilities: {
+ '323': [
{
- system: VHA_FHIR_ID,
- value: '983',
+ id: '983',
+ identifier: [
+ {
+ system: VHA_FHIR_ID,
+ value: '983',
+ },
+ ],
+ name: 'Cheyenne VA Medical Center',
+ address: {
+ city: 'Cheyenne',
+ state: 'WY',
+ },
+ legacyVAR: {
+ institutionTimezone: 'America/Denver',
+ },
},
],
},
- ],
- facilities: {
- '349': [
- {
- id: '983GB',
- identifier: [
- {
- system: VHA_FHIR_ID,
- value: '983GB',
- },
- ],
- name: 'Cheyenne VA Medical Center',
- address: {
- city: 'Cheyenne',
- state: 'WY',
- },
- legacyVAR: {
- institutionTimezone: 'America/Denver',
+ clinics: {
+ '983_323': [
+ {
+ id: '983_308',
+ serviceName: 'Green Team Clinic1',
+ stationId: '983',
+ stationName: 'CHYSHR-Cheyenne VA Medical Center',
},
- },
- ],
- },
- flowType: FLOW_TYPES.REQUEST,
- },
- featureToggles: {},
- };
- const data = transformFormToVARequest(state);
- expect(data).to.deep.equal({
- typeOfCare: '349',
- typeOfCareId: '349',
- appointmentType: 'Continuous Positive Airway Pressure (CPAP)',
- status: 'Submitted',
- facility: {
- name: 'CHYSHR-Cheyenne VA Medical Center',
- facilityCode: '983GB',
- parentSiteCode: '983',
- },
- purposeOfVisit: 'Routine Follow-up',
- otherPurposeOfVisit: null,
- visitType: 'Office Visit',
- phoneNumber: '5035551234',
- verifyPhoneNumber: '5035551234',
- optionDate1: '11/20/2019',
- optionDate2: 'No Date Selected',
- optionDate3: 'No Date Selected',
- optionTime1: 'PM',
- optionTime2: 'No Time Selected',
- optionTime3: 'No Time Selected',
- bestTimetoCall: ['Morning'],
- emailPreferences: {
- emailAddress: 'test@va.gov',
- notificationFrequency: 'Each new message',
- emailAllowed: true,
- textMsgAllowed: false,
- textMsgPhNumber: '',
- },
- email: 'test@va.gov',
- schedulingMethod: 'clerk',
- requestedPhoneCall: false,
- providerId: '0',
- providerOption: '',
- });
- });
-
- it('should transform form into CC request', () => {
- const state = {
- user: {
- profile: {
- vapContactInfo: {},
- },
- },
- newAppointment: {
- data: {
- phoneNumber: '5035551234',
- bestTimeToCall: {
- afternoon: true,
- },
- email: 'test@va.gov',
- reasonForAppointment: 'routine-follow-up',
- reasonAdditionalInfo: 'asdf',
- communityCareSystemId: '983',
- preferredLanguage: 'english',
- hasCommunityCareProvider: true,
- communityCareProvider: {
- firstName: 'asdf',
- lastName: 'asdf',
- name: 'Practice',
- address: {
- line: ['456 elm st', 'sfasdf'],
- state: 'MA',
- city: 'northampton',
- postalCode: '01050',
- },
- phone: '2342444444',
- },
- selectedDates: ['2019-11-20T12:00:00.000'],
- facilityType: 'communityCare',
- typeOfCareId: '323',
- },
- facilities: {},
- facilityDetails: {},
- clinics: {},
- eligibility: {},
- ccEnabledSystems: [
- {
- id: '983',
- vistaId: '983',
- name: 'CHYSHR-Cheyenne VA Medical Center',
- address: {
- city: 'Cheyenne',
- state: 'WY',
- },
- },
- {
- id: '984',
- vistaId: '984',
- address: {
- city: 'Dayton',
- state: 'OH',
- },
- },
- ],
- pageChangeInProgress: false,
- parentFacilitiesStatus: FETCH_STATUS.succeeded,
- eligibilityStatus: FETCH_STATUS.succeeded,
- facilityDetailsStatus: FETCH_STATUS.succeeded,
- pastAppointments: null,
- submitStatus: 'succeeded',
- },
- featureToggles: {},
- };
- const data = transformFormToCCRequest(state);
- expect(data).to.deep.equal({
- typeOfCare: 'CCPRMYRTNE',
- typeOfCareId: 'CCPRMYRTNE',
- appointmentType: 'Primary care',
- facility: {
- name: 'CHYSHR-Cheyenne VA Medical Center',
- facilityCode: '983',
- parentSiteCode: '983',
- },
- purposeOfVisit: 'other',
- phoneNumber: '5035551234',
- verifyPhoneNumber: '5035551234',
- bestTimetoCall: ['Afternoon'],
- preferredProviders: [
- {
- address: {
- street: '456 elm st, sfasdf',
- city: 'northampton',
- state: 'MA',
- zipCode: '01050',
+ ],
},
- practiceName: 'Practice',
},
- ],
- newMessage: 'asdf',
- preferredLanguage: 'English',
- optionDate1: '11/20/2019',
- optionDate2: 'No Date Selected',
- optionDate3: 'No Date Selected',
- optionTime1: 'PM',
- optionTime2: 'No Time Selected',
- optionTime3: 'No Time Selected',
- preferredCity: 'Cheyenne',
- preferredState: 'WY',
- requestedPhoneCall: false,
- email: 'test@va.gov',
- officeHours: [],
- reasonForVisit: '',
- visitType: 'Office Visit',
- distanceWillingToTravel: 40,
- secondRequest: false,
- secondRequestSubmitted: false,
- inpatient: false,
- status: 'Submitted',
- providerId: '0',
- providerOption: '',
- });
- });
+ };
- it('should transform audiology form into audiology CC request', () => {
- const state = {
- user: {
- profile: {
- vapContactInfo: {},
- },
- },
- newAppointment: {
- data: {
- phoneNumber: '5035551234',
- bestTimeToCall: {
- afternoon: true,
- },
- email: 'test@va.gov',
- reasonForAppointment: 'routine-follow-up',
- reasonAdditionalInfo: 'asdf',
- communityCareSystemId: '983',
- preferredLanguage: 'english',
- hasCommunityCareProvider: true,
- communityCareProvider: {
- firstName: 'asdf',
- lastName: 'asdf',
- name: 'Practice',
- address: {
- line: ['456 elm st', 'sfasdf'],
- state: 'MA',
- city: 'northampton',
- postalCode: '01050',
- },
- phone: '2342444444',
- },
- selectedDates: ['2019-11-20T12:00:00.000'],
- facilityType: 'communityCare',
- typeOfCareId: '203',
- audiologyType: 'CCAUDHEAR',
- },
- facilities: {},
- facilityDetails: {},
- clinics: {},
- eligibility: {},
- ccEnabledSystems: [
- {
- id: '983',
- vistaId: '983',
- name: 'CHYSHR-Cheyenne VA Medical Center',
- address: {
- city: 'Cheyenne',
- state: 'WY',
- },
- },
- {
- id: '984',
- vistaId: '984',
- address: {
- city: 'Dayton',
- state: 'OH',
- },
- },
- ],
- pageChangeInProgress: false,
- parentFacilitiesStatus: FETCH_STATUS.succeeded,
- eligibilityStatus: FETCH_STATUS.succeeded,
- facilityDetailsStatus: FETCH_STATUS.succeeded,
- pastAppointments: null,
- submitStatus: 'succeeded',
- },
- featureToggles: {},
- };
- const data = transformFormToCCRequest(state);
- expect(data).to.deep.equal({
- typeOfCare: 'CCAUDHEAR',
- typeOfCareId: 'CCAUDHEAR',
- appointmentType: 'Hearing aid support',
- facility: {
- name: 'CHYSHR-Cheyenne VA Medical Center',
- facilityCode: '983',
- parentSiteCode: '983',
- },
- purposeOfVisit: 'other',
- phoneNumber: '5035551234',
- verifyPhoneNumber: '5035551234',
- bestTimetoCall: ['Afternoon'],
- preferredProviders: [
- {
- address: {
- street: '456 elm st, sfasdf',
- city: 'northampton',
- state: 'MA',
- zipCode: '01050',
- },
- practiceName: 'Practice',
+ // when the reason text is combined with appointment information
+ const reasonTextTransformed = getReasonCode({
+ data: state.newAppointment.data,
+ isCC: false,
+ isDS: true,
+ });
+
+ const stateWithSlotId = {
+ ...state,
+ newAppointment: {
+ ...state.newAppointment,
+ availableSlots: [
+ { ...state.newAppointment.availableSlots[0], id: 'test' },
+ { ...state.newAppointment.availableSlots[1], id: 'test2' },
+ ],
},
- ],
- newMessage: 'asdf',
- preferredLanguage: 'English',
- optionDate1: '11/20/2019',
- optionDate2: 'No Date Selected',
- optionDate3: 'No Date Selected',
- optionTime1: 'PM',
- optionTime2: 'No Time Selected',
- optionTime3: 'No Time Selected',
- preferredCity: 'Cheyenne',
- preferredState: 'WY',
- requestedPhoneCall: false,
- email: 'test@va.gov',
- officeHours: [],
- reasonForVisit: '',
- visitType: 'Office Visit',
- distanceWillingToTravel: 40,
- secondRequest: false,
- secondRequestSubmitted: false,
- inpatient: false,
- status: 'Submitted',
- providerId: '0',
- providerOption: '',
+ };
+
+ const data = transformFormToVAOSAppointment(stateWithSlotId);
+ expect(data).to.deep.equal({
+ kind: 'clinic',
+ status: 'booked',
+ clinic: '308',
+ slot: {
+ id: 'test2',
+ },
+ extension: { desiredDate: '2019-12-02T00:00:00+00:00' },
+ locationId: '983',
+ reasonCode: reasonTextTransformed,
+ });
});
});
- it('should transform form into VA appointment', () => {
- const state = {
- user: {
- profile: {
- vapContactInfo: {},
- },
- },
- newAppointment: {
- data: {
- phoneNumber: '5035551234',
- bestTimeToCall: {
- morning: true,
- },
- email: 'test@va.gov',
- reasonForAppointment: 'routine-follow-up',
- reasonAdditionalInfo: 'asdfasdf',
- selectedDates: ['2019-11-22T09:30:00'],
- preferredDate: '2019-12-02',
- clinicId: '983_308',
- vaParent: '983',
- vaFacility: '983',
- facilityType: 'vamc',
- typeOfCareId: '323',
- },
- availableSlots: [
- {
- start: '2019-12-22T09:30:00',
- end: '2019-12-22T10:00:00',
- },
- {
- start: '2019-11-22T09:30:00',
- end: '2019-11-22T10:00:00',
- },
- ],
- parentFacilities: [
- {
- id: '983',
- identifier: [
- {
- system: VHA_FHIR_ID,
- value: '983',
- },
- ],
- address: {
- city: 'Cheyenne',
- state: 'WY',
- },
- },
- ],
- facilities: {
- '323': [
+ describe('VA request', () => {
+ it('request body is valid', () => {
+ const superLongText =
+ 'The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog.';
+ // Given the VA request is submitted
+ const state = {
+ newAppointment: {
+ data: {
+ phoneNumber: '5035551234',
+ bestTimeToCall: {
+ morning: true,
+ },
+ email: 'test@va.gov',
+ visitType: 'clinic',
+ reasonForAppointment: 'other',
+ reasonAdditionalInfo: superLongText,
+ selectedDates: ['2019-11-20T12:00:00.000'],
+ vaParent: '983',
+ vaFacility: '983GB',
+ facilityType: 'vamc',
+ typeOfCareId: 'SLEEP',
+ typeOfSleepCareId: '349',
+ },
+ parentFacilities: [
{
id: '983',
identifier: [
@@ -493,391 +157,52 @@ describe('VAOS data transformation', () => {
value: '983',
},
],
- name: 'Cheyenne VA Medical Center',
- address: {
- city: 'Cheyenne',
- state: 'WY',
- },
- legacyVAR: {
- institutionTimezone: 'America/Denver',
- },
},
],
- },
- clinics: {
- '983_323': [
- {
- id: '983_308',
- serviceName: 'Green Team Clinic1',
- stationId: '983',
- stationName: 'CHYSHR-Cheyenne VA Medical Center',
- },
- ],
- },
- },
- featureToggles: {},
- };
- const data = transformFormToAppointment(state);
- expect(data).to.deep.equal({
- clinic: {
- siteCode: '983',
- clinicId: '308',
- clinicName: 'Green Team Clinic1',
- clinicFriendlyLocationName: 'Green Team Clinic1',
- institutionName: 'CHYSHR-Cheyenne VA Medical Center',
- institutionCode: '983',
- },
- desiredDate: '2019-12-02T00:00:00+00:00',
- dateTime: '2019-11-22T09:30:00+00:00',
- duration: 30,
- bookingNotes: 'Routine/Follow-up: asdfasdf',
- preferredEmail: 'test@va.gov',
- timeZone: 'America/Denver',
- apptType: 'P',
- purpose: '9',
- lvl: '1',
- ekg: '',
- lab: '',
- xRay: '',
- schedulingRequestType: 'NEXT_AVAILABLE_APPT',
- type: 'REGULAR',
- appointmentKind: 'TRADITIONAL',
- appointmentType: 'Primary care',
- schedulingMethod: 'direct',
- });
- });
-
- it('should transform form for Eye Care into VA request', () => {
- const state = {
- newAppointment: {
- data: {
- phoneNumber: '5035551234',
- bestTimeToCall: {
- morning: true,
- },
- email: 'test@va.gov',
- visitType: 'clinic',
- reasonForAppointment: 'routine-follow-up',
- reasonAdditionalInfo: 'Testing',
- selectedDates: ['2019-11-20T12:00:00.000'],
- vaParent: '983',
- vaFacility: '983GB',
- facilityType: 'vamc',
- typeOfCareId: 'EYE',
- typeOfEyeCareId: '407',
- },
- parentFacilities: [
- {
- id: '983',
- identifier: [
+ facilities: {
+ '349': [
{
- system: VHA_FHIR_ID,
- value: '983',
- },
- ],
- },
- ],
- facilities: {
- '407': [
- {
- id: '983GB',
- identifier: [
- {
- system: VHA_FHIR_ID,
- value: '983GB',
+ id: '983GB',
+ identifier: [
+ {
+ system: VHA_FHIR_ID,
+ value: '983GB',
+ },
+ ],
+ name: 'Cheyenne VA Medical Center',
+ address: {
+ city: 'Cheyenne',
+ state: 'WY',
+ },
+ legacyVAR: {
+ institutionTimezone: 'America/Denver',
},
- ],
- name: 'Cheyenne VA Medical Center',
- address: {
- city: 'Cheyenne',
- state: 'WY',
- },
- legacyVAR: {
- institutionTimezone: 'America/Denver',
},
- },
- ],
- },
- flowType: FLOW_TYPES.REQUEST,
- },
- featureToggles: {},
- };
- const data = transformFormToVARequest(state);
- expect(data).to.deep.equal({
- typeOfCare: '407',
- typeOfCareId: '407',
- appointmentType: 'Ophthalmology',
- status: 'Submitted',
- facility: {
- name: 'CHYSHR-Cheyenne VA Medical Center',
- facilityCode: '983GB',
- parentSiteCode: '983',
- },
- purposeOfVisit: 'Routine Follow-up',
- otherPurposeOfVisit: null,
- visitType: 'Office Visit',
- phoneNumber: '5035551234',
- verifyPhoneNumber: '5035551234',
- optionDate1: '11/20/2019',
- optionDate2: 'No Date Selected',
- optionDate3: 'No Date Selected',
- optionTime1: 'PM',
- optionTime2: 'No Time Selected',
- optionTime3: 'No Time Selected',
- bestTimetoCall: ['Morning'],
- emailPreferences: {
- emailAddress: 'test@va.gov',
- notificationFrequency: 'Each new message',
- emailAllowed: true,
- textMsgAllowed: false,
- textMsgPhNumber: '',
- },
- email: 'test@va.gov',
- schedulingMethod: 'clerk',
- requestedPhoneCall: false,
- providerId: '0',
- providerOption: '',
- });
- });
-
- it('should transform form using provider selection into CC request', () => {
- const state = {
- user: {
- profile: {
- facilities: [{ facilityId: '983', isCerner: false }],
- vapContactInfo: {
- residentialAddress: {
- addressLine1: '123 big sky st',
- city: 'Cincinnati',
- stateCode: 'OH',
- zipCode: '45220',
- latitude: 39.1,
- longitude: -84.6,
- },
- },
- },
- },
- newAppointment: {
- data: {
- phoneNumber: '5035551234',
- bestTimeToCall: {
- afternoon: true,
- },
- email: 'test@va.gov',
- reasonForAppointment: 'routine-follow-up',
- reasonAdditionalInfo: 'asdf',
- communityCareSystemId: '983',
- preferredLanguage: 'english',
- communityCareProvider: {
- name: 'Practice',
- address: {
- line: ['456 elm st', 'sfasdf'],
- state: 'MA',
- city: 'northampton',
- postalCode: '01050',
- },
- },
- selectedDates: ['2019-11-20T12:00:00.000'],
- facilityType: 'communityCare',
- typeOfCareId: '323',
- },
- facilities: {},
- facilityDetails: {},
- clinics: {},
- eligibility: {},
- ccEnabledSystems: [
- {
- id: '983',
- vistaId: '983',
- name: 'CHYSHR-Cheyenne VA Medical Center',
- address: {
- city: 'Cheyenne',
- state: 'WY',
- },
- },
- {
- id: '984',
- vistaId: '984',
- address: {
- city: 'Dayton',
- state: 'OH',
- },
- },
- ],
- pageChangeInProgress: false,
- parentFacilitiesStatus: FETCH_STATUS.succeeded,
- eligibilityStatus: FETCH_STATUS.succeeded,
- facilityDetailsStatus: FETCH_STATUS.succeeded,
- pastAppointments: null,
- submitStatus: 'succeeded',
- },
- featureToggles: {},
- };
- const data = transformFormToCCRequest(state);
- expect(data).to.deep.equal({
- typeOfCare: 'CCPRMYRTNE',
- typeOfCareId: 'CCPRMYRTNE',
- appointmentType: 'Primary care',
- facility: {
- name: 'CHYSHR-Cheyenne VA Medical Center',
- facilityCode: '983',
- parentSiteCode: '983',
- },
- purposeOfVisit: 'other',
- phoneNumber: '5035551234',
- verifyPhoneNumber: '5035551234',
- bestTimetoCall: ['Afternoon'],
- preferredProviders: [
- {
- address: {
- street: '456 elm st, sfasdf',
- city: 'northampton',
- state: 'MA',
- zipCode: '01050',
+ ],
},
- practiceName: 'Practice',
+ flowType: FLOW_TYPES.REQUEST,
},
- ],
- newMessage: 'asdf',
- preferredLanguage: 'English',
- optionDate1: '11/20/2019',
- optionDate2: 'No Date Selected',
- optionDate3: 'No Date Selected',
- optionTime1: 'PM',
- optionTime2: 'No Time Selected',
- optionTime3: 'No Time Selected',
- preferredCity: 'Cincinnati',
- preferredState: 'OH',
- requestedPhoneCall: false,
- email: 'test@va.gov',
- officeHours: [],
- reasonForVisit: '',
- visitType: 'Office Visit',
- distanceWillingToTravel: 40,
- secondRequest: false,
- secondRequestSubmitted: false,
- inpatient: false,
- status: 'Submitted',
- providerId: '0',
- providerOption: '',
- });
- });
+ };
+ // when the reason text is combined with appointment information
+ const reasonTextTransformed = getReasonCode({
+ data: state.newAppointment.data,
+ isCC: false,
+ isDS: false,
+ });
- it('should transform form using provider selection into CC request when residential address is missing', () => {
- const state = {
- user: {
- profile: {
- facilities: [{ facilityId: '983', isCerner: false }],
- vapContactInfo: {
- residentialAddress: null,
- },
- },
- },
- newAppointment: {
- data: {
- phoneNumber: '5035551234',
- bestTimeToCall: {
- afternoon: true,
- },
- email: 'test@va.gov',
- reasonForAppointment: 'routine-follow-up',
- reasonAdditionalInfo: 'asdf',
- communityCareSystemId: '983',
- preferredLanguage: 'english',
- communityCareProvider: {
- name: 'Practice',
- address: {
- line: ['456 elm st', 'sfasdf'],
- state: 'MA',
- city: 'northampton',
- postalCode: '01050',
- },
- firstName: 'test',
- lastName: 'mctesty',
- },
- selectedDates: ['2019-11-20T12:00:00.000'],
- facilityType: 'communityCare',
- typeOfCareId: '323',
- },
- facilities: {},
- facilityDetails: {},
- clinics: {},
- eligibility: {},
- ccEnabledSystems: [
- {
- id: '983',
- vistaId: '983',
- name: 'CHYSHR-Cheyenne VA Medical Center',
- address: {
- city: 'Cheyenne',
- state: 'WY',
- },
- },
- {
- id: '984',
- vistaId: '984',
- address: {
- city: 'Dayton',
- state: 'OH',
- },
- },
+ const data = transformFormToVAOSVARequest(state);
+ // Then the request body will transform
+ expect(data).to.deep.equal({
+ kind: 'clinic',
+ status: 'proposed',
+ locationId: '983GB',
+ serviceType: 'cpap',
+ reasonCode: reasonTextTransformed,
+ requestedPeriods: [
+ { start: '2019-11-20T12:00:00Z', end: '2019-11-20T23:59:00Z' },
],
- pageChangeInProgress: false,
- parentFacilitiesStatus: FETCH_STATUS.succeeded,
- eligibilityStatus: FETCH_STATUS.succeeded,
- facilityDetailsStatus: FETCH_STATUS.succeeded,
- pastAppointments: null,
- submitStatus: 'succeeded',
- },
- featureToggles: {},
- };
- const data = transformFormToCCRequest(state);
- expect(data).to.deep.equal({
- typeOfCare: 'CCPRMYRTNE',
- typeOfCareId: 'CCPRMYRTNE',
- appointmentType: 'Primary care',
- facility: {
- name: 'CHYSHR-Cheyenne VA Medical Center',
- facilityCode: '983',
- parentSiteCode: '983',
- },
- purposeOfVisit: 'other',
- phoneNumber: '5035551234',
- verifyPhoneNumber: '5035551234',
- bestTimetoCall: ['Afternoon'],
- preferredProviders: [
- {
- address: {
- street: '456 elm st, sfasdf',
- city: 'northampton',
- state: 'MA',
- zipCode: '01050',
- },
- practiceName: 'Practice',
- },
- ],
- newMessage: 'asdf',
- preferredLanguage: 'English',
- optionDate1: '11/20/2019',
- optionDate2: 'No Date Selected',
- optionDate3: 'No Date Selected',
- optionTime1: 'PM',
- optionTime2: 'No Time Selected',
- optionTime3: 'No Time Selected',
- preferredCity: 'Cheyenne',
- preferredState: 'WY',
- requestedPhoneCall: false,
- email: 'test@va.gov',
- officeHours: [],
- reasonForVisit: '',
- visitType: 'Office Visit',
- distanceWillingToTravel: 40,
- secondRequest: false,
- secondRequestSubmitted: false,
- inpatient: false,
- status: 'Submitted',
- providerId: '0',
- providerOption: '',
+ preferredTimesForPhoneCall: ['Morning'],
+ });
});
});
});
diff --git a/src/applications/vaos/new-appointment/redux/helpers/formSubmitTransformers.v2.js b/src/applications/vaos/new-appointment/redux/helpers/formSubmitTransformers.v2.js
deleted file mode 100644
index 4de0467d499b..000000000000
--- a/src/applications/vaos/new-appointment/redux/helpers/formSubmitTransformers.v2.js
+++ /dev/null
@@ -1,167 +0,0 @@
-import titleCase from 'platform/utilities/data/titleCase';
-import { selectVAPResidentialAddress } from 'platform/user/selectors';
-import moment from '../../../lib/moment-tz';
-import { LANGUAGES } from '../../../utils/constants';
-import {
- getTypeOfCare,
- getFormData,
- getChosenCCSystemById,
- getChosenClinicInfo,
- getChosenSlot,
-} from '../selectors';
-import { getClinicId } from '../../../services/healthcare-service';
-import { getTimezoneByFacilityId } from '../../../utils/timezone';
-import { getReasonCode } from './getReasonCode';
-
-export function transformFormToVAOSCCRequest(state) {
- const data = getFormData(state);
- const provider = data.communityCareProvider;
- const residentialAddress = selectVAPResidentialAddress(state);
- const parentFacility = getChosenCCSystemById(state);
- let practitioners = [];
-
- if (provider?.identifier) {
- practitioners = [
- {
- identifier: [
- {
- system: 'http://hl7.org/fhir/sid/us-npi',
- value: data.communityCareProvider.identifier.find(
- item => item.system === 'PPMS',
- )?.value,
- },
- ],
- address: {
- line: provider.address.line,
- city: provider.address.city,
- state: provider.address.state,
- postalCode: provider.address.postalCode,
- },
- },
- ];
- }
-
- let preferredLocation;
-
- if (
- residentialAddress &&
- residentialAddress.addressType !== 'OVERSEAS MILITARY'
- ) {
- preferredLocation = {
- city: residentialAddress.city,
- state: residentialAddress.stateCode,
- };
- } else if (parentFacility.address) {
- preferredLocation = {
- city: parentFacility.address.city,
- state: parentFacility.address.state,
- };
- }
-
- const typeOfCare = getTypeOfCare(data);
- const facilityTimezone = getTimezoneByFacilityId(data.communityCareSystemId);
- return {
- kind: 'cc',
- status: 'proposed',
- locationId: data.communityCareSystemId,
- serviceType: typeOfCare.idV2 || typeOfCare.ccId,
- // comment: data.reasonAdditionalInfo,
- reasonCode: getReasonCode({
- data,
- isCC: true,
- isDS: false,
- }),
- contact: {
- telecom: [
- {
- type: 'phone',
- value: data.phoneNumber,
- },
- {
- type: 'email',
- value: data.email,
- },
- ],
- },
- requestedPeriods: data.selectedDates.map(date => ({
- start: moment
- .tz(date, facilityTimezone)
- .utc()
- .format(),
- end: moment
- .tz(date, facilityTimezone)
- .utc()
- .add(12, 'hours')
- .subtract(1, 'minute')
- .format(),
- })),
- // These four fields aren't in the current schema, but probably should be
- preferredTimesForPhoneCall: Object.entries(data.bestTimeToCall || {})
- .filter(item => item[1])
- .map(item => titleCase(item[0])),
- preferredLanguage: LANGUAGES.find(
- lang => lang.id === data.preferredLanguage,
- )?.value,
- preferredLocation,
- practitioners,
- };
-}
-
-export function transformFormToVAOSVARequest(state) {
- const data = getFormData(state);
- const typeOfCare = getTypeOfCare(data);
-
- return {
- kind: data.visitType,
- status: 'proposed',
- locationId: data.vaFacility,
- // This may need to change when we get the new service type ids
- serviceType: typeOfCare.idV2,
- reasonCode: getReasonCode({
- data,
- isCC: false,
- isDS: false,
- }),
- // comment: data.reasonAdditionalInfo,
- requestedPeriods: [
- {
- start: moment.utc(data.selectedDates[0]).format(),
- end: moment
- .utc(data.selectedDates[0])
- .add(12, 'hours')
- .subtract(1, 'minute')
- .format(),
- },
- ],
- // This field isn't in the schema yet
- preferredTimesForPhoneCall: Object.entries(data.bestTimeToCall || {})
- .filter(item => item[1])
- .map(item => titleCase(item[0])),
- };
-}
-
-export function transformFormToVAOSAppointment(state) {
- const data = getFormData(state);
- const clinic = getChosenClinicInfo(state);
- const slot = getChosenSlot(state);
-
- // slot start and end times are not allowed on a booked va appointment.
- delete slot.start;
- delete slot.end;
-
- return {
- kind: 'clinic',
- status: 'booked',
- clinic: getClinicId(clinic),
- slot,
- extension: {
- desiredDate: `${data.preferredDate}T00:00:00+00:00`,
- },
- locationId: data.vaFacility,
- reasonCode: getReasonCode({
- data,
- isCC: false,
- isDS: true,
- }),
- };
-}
diff --git a/src/applications/vaos/new-appointment/redux/helpers/formSubmitTransformers.v2.unit.spec.js b/src/applications/vaos/new-appointment/redux/helpers/formSubmitTransformers.v2.unit.spec.js
deleted file mode 100644
index 297633f5c8da..000000000000
--- a/src/applications/vaos/new-appointment/redux/helpers/formSubmitTransformers.v2.unit.spec.js
+++ /dev/null
@@ -1,208 +0,0 @@
-import { expect } from 'chai';
-
-import {
- transformFormToVAOSAppointment,
- transformFormToVAOSVARequest,
-} from './formSubmitTransformers.v2';
-import { FLOW_TYPES, VHA_FHIR_ID } from '../../../utils/constants';
-import { getReasonCode } from './getReasonCode';
-
-describe('VAOS V2 data transformation', () => {
- describe('VA booked', () => {
- it('remove slot.start and slot.end from new appointment object', () => {
- const state = {
- user: {
- profile: {
- vapContactInfo: {},
- },
- },
- newAppointment: {
- data: {
- phoneNumber: '5035551234',
- bestTimeToCall: {
- morning: true,
- },
- email: 'test@va.gov',
- reasonForAppointment: 'routine-follow-up',
- reasonAdditionalInfo: 'asdfasdf',
- selectedDates: ['2019-11-22T09:30:00'],
- preferredDate: '2019-12-02',
- clinicId: '983_308',
- vaParent: '983',
- vaFacility: '983',
- facilityType: 'vamc',
- typeOfCareId: '323',
- },
- availableSlots: [
- {
- start: '2019-12-22T09:30:00',
- end: '2019-12-22T10:00:00',
- },
- {
- start: '2019-11-22T09:30:00',
- end: '2019-11-22T10:00:00',
- },
- ],
- parentFacilities: [
- {
- id: '983',
- identifier: [
- {
- system: VHA_FHIR_ID,
- value: '983',
- },
- ],
- address: {
- city: 'Cheyenne',
- state: 'WY',
- },
- },
- ],
- facilities: {
- '323': [
- {
- id: '983',
- identifier: [
- {
- system: VHA_FHIR_ID,
- value: '983',
- },
- ],
- name: 'Cheyenne VA Medical Center',
- address: {
- city: 'Cheyenne',
- state: 'WY',
- },
- legacyVAR: {
- institutionTimezone: 'America/Denver',
- },
- },
- ],
- },
- clinics: {
- '983_323': [
- {
- id: '983_308',
- serviceName: 'Green Team Clinic1',
- stationId: '983',
- stationName: 'CHYSHR-Cheyenne VA Medical Center',
- },
- ],
- },
- },
- };
-
- // when the reason text is combined with appointment information
- const reasonTextTransformed = getReasonCode({
- data: state.newAppointment.data,
- isCC: false,
- isDS: true,
- });
-
- const stateWithSlotId = {
- ...state,
- newAppointment: {
- ...state.newAppointment,
- availableSlots: [
- { ...state.newAppointment.availableSlots[0], id: 'test' },
- { ...state.newAppointment.availableSlots[1], id: 'test2' },
- ],
- },
- };
-
- const data = transformFormToVAOSAppointment(stateWithSlotId);
- expect(data).to.deep.equal({
- kind: 'clinic',
- status: 'booked',
- clinic: '308',
- slot: {
- id: 'test2',
- },
- extension: { desiredDate: '2019-12-02T00:00:00+00:00' },
- locationId: '983',
- reasonCode: reasonTextTransformed,
- });
- });
- });
-
- describe('VA request', () => {
- it('request body is valid', () => {
- const superLongText =
- 'The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog.';
- // Given the VA request is submitted
- const state = {
- newAppointment: {
- data: {
- phoneNumber: '5035551234',
- bestTimeToCall: {
- morning: true,
- },
- email: 'test@va.gov',
- visitType: 'clinic',
- reasonForAppointment: 'other',
- reasonAdditionalInfo: superLongText,
- selectedDates: ['2019-11-20T12:00:00.000'],
- vaParent: '983',
- vaFacility: '983GB',
- facilityType: 'vamc',
- typeOfCareId: 'SLEEP',
- typeOfSleepCareId: '349',
- },
- parentFacilities: [
- {
- id: '983',
- identifier: [
- {
- system: VHA_FHIR_ID,
- value: '983',
- },
- ],
- },
- ],
- facilities: {
- '349': [
- {
- id: '983GB',
- identifier: [
- {
- system: VHA_FHIR_ID,
- value: '983GB',
- },
- ],
- name: 'Cheyenne VA Medical Center',
- address: {
- city: 'Cheyenne',
- state: 'WY',
- },
- legacyVAR: {
- institutionTimezone: 'America/Denver',
- },
- },
- ],
- },
- flowType: FLOW_TYPES.REQUEST,
- },
- };
- // when the reason text is combined with appointment information
- const reasonTextTransformed = getReasonCode({
- data: state.newAppointment.data,
- isCC: false,
- isDS: false,
- });
-
- const data = transformFormToVAOSVARequest(state);
- // Then the request body will transform
- expect(data).to.deep.equal({
- kind: 'clinic',
- status: 'proposed',
- locationId: '983GB',
- serviceType: 'cpap',
- reasonCode: reasonTextTransformed,
- requestedPeriods: [
- { start: '2019-11-20T12:00:00Z', end: '2019-11-20T23:59:00Z' },
- ],
- preferredTimesForPhoneCall: ['Morning'],
- });
- });
- });
-});
diff --git a/src/applications/vaos/services/mocks/v2/slots.json b/src/applications/vaos/services/mocks/v2/slots.json
index 53953514e5c5..17434cf16eaf 100644
--- a/src/applications/vaos/services/mocks/v2/slots.json
+++ b/src/applications/vaos/services/mocks/v2/slots.json
@@ -2487,6 +2487,14 @@
"start": "2024-08-22T21:15:00Z",
"end": "2024-08-22T00:00:00Z"
}
+ },
+ {
+ "id": "1913",
+ "type": "slots",
+ "attributes": {
+ "start": "2025-02-22T21:15:00Z",
+ "end": "2025-02-22T00:00:00Z"
+ }
}
]
}
\ No newline at end of file
diff --git a/src/applications/vaos/tests/e2e/workflows/direct-schedule-workflow/ophthalmology.cypress.spec.js b/src/applications/vaos/tests/e2e/workflows/direct-schedule-workflow/ophthalmology.cypress.spec.js
index 41fe0e10b870..efb25332d12e 100644
--- a/src/applications/vaos/tests/e2e/workflows/direct-schedule-workflow/ophthalmology.cypress.spec.js
+++ b/src/applications/vaos/tests/e2e/workflows/direct-schedule-workflow/ophthalmology.cypress.spec.js
@@ -143,12 +143,9 @@ describe('VAOS request schedule flow - Audiology', () => {
ReviewPageObject.assertUrl()
.assertHeading({
- name: /Review your appointment details/i,
- })
- .assertHeading({
- level: 2,
- name: /You.re scheduling an ophthalmology appointment/i,
+ name: /Review and confirm your appointment details/i,
})
+ .assertText({ text: /ophthalmology/i })
.clickConfirmButton();
ConfirmationPageObject.assertUrl().assertText({
diff --git a/src/applications/vaos/tests/e2e/workflows/direct-schedule-workflow/primary-care.cypress.spec.js b/src/applications/vaos/tests/e2e/workflows/direct-schedule-workflow/primary-care.cypress.spec.js
index 4955a341b9d1..d205052fe2cf 100644
--- a/src/applications/vaos/tests/e2e/workflows/direct-schedule-workflow/primary-care.cypress.spec.js
+++ b/src/applications/vaos/tests/e2e/workflows/direct-schedule-workflow/primary-care.cypress.spec.js
@@ -137,12 +137,9 @@ describe('VAOS direct schedule flow - Primary care', () => {
ReviewPageObject.assertUrl()
.assertHeading({
- name: /Review your appointment details/i,
- })
- .assertHeading({
- level: 2,
- name: /You.re scheduling a primary care appointment/i,
+ name: /Review and confirm your appointment details/i,
})
+ .assertText({ text: /primary care/i })
.clickConfirmButton();
ConfirmationPageObject.assertUrl().assertText({
@@ -209,12 +206,9 @@ describe('VAOS direct schedule flow - Primary care', () => {
ReviewPageObject.assertUrl()
.assertHeading({
- name: /Review your appointment details/i,
- })
- .assertHeading({
- level: 2,
- name: /You.re scheduling a primary care appointment/i,
+ name: /Review and confirm your appointment details/i,
})
+ .assertText({ text: /primary care/i })
.clickConfirmButton();
ConfirmationPageObject.assertUrl().assertText({
@@ -291,12 +285,9 @@ describe('VAOS direct schedule flow - Primary care', () => {
ReviewPageObject.assertUrl()
.assertHeading({
- name: /Review your appointment details/i,
- })
- .assertHeading({
- level: 2,
- name: /You.re scheduling a primary care appointment/i,
+ name: /Review and confirm your appointment details/i,
})
+ .assertText({ text: /primary care/i })
.clickConfirmButton();
ConfirmationPageObject.assertUrl().assertText({
@@ -481,12 +472,9 @@ describe('VAOS direct schedule flow - Primary care', () => {
ReviewPageObject.assertUrl()
.assertHeading({
- name: /Review your appointment details/i,
- })
- .assertHeading({
- level: 2,
- name: /You.re scheduling a primary care appointment/i,
+ name: /Review and confirm your appointment details/i,
})
+ .assertText({ text: /primary care/i })
.clickConfirmButton();
ConfirmationPageObject.assertUrl().assertText({
@@ -548,12 +536,9 @@ describe('VAOS direct schedule flow - Primary care', () => {
ReviewPageObject.assertUrl()
.assertHeading({
- name: /Review your appointment details/i,
- })
- .assertHeading({
- level: 2,
- name: /You.re scheduling a primary care appointment/i,
+ name: /Review and confirm your appointment details/i,
})
+ .assertText({ text: /primary care/i })
.clickConfirmButton();
ConfirmationPageObject.assertUrl().assertText({
@@ -711,12 +696,9 @@ describe('VAOS direct schedule flow - Primary care', () => {
ReviewPageObject.assertUrl()
.assertHeading({
- name: /Review your appointment details/i,
- })
- .assertHeading({
- level: 2,
- name: /You.re scheduling a primary care appointment/i,
+ name: /Review and confirm your appointment details/i,
})
+ .assertText({ text: /primary care/i })
.clickConfirmButton();
ConfirmationPageObject.assertUrl().assertText({
diff --git a/src/applications/verify-your-enrollment/actions/index.js b/src/applications/verify-your-enrollment/actions/index.js
index a1560f24faad..5c67d98a21e7 100644
--- a/src/applications/verify-your-enrollment/actions/index.js
+++ b/src/applications/verify-your-enrollment/actions/index.js
@@ -237,7 +237,7 @@ export const verifyEnrollmentAction = verifications => {
verifiedThroughDate: lastVerification?.verificationEndDate,
verificationMethod: 'VYE',
appCommunication: {
- responseype: 'Y',
+ responseType: 'Y',
},
};
})()
diff --git a/src/platform/site-wide/user-nav/sass/user-nav.scss b/src/platform/site-wide/user-nav/sass/user-nav.scss
index 64881f27c1e3..2957576bdcd0 100644
--- a/src/platform/site-wide/user-nav/sass/user-nav.scss
+++ b/src/platform/site-wide/user-nav/sass/user-nav.scss
@@ -218,15 +218,6 @@
}
.login.login-modal {
- // temporary solution until DST can fix va-modal large property
- margin-left: -1rem;
- margin-right: 4rem;
-
- @include media($medium-screen) {
- margin-left: unset;
- margin-right: unset;
- }
-
.downtime-notification.row {
margin: 0 0 1em;
}