Skip to content

Commit

Permalink
feat(clear intake): Clear intake needed sub status for records that h…
Browse files Browse the repository at this point in the history
…ave reached a final disposition
  • Loading branch information
mdial89f committed Mar 20, 2024
1 parent 7318884 commit 3142bc0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
18 changes: 9 additions & 9 deletions src/packages/shared-types/opensearch/main/transforms/seatool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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}`) : [];

Expand All @@ -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
Expand Down Expand Up @@ -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<typeof type> => type != null
(type): type is NonNullable<typeof type> => type != null,
).map((type) => {
return {
SPA_TYPE_ID: type.SPA_TYPE_ID,
Expand All @@ -170,7 +170,7 @@ export const transform = (id: string) => {
}) || null,
subTypes:
data.STATE_PLAN_SERVICE_SUBTYPES?.filter(
(subType): subType is NonNullable<typeof subType> => subType != null
(subType): subType is NonNullable<typeof subType> => subType != null,
).map((subType) => {
return {
TYPE_ID: subType.TYPE_ID,
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/services/data/handlers/sinkMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,5 @@ const changed_date = async (
});
}
}
console.log(JSON.stringify(docs, null, 2));
return docs;
};

0 comments on commit 3142bc0

Please sign in to comment.