-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MCR-3772 MCR-3771 Edit and submit standalone rate #2238
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
a4e2445
Start to add RateDetailsV2
haworku 0b73291
wip
haworku 8b74cd0
wip
haworku 492de9f
add flag to side nav
haworku a1120f8
wip
haworku d8388bf
Add nx to gitignore
haworku d661aa9
Fix up types
haworku 0a01796
Workaround actuary contacts types
haworku 9423fc2
Fix React console error about bad setState call in RateSummary
haworku 9ff2174
Wip to show what I'm doing
haworku d711b76
Page finally loading - can see a few broken fields to address next
haworku 5c021ff
cleanup
haworku bb20c3d
Set up page action buttons properly, updateRate not available yet
haworku e8f23fd
cleanup
haworku 3c3f417
cleanup
haworku 860ea5a
Pass rateID not revision id to submit. Fix cacheing
haworku 6dad58b
Move file nesting to combine all V2 in one folder
haworku 9a6e986
Add basic test and todos for all the untested paths
haworku 93997e6
Merge remote-tracking branch 'origin/main' into MCR-3777-single-rate
haworku 6b20930
Cleanup app-web tests
haworku fa8f498
app-api tests passing
haworku a1b3769
Merge remote-tracking branch 'origin/main' into MCR-3777-single-rate
haworku 13c4d03
cypress re-run
haworku 0dfda94
Fix test id and help cypress out
haworku cc64ae6
Address @macrael code review
haworku 7a8a24d
Think I can remove null-coalescing work now as well
haworku 24c9f5a
Start generating rate names for standalone rate submits
haworku e4d0c01
Fixup app-api tests, don't mess with id-only submit log path
haworku File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ tsconfig.tsbuildinfo | |
.serverless | ||
.eslintcache | ||
/.env | ||
.nx | ||
tests_output | ||
*.log | ||
coverage/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
Recursively replaces all nulls with undefineds | ||
GQL return <Maybe> types are T | null instead of T | undefined which match our zod .optional() domain types | ||
This functions allows us convert GQL to zod-friendly types to type match zod and apollo server types | ||
and avoid manual type casting or null coalescing work | ||
|
||
Adapted from https://github.com/apollographql/apollo-client/issues/2412 | ||
*/ | ||
|
||
type RecursivelyReplaceNullWithUndefined<T> = T extends null | ||
? undefined | ||
: T extends Date | ||
? T | ||
: { | ||
[K in keyof T]: T[K] extends (infer U)[] | ||
? RecursivelyReplaceNullWithUndefined<U>[] | ||
: RecursivelyReplaceNullWithUndefined<T[K]> | ||
} | ||
|
||
export function nullsToUndefined<T>( | ||
haworku marked this conversation as resolved.
Show resolved
Hide resolved
|
||
obj: T | ||
): RecursivelyReplaceNullWithUndefined<T> { | ||
if (obj === null) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
return undefined as any | ||
} | ||
|
||
// object check based on: https://stackoverflow.com/a/51458052/6489012 | ||
if (obj?.constructor.name === 'Object') { | ||
for (const key in obj) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
obj[key] = nullsToUndefined(obj[key]) as any | ||
} | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
return obj as any | ||
} |
56 changes: 56 additions & 0 deletions
56
services/app-api/src/resolvers/rate/generateRateCertificationName.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { formatRateNameDate } from '../../../../app-web/src/common-code/dateHelpers' | ||
import { packageName } from '../../../../app-web/src/common-code/healthPlanFormDataType' | ||
import type { ProgramArgType } from '../../../../app-web/src/common-code/healthPlanFormDataType' | ||
import type { RateFormDataType } from '../../domain-models/contractAndRates' | ||
|
||
const generateRateCertificationName = ( | ||
rateFormData: RateFormDataType, | ||
stateCode: string, | ||
stateNumber: number, | ||
statePrograms: ProgramArgType[] | ||
): string => { | ||
const { | ||
rateType, | ||
rateProgramIDs, | ||
amendmentEffectiveDateEnd, | ||
amendmentEffectiveDateStart, | ||
rateDateCertified, | ||
rateDateEnd, | ||
rateDateStart, | ||
} = rateFormData | ||
|
||
let rateName = `${packageName( | ||
stateCode, | ||
stateNumber, | ||
rateProgramIDs ?? [], | ||
statePrograms | ||
)}-RATE` | ||
if (rateType === 'NEW' && rateDateStart) { | ||
rateName = rateName.concat( | ||
'-', | ||
formatRateNameDate(rateDateStart), | ||
'-', | ||
formatRateNameDate(rateDateEnd), | ||
'-', | ||
'CERTIFICATION' | ||
) | ||
} | ||
|
||
if (rateType === 'AMENDMENT') { | ||
rateName = rateName.concat( | ||
'-', | ||
formatRateNameDate(amendmentEffectiveDateStart), | ||
'-', | ||
formatRateNameDate(amendmentEffectiveDateEnd), | ||
'-', | ||
'AMENDMENT' | ||
) | ||
} | ||
|
||
if (rateDateCertified) { | ||
rateName = rateName.concat('-', formatRateNameDate(rateDateCertified)) | ||
} | ||
return rateName | ||
} | ||
|
||
export { generateRateCertificationName } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -975,7 +975,7 @@ type ContractFormData { | |
} | ||
|
||
"Either new capitation rates (NEW) or updates to previously certified capitation rates (AMENDMENT)" | ||
enum RateType { | ||
enum RateAmendmentType { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed the name on this because I was seeing types getting confused in my editor when
|
||
NEW | ||
AMENDMENT | ||
} | ||
|
@@ -1013,6 +1013,7 @@ enum ActuarialFirm { | |
|
||
"Contact information for the certifying or additional state actuary" | ||
type ActuaryContact { | ||
id: ID | ||
name: String | ||
titleRole: String | ||
email: String | ||
|
@@ -1022,6 +1023,7 @@ type ActuaryContact { | |
|
||
"Contact information input for the certifying or additional state actuary" | ||
input ActuaryContactInput { | ||
id: ID | ||
name: String | ||
titleRole: String | ||
email: String | ||
|
@@ -1037,13 +1039,13 @@ It's used as a part of RateFormData | |
type PackageWithSameRate { | ||
packageName: String! | ||
packageId: String! | ||
packageStatus: String | ||
packageStatus: HealthPlanPackageStatus | ||
} | ||
|
||
input PackageWithSameRateInput { | ||
packageName: String! | ||
packageId: String! | ||
packageStatus: HealthPlanPackageStatus! | ||
packageStatus: HealthPlanPackageStatus | ||
} | ||
|
||
""" | ||
|
@@ -1056,7 +1058,7 @@ type RateFormData { | |
Refers to whether the state is submitting a brand new rate certification | ||
or an amendment to an existing rate certification | ||
""" | ||
rateType: RateType | ||
rateType: RateAmendmentType | ||
""" | ||
Can be 'RATE_CELL' or 'RATE_RANGE' | ||
These values represent on what basis the capitation rate is actuarially sound | ||
|
@@ -1263,7 +1265,7 @@ input RateFormDataInput { | |
Refers to whether the state is submitting a brand new rate certification | ||
or an amendment to an existing rate certification | ||
""" | ||
rateType: RateType | ||
rateType: RateAmendmentType | ||
""" | ||
Can be 'RATE_CELL' or 'RATE_RANGE' | ||
These values represent on what basis the capitation rate is actuarially sound | ||
|
@@ -1327,7 +1329,7 @@ input RateFormDataInput { | |
An array of additional ActuaryContacts | ||
Each element includes the the name, title/role and email | ||
""" | ||
addtlActuaryContacts: [ActuaryContactInput!]! | ||
addtlActuaryContacts: [ActuaryContactInput!] | ||
""" | ||
Is either OACT_TO_ACTUARY or OACT_TO_STATE | ||
It specifies whether the state wants CMS to reach out to their actuaries | ||
|
@@ -1345,8 +1347,8 @@ input RateFormDataInput { | |
|
||
input SubmitRateInput { | ||
rateID: ID! | ||
"User given submission description" | ||
submitReason: String! | ||
"User given submission description - defaults to Initial submission if left blank" | ||
submitReason: String | ||
"Rate related form data to be updated with submission" | ||
formData: RateFormDataInput | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@macrael I looked into changing graphql return types to be more generous via codegen settings first in the
maybeValue
but I was still seeing type issues. Feels like this could be something to look at more holistically. For now, doing this hack again (what we did intoDomain
with protos) to quickly get around it in order to move on