-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start building test converters to go from HPP to contract rates - nee…
…ds these for existing tests to keep working
- Loading branch information
Showing
4 changed files
with
231 additions
and
111 deletions.
There are no files selected for viewing
108 changes: 108 additions & 0 deletions
108
services/app-api/src/domain-models/contractAndRates/convertHPPtoContractWithRates.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,108 @@ | ||
import type { UnlockedHealthPlanFormDataType } from 'app-web/src/common-code/healthPlanFormDataType' | ||
import type { ContractFormData, RateFormData } from '../../gen/gqlServer' | ||
|
||
// interim solution -this file was made to deal with test helpers that may expect contract rates when we only have HPP coming from another test helper | ||
|
||
// Take a HPP domain model and return form datas we can use in contract or rate test helpers | ||
// if there are no rates on this contract, return null | ||
const convertUnlockedHPPToContractAndRates = ( | ||
pkg: UnlockedHealthPlanFormDataType | ||
): [ContractFormData, RateFormData[]] => { | ||
const { | ||
submissionType, | ||
submissionDescription, | ||
stateContacts, | ||
contractType, | ||
contractExecutionStatus, | ||
contractDateStart, | ||
contractDateEnd, | ||
contractDocuments, | ||
managedCareEntities, | ||
federalAuthorities, | ||
populationCovered, | ||
statutoryRegulatoryAttestation, | ||
statutoryRegulatoryAttestationDescription, | ||
programIDs, | ||
documents, | ||
} = pkg | ||
|
||
const contractFormData: ContractFormData = { | ||
submissionType, | ||
submissionDescription, | ||
stateContacts, | ||
contractType, | ||
contractExecutionStatus, | ||
contractDateStart, | ||
contractDateEnd, | ||
programIDs, | ||
contractDocuments, | ||
supportingDocuments: documents, | ||
managedCareEntities, | ||
federalAuthorities, | ||
populationCovered, | ||
inLieuServicesAndSettings: | ||
pkg.contractAmendmentInfo?.modifiedProvisions | ||
.inLieuServicesAndSettings, | ||
modifiedRiskSharingStrategy: | ||
pkg.contractAmendmentInfo?.modifiedProvisions | ||
.modifiedRiskSharingStrategy, | ||
modifiedIncentiveArrangements: | ||
pkg.contractAmendmentInfo?.modifiedProvisions | ||
.modifiedIncentiveArrangements, | ||
modifiedWitholdAgreements: | ||
pkg.contractAmendmentInfo?.modifiedProvisions | ||
.modifiedWitholdAgreements, | ||
modifiedStateDirectedPayments: | ||
pkg.contractAmendmentInfo?.modifiedProvisions | ||
.modifiedStateDirectedPayments, | ||
modifiedPassThroughPayments: | ||
pkg.contractAmendmentInfo?.modifiedProvisions | ||
.modifiedPassThroughPayments, | ||
modifiedPaymentsForMentalDiseaseInstitutions: | ||
pkg.contractAmendmentInfo?.modifiedProvisions | ||
.modifiedPaymentsForMentalDiseaseInstitutions, | ||
modifiedNonRiskPaymentArrangements: | ||
pkg.contractAmendmentInfo?.modifiedProvisions | ||
.modifiedNonRiskPaymentArrangements, | ||
statutoryRegulatoryAttestation, | ||
statutoryRegulatoryAttestationDescription, | ||
} | ||
const rateFormDatas: RateFormData[] = pkg.rateInfos.map( | ||
(rateInfo): RateFormData => { | ||
const { | ||
rateType, | ||
rateCapitationType, | ||
rateCertificationName, | ||
rateDateCertified, | ||
rateDateEnd, | ||
rateDateStart, | ||
rateDocuments = [], | ||
supportingDocuments = [], | ||
rateProgramIDs = [], | ||
addtlActuaryContacts = [], | ||
actuaryCommunicationPreference, | ||
} = rateInfo | ||
|
||
return { | ||
rateType, | ||
rateCapitationType, | ||
rateCertificationName, | ||
rateDateCertified, | ||
rateDateEnd, | ||
rateDateStart, | ||
rateDocuments, | ||
supportingDocuments, | ||
rateProgramIDs, | ||
certifyingActuaryContacts: [rateInfo.actuaryContacts[0]], | ||
deprecatedRateProgramIDs: [], //ignore this deprecated field | ||
packagesWithSharedRateCerts: [], // ignore this depårecated field | ||
addtlActuaryContacts, | ||
actuaryCommunicationPreference, | ||
} | ||
} | ||
) | ||
|
||
return [contractFormData, rateFormDatas] | ||
} | ||
|
||
export { convertUnlockedHPPToContractAndRates } |
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.