Skip to content

Commit

Permalink
fix(schema): remove logic for determining next business day for `subm…
Browse files Browse the repository at this point in the history
…issionDate` (#980)

* fix: remove logic for determining next business day for `submissionDate`

* fix: update `submissionDate` value
  • Loading branch information
asharonbaltazar authored and RanyeM committed Jan 9, 2025
1 parent a6cd254 commit 7d9f9d5
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 110 deletions.
2 changes: 1 addition & 1 deletion lib/lambda/sinkMainProcessors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ describe("insertOneMacRecordsFromKafkaIntoMako", () => {
statusDate: offsetToUtc(new Date(1732645041526)).toISOString(),
proposedDate: 1732597200000,
subject: null,
submissionDate: "2024-11-26T00:00:00.000Z",
submissionDate: "2024-11-26T18:17:21.526Z",
submitterEmail: "[email protected]",
submitterName: "George Harrison",
initialIntakeNeeded: true,
Expand Down
16 changes: 6 additions & 10 deletions lib/packages/shared-types/opensearch/main/transforms/app-k.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
import { events, getStatus, SEATOOL_STATUS } from "shared-types";
import {
getNextBusinessDayTimestamp,
seaToolFriendlyTimestamp,
} from "../../../../shared-utils/seatool-date-helper";
import { seaToolFriendlyTimestamp } from "../../../../shared-utils/seatool-date-helper";

export const transform = () => {
return events["app-k"].schema.transform((data) => {
const { stateStatus, cmsStatus } = getStatus(SEATOOL_STATUS.PENDING);
const timestampDate = data.timestamp ? new Date(data.timestamp) : undefined;
const timestampDate = new Date(data.timestamp);
const todayEpoch = seaToolFriendlyTimestamp(timestampDate);
const nextBusinessDayEpoch = getNextBusinessDayTimestamp(timestampDate);

return {
title: data.title,
additionalInformation: data.additionalInformation,
authority: data.authority,
changedDate: timestampDate?.toISOString() || null,
changedDate: timestampDate.toISOString(),
cmsStatus,
description: null,
id: data.id,
makoChangedDate: timestampDate?.toISOString() || null,
makoChangedDate: timestampDate.toISOString(),
origin: "OneMAC",
raiWithdrawEnabled: false, // Set to false for new submissions
seatoolStatus: SEATOOL_STATUS.PENDING,
state: data.id?.split("-")?.[0],
stateStatus,
statusDate: new Date(todayEpoch).toISOString() || null,
statusDate: new Date(todayEpoch).toISOString(),
proposedDate: data.proposedEffectiveDate,
subject: null,
submissionDate: new Date(nextBusinessDayEpoch).toISOString() || null,
submissionDate: timestampDate.toISOString(),
submitterEmail: data.submitterEmail,
submitterName: data.submitterName,
actionType: data.actionType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
import { events, getStatus, SEATOOL_STATUS } from "shared-types";
import {
getNextBusinessDayTimestamp,
seaToolFriendlyTimestamp,
} from "../../../../shared-utils/seatool-date-helper";
import { seaToolFriendlyTimestamp } from "../../../../shared-utils/seatool-date-helper";

export const transform = () => {
// any adhoc logic
return events["capitated-amendment"].schema.transform((data) => {
const { stateStatus, cmsStatus } = getStatus(SEATOOL_STATUS.PENDING);
const timestampDate = data.timestamp ? new Date(data.timestamp) : undefined;
const timestampDate = new Date(data.timestamp);
const todayEpoch = seaToolFriendlyTimestamp(timestampDate);
const nextBusinessDayEpoch = getNextBusinessDayTimestamp(timestampDate);

return {
additionalInformation: data.additionalInformation,
authority: data.authority,
changedDate: timestampDate?.toISOString() || null,
changedDate: timestampDate.toISOString(),
cmsStatus,
description: null,
id: data.id,
makoChangedDate: timestampDate?.toISOString() || null,
makoChangedDate: timestampDate.toISOString(),
origin: "OneMAC",
raiWithdrawEnabled: false, // Set to false for new submissions
seatoolStatus: SEATOOL_STATUS.PENDING,
state: data.id?.split("-")?.[0],
stateStatus,
statusDate: new Date(todayEpoch).toISOString() || null,
statusDate: new Date(todayEpoch).toISOString(),
proposedDate: data.proposedEffectiveDate, // wish this was proposedEffectiveDate
subject: null,
submissionDate: new Date(nextBusinessDayEpoch).toISOString() || null,
submissionDate: timestampDate.toISOString(),
submitterEmail: data.submitterEmail,
submitterName: data.submitterName,
actionType: data.actionType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
import { events, getStatus, SEATOOL_STATUS } from "shared-types";
import {
getNextBusinessDayTimestamp,
seaToolFriendlyTimestamp,
} from "../../../../shared-utils/seatool-date-helper";
import { seaToolFriendlyTimestamp } from "../../../../shared-utils/seatool-date-helper";

export const transform = () => {
// any adhoc logic
return events["capitated-initial"].schema.transform((data) => {
const { stateStatus, cmsStatus } = getStatus(SEATOOL_STATUS.PENDING);
const timestampDate = data.timestamp ? new Date(data.timestamp) : undefined;
const timestampDate = new Date(data.timestamp);
const todayEpoch = seaToolFriendlyTimestamp(timestampDate);
const nextBusinessDayEpoch = getNextBusinessDayTimestamp(timestampDate);

return {
additionalInformation: data.additionalInformation,
authority: data.authority,
changedDate: timestampDate?.toISOString() || null,
changedDate: timestampDate.toISOString(),
cmsStatus,
description: null,
id: data.id,
makoChangedDate: timestampDate?.toISOString() || null,
makoChangedDate: timestampDate.toISOString(),
origin: "OneMAC",
raiWithdrawEnabled: false, // Set to false for new submissions
seatoolStatus: SEATOOL_STATUS.PENDING,
state: data.id?.split("-")?.[0],
stateStatus,
statusDate: new Date(todayEpoch).toISOString() || null,
statusDate: new Date(todayEpoch).toISOString(),
proposedDate: data.proposedEffectiveDate, // wish this was proposedEffectiveDate
subject: null,
submissionDate: new Date(nextBusinessDayEpoch).toISOString() || null,
submissionDate: timestampDate.toISOString(),
submitterEmail: data.submitterEmail,
submitterName: data.submitterName,
actionType: data.actionType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
import { events, getStatus, SEATOOL_STATUS } from "shared-types";
import {
getNextBusinessDayTimestamp,
seaToolFriendlyTimestamp,
} from "../../../../shared-utils/seatool-date-helper";
import { seaToolFriendlyTimestamp } from "../../../../shared-utils/seatool-date-helper";

export const transform = () => {
// any adhoc logic
return events["capitated-renewal"].schema.transform((data) => {
const { stateStatus, cmsStatus } = getStatus(SEATOOL_STATUS.PENDING);
const timestampDate = data.timestamp ? new Date(data.timestamp) : undefined;
const timestampDate = new Date(data.timestamp);
const todayEpoch = seaToolFriendlyTimestamp(timestampDate);
const nextBusinessDayEpoch = getNextBusinessDayTimestamp(timestampDate);

return {
additionalInformation: data.additionalInformation,
authority: data.authority,
changedDate: timestampDate?.toISOString() || null,
changedDate: timestampDate.toISOString(),
cmsStatus,
description: null,
id: data.id,
makoChangedDate: timestampDate?.toISOString() || null,
makoChangedDate: timestampDate.toISOString(),
origin: "OneMAC",
raiWithdrawEnabled: false, // Set to false for new submissions
seatoolStatus: SEATOOL_STATUS.PENDING,
state: data.id?.split("-")?.[0],
stateStatus,
statusDate: new Date(todayEpoch).toISOString() || null,
statusDate: new Date(todayEpoch).toISOString(),
proposedDate: data.proposedEffectiveDate, // wish this was proposedEffectiveDate
subject: null,
submissionDate: new Date(nextBusinessDayEpoch).toISOString() || null,
submissionDate: timestampDate.toISOString(),
submitterEmail: data.submitterEmail,
submitterName: data.submitterName,
actionType: data.actionType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
import { events, getStatus, SEATOOL_STATUS } from "shared-types";
import {
getNextBusinessDayTimestamp,
seaToolFriendlyTimestamp,
} from "../../../../shared-utils/seatool-date-helper";
import { seaToolFriendlyTimestamp } from "../../../../shared-utils/seatool-date-helper";

export const transform = () => {
// any adhoc logic
return events["contracting-amendment"].schema.transform((data) => {
const { stateStatus, cmsStatus } = getStatus(SEATOOL_STATUS.PENDING);
const timestampDate = data.timestamp ? new Date(data.timestamp) : undefined;
const timestampDate = new Date(data.timestamp);
const todayEpoch = seaToolFriendlyTimestamp(timestampDate);
const nextBusinessDayEpoch = getNextBusinessDayTimestamp(timestampDate);

return {
additionalInformation: data.additionalInformation,
authority: data.authority,
changedDate: timestampDate?.toISOString() || null,
changedDate: timestampDate.toISOString(),
cmsStatus,
description: null,
id: data.id,
makoChangedDate: timestampDate?.toISOString() || null,
makoChangedDate: timestampDate.toISOString(),
origin: "OneMAC",
raiWithdrawEnabled: false, // Set to false for new submissions
seatoolStatus: SEATOOL_STATUS.PENDING,
state: data.id?.split("-")?.[0],
stateStatus,
statusDate: new Date(todayEpoch).toISOString() || null,
statusDate: new Date(todayEpoch).toISOString(),
proposedDate: data.proposedEffectiveDate, // wish this was proposedEffectiveDate
subject: null,
submissionDate: new Date(nextBusinessDayEpoch).toISOString() || null,
submissionDate: timestampDate.toISOString(),
submitterEmail: data.submitterEmail,
submitterName: data.submitterName,
actionType: data.actionType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
import { events, getStatus, SEATOOL_STATUS } from "shared-types";
import {
getNextBusinessDayTimestamp,
seaToolFriendlyTimestamp,
} from "../../../../shared-utils/seatool-date-helper";
import { seaToolFriendlyTimestamp } from "../../../../shared-utils/seatool-date-helper";

export const transform = () => {
// any adhoc logic
return events["contracting-initial"].schema.transform((data) => {
const { stateStatus, cmsStatus } = getStatus(SEATOOL_STATUS.PENDING);
const timestampDate = data.timestamp ? new Date(data.timestamp) : undefined;
const timestampDate = new Date(data.timestamp);
const todayEpoch = seaToolFriendlyTimestamp(timestampDate);
const nextBusinessDayEpoch = getNextBusinessDayTimestamp(timestampDate);

return {
additionalInformation: data.additionalInformation,
authority: data.authority,
changedDate: timestampDate?.toISOString() || null,
changedDate: timestampDate.toISOString(),
cmsStatus,
description: null,
id: data.id,
makoChangedDate: timestampDate?.toISOString() || null,
makoChangedDate: timestampDate.toISOString(),
origin: "OneMAC",
raiWithdrawEnabled: false, // Set to false for new submissions
seatoolStatus: SEATOOL_STATUS.PENDING,
state: data.id?.split("-")?.[0],
stateStatus,
statusDate: new Date(todayEpoch).toISOString() || null,
statusDate: new Date(todayEpoch).toISOString(),
proposedDate: data.proposedEffectiveDate, // wish this was proposedEffectiveDate
subject: null,
submissionDate: new Date(nextBusinessDayEpoch).toISOString() || null,
submissionDate: timestampDate.toISOString(),
submitterEmail: data.submitterEmail,
submitterName: data.submitterName,
actionType: data.actionType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
import { events, getStatus, SEATOOL_STATUS } from "shared-types";
import {
getNextBusinessDayTimestamp,
seaToolFriendlyTimestamp,
} from "../../../../shared-utils/seatool-date-helper";
import { seaToolFriendlyTimestamp } from "../../../../shared-utils/seatool-date-helper";

export const transform = () => {
// any adhoc logic
return events["contracting-renewal"].schema.transform((data) => {
const { stateStatus, cmsStatus } = getStatus(SEATOOL_STATUS.PENDING);
const timestampDate = data.timestamp ? new Date(data.timestamp) : undefined;
const timestampDate = new Date(data.timestamp);
const todayEpoch = seaToolFriendlyTimestamp(timestampDate);
const nextBusinessDayEpoch = getNextBusinessDayTimestamp(timestampDate);

return {
additionalInformation: data.additionalInformation,
authority: data.authority,
changedDate: timestampDate?.toISOString() || null,
changedDate: timestampDate?.toISOString(),
cmsStatus,
description: null,
id: data.id,
makoChangedDate: timestampDate?.toISOString() || null,
makoChangedDate: timestampDate?.toISOString(),
origin: "OneMAC",
raiWithdrawEnabled: false, // Set to false for new submissions
seatoolStatus: SEATOOL_STATUS.PENDING,
state: data.id?.split("-")?.[0],
stateStatus,
statusDate: new Date(todayEpoch).toISOString() || null,
statusDate: new Date(todayEpoch).toISOString(),
proposedDate: data.proposedEffectiveDate, // wish this was proposedEffectiveDate
subject: null,
submissionDate: new Date(nextBusinessDayEpoch).toISOString() || null,
submissionDate: timestampDate.toISOString(),
submitterEmail: data.submitterEmail,
submitterName: data.submitterName,
actionType: data.actionType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
import { events, getStatus, SEATOOL_STATUS } from "shared-types";
import {
getNextBusinessDayTimestamp,
seaToolFriendlyTimestamp,
} from "../../../../shared-utils/seatool-date-helper";
import { seaToolFriendlyTimestamp } from "../../../../shared-utils/seatool-date-helper";

export const transform = () => {
// any adhoc logic
return events["new-chip-submission"].schema.transform((data) => {
const { stateStatus, cmsStatus } = getStatus(SEATOOL_STATUS.PENDING);
const timestampDate = data.timestamp ? new Date(data.timestamp) : undefined;
const timestampDate = new Date(data.timestamp);
const todayEpoch = seaToolFriendlyTimestamp(timestampDate);
const nextBusinessDayEpoch = getNextBusinessDayTimestamp(timestampDate);

return {
additionalInformation: data.additionalInformation,
authority: data.authority,
changedDate: timestampDate?.toISOString() || null,
changedDate: timestampDate.toISOString(),
cmsStatus,
description: null,
id: data.id,
makoChangedDate: timestampDate?.toISOString() || null,
makoChangedDate: timestampDate.toISOString(),
origin: "OneMAC",
raiWithdrawEnabled: false, // Set to false for new submissions
seatoolStatus: SEATOOL_STATUS.PENDING,
state: data.id?.split("-")?.[0],
stateStatus,
statusDate: new Date(todayEpoch).toISOString() || null,
statusDate: new Date(todayEpoch).toISOString(),
proposedDate: data.proposedEffectiveDate, // wish this was proposedEffectiveDate
subject: null,
submissionDate: new Date(nextBusinessDayEpoch).toISOString() || null,
submissionDate: timestampDate.toISOString(),
submitterEmail: data.submitterEmail,
submitterName: data.submitterName,
actionType: data.actionType,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
import { events, getStatus, SEATOOL_STATUS } from "shared-types";
import {
getNextBusinessDayTimestamp,
seaToolFriendlyTimestamp,
} from "../../../../shared-utils/seatool-date-helper";
import { seaToolFriendlyTimestamp } from "../../../../shared-utils/seatool-date-helper";

export const transform = () => {
// any adhoc logic
return events["new-medicaid-submission"].schema.transform((data) => {
const { stateStatus, cmsStatus } = getStatus(SEATOOL_STATUS.PENDING);
const timestampDate = data.timestamp ? new Date(data.timestamp) : undefined;
const timestampDate = new Date(data.timestamp);
const todayEpoch = seaToolFriendlyTimestamp(timestampDate);
const nextBusinessDayEpoch = getNextBusinessDayTimestamp(timestampDate);

return {
additionalInformation: data.additionalInformation,
authority: data.authority,
changedDate: timestampDate?.toISOString() || null,
changedDate: timestampDate.toISOString(),
cmsStatus,
description: null,
id: data.id,
makoChangedDate: timestampDate?.toISOString() || null,
makoChangedDate: timestampDate.toISOString(),
origin: "OneMAC",
raiWithdrawEnabled: false, // Set to false for new submissions
seatoolStatus: SEATOOL_STATUS.PENDING,
state: data.id?.split("-")?.[0],
stateStatus,
statusDate: new Date(todayEpoch).toISOString() || null,
statusDate: new Date(todayEpoch).toISOString(),
proposedDate: data.proposedEffectiveDate, // wish this was proposedEffectiveDate
subject: null,
submissionDate: new Date(nextBusinessDayEpoch).toISOString() || null,
submissionDate: timestampDate.toISOString(),
submitterEmail: data.submitterEmail,
submitterName: data.submitterName,
initialIntakeNeeded: true,
Expand Down
Loading

0 comments on commit 7d9f9d5

Please sign in to comment.