Skip to content
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

MR-3186: migrate indexhpp resolver #1890

Merged
merged 18 commits into from
Aug 29, 2023
Merged

Conversation

JasonLin0991
Copy link
Contributor

@JasonLin0991 JasonLin0991 commented Aug 24, 2023

Summary

MR-3449

  • Migrate indexHPP resolver
    • NOTE: Without submit and unlock resolvers migrated, we cannot re-run existing tests without refactoring every test. For now I just placed a todo at the top of the tests.
    • added validateContractsAndConvert function to validate contract results returned from Prisma
      • Contracts that failed parsing or converting will be filtered out and logged to Otel.
    • Minimal amount of work needed in the resolver; we just need to get the contracts into the correct type using the validateContractsAndConvertfunction.
  • findAllContractsWithHistoryBySubmitInfo new Prisma function to get all contracts that have submitted info. This will grab all contracts that are/have been submitted.
  • findAllContractsWithHistoryByState new Prisma function to get all contracts by stateCode
  • Updated contract and rate tests data to correctly store programIDs as the state program id and not the name. The frontend uses the id to find the name. Before this all contracts on the submission dashboard would have unknown programs.

Related issues

Screenshots

Test cases covered

findAllContractsWithHistoryBySubmitInfo.test.ts

  • 'returns only contracts that have been submitted or unlocked'

indexHealthPlanPackage.test.ts

  • 'correctly filters and log contracts that failed parsing or converting'

QA guidance

  • The only way to verify the application is showing the contracts is through the state dashboard with draft contracts only. CMS only shows submitted and unlocked submissions.

@JasonLin0991 JasonLin0991 marked this pull request as ready for review August 28, 2023 18:09
Copy link
Contributor

@haworku haworku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. ⭐ appreciate the PR write up too for context. All my comments are about file org stuff thinking ahead to when we start building rate only apis and also eventually refactor out the old way of doing things.

@@ -72,8 +72,6 @@ function packageSubmitters(pkg: HealthPlanPackageType): string[] {
function convertContractToUnlockedHealthPlanPackage(
contract: ContractType
): HealthPlanPackageType | Error {
console.info('Attempting to convert contract to health plan package')

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: file organization - this function takes parameter from the rates refactor (ContractType) whereas everything else in this file is about the domain model HPP and takes HPP related arguments. Should be separate file in domain models.

Copy link
Contributor Author

@JasonLin0991 JasonLin0991 Aug 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I could see this being in domain-models/contractAndRates in some file that contains all the converter functions we will have. I think though, I want to punt this to your ticket. I think you have to make converter functions for locked HPP. Maybe you could find a good home and name for this file.

import type { ProgramType } from '../../domain-models'
import statePrograms from 'app-web/src/common-code/data/statePrograms.json'

function getProgramsFromState(stateCode: StateCodeType): ProgramType[] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea for reusable function - I see this code all over.

Nit: file organization - this looks like a stateHelper not a contractHelper.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is your reusable function! I just took it and put it in here. I will extract them all out and put them in a stateHelpers.ts file.

@@ -39,24 +48,146 @@ const validateAndReturnHealthPlanPackages = (
return { totalCount: edges.length, edges }
}

const validateContractsAndConvert = (
Copy link
Contributor

@haworku haworku Aug 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: file organization - I'm noticing we never made a contractAndRates folder in resolvers and I think we should for stuff like this helper. We are eventually building a totally parallel api - want those files to be easy to distinguish.

@JasonLin0991 JasonLin0991 merged commit 2630a94 into main Aug 29, 2023
27 checks passed
@JasonLin0991 JasonLin0991 deleted the jl-mr-3186-migrate-indexhpp branch August 29, 2023 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants