From 3142bc058bab5e7a7a1e9918b6043081551eda6b Mon Sep 17 00:00:00 2001 From: Mike Dial Date: Wed, 20 Mar 2024 04:12:58 -0400 Subject: [PATCH] feat(clear intake): Clear intake needed sub status for records that have reached a final disposition --- .../opensearch/main/transforms/seatool.ts | 18 +++++++++--------- src/services/data/handlers/sinkMain.ts | 1 - 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/packages/shared-types/opensearch/main/transforms/seatool.ts b/src/packages/shared-types/opensearch/main/transforms/seatool.ts index a3a76d78f..1052ed896 100644 --- a/src/packages/shared-types/opensearch/main/transforms/seatool.ts +++ b/src/packages/shared-types/opensearch/main/transforms/seatool.ts @@ -35,7 +35,7 @@ function getLeadAnalyst(eventData: SeaTool) { eventData.STATE_PLAN.LEAD_ANALYST_ID ) { const leadAnalyst = eventData.LEAD_ANALYST.find( - (analyst) => analyst.OFFICER_ID === eventData.STATE_PLAN.LEAD_ANALYST_ID + (analyst) => analyst.OFFICER_ID === eventData.STATE_PLAN.LEAD_ANALYST_ID, ); if (leadAnalyst) { @@ -90,7 +90,7 @@ const getDateStringOrNullFromEpoc = (epocDate: number | null | undefined) => : null; const compileSrtList = ( - officers: SeatoolOfficer[] | null | undefined + officers: SeatoolOfficer[] | null | undefined, ): string[] => officers?.length ? officers.map((o) => `${o.FIRST_NAME} ${o.LAST_NAME}`) : []; @@ -104,7 +104,7 @@ const isInSecondClock = ( raiReceivedDate: any, raiWithdrawnDate: any, seatoolStatus: any, - authority: any + authority: any, ) => { if ( authority != "CHIP" && // if it's not a chip @@ -149,19 +149,19 @@ export const transform = (id: string) => { actionTypeId: data.ACTIONTYPES?.[0].ACTION_ID, approvedEffectiveDate: getDateStringOrNullFromEpoc( data.STATE_PLAN.APPROVED_EFFECTIVE_DATE || - data.STATE_PLAN.ACTUAL_EFFECTIVE_DATE + data.STATE_PLAN.ACTUAL_EFFECTIVE_DATE, ), description: data.STATE_PLAN.SUMMARY_MEMO, finalDispositionDate: getFinalDispositionDate(seatoolStatus, data), leadAnalystOfficerId, initialIntakeNeeded: - !leadAnalystName && seatoolStatus !== SEATOOL_STATUS.WITHDRAWN, + !leadAnalystName && !finalDispositionStatuses.includes(seatoolStatus), leadAnalystName, authorityId: authorityId || null, authority: getAuthority(authorityId, id) as Authority | null, types: data.STATE_PLAN_SERVICETYPES?.filter( - (type): type is NonNullable => type != null + (type): type is NonNullable => type != null, ).map((type) => { return { SPA_TYPE_ID: type.SPA_TYPE_ID, @@ -170,7 +170,7 @@ export const transform = (id: string) => { }) || null, subTypes: data.STATE_PLAN_SERVICE_SUBTYPES?.filter( - (subType): subType is NonNullable => subType != null + (subType): subType is NonNullable => subType != null, ).map((subType) => { return { TYPE_ID: subType.TYPE_ID, @@ -188,14 +188,14 @@ export const transform = (id: string) => { cmsStatus: cmsStatus || SEATOOL_STATUS.UNKNOWN, seatoolStatus, submissionDate: getDateStringOrNullFromEpoc( - data.STATE_PLAN.SUBMISSION_DATE + data.STATE_PLAN.SUBMISSION_DATE, ), subject: data.STATE_PLAN.TITLE_NAME, secondClock: isInSecondClock( raiReceivedDate, raiWithdrawnDate, seatoolStatus, - flavorLookup(data.STATE_PLAN.PLAN_TYPE) + flavorLookup(data.STATE_PLAN.PLAN_TYPE), ), raiWithdrawEnabled: finalDispositionStatuses.includes(seatoolStatus) ? false diff --git a/src/services/data/handlers/sinkMain.ts b/src/services/data/handlers/sinkMain.ts index 5003cbdd0..a8aa70cf1 100644 --- a/src/services/data/handlers/sinkMain.ts +++ b/src/services/data/handlers/sinkMain.ts @@ -228,6 +228,5 @@ const changed_date = async ( }); } } - console.log(JSON.stringify(docs, null, 2)); return docs; };