-
Notifications
You must be signed in to change notification settings - Fork 0
DEMOS-975: Minimal centralized date picker, and seeder stuff #528
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
base: main
Are you sure you want to change the base?
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
| const healthFocusDemoTypes = [ | ||
| "Beneficiary Engagement", | ||
| "PHE-COVID-19", "Aggregate Cap", "Annual Limits", | ||
| "Basic Health Plan (BHP)", "Behavioral Health", | ||
| "Children's Health Insurance Program (CHIP)", | ||
| "CMMI - AHEAD", "CMMI - Integrated Care for Kids (IncK)", | ||
| "CMMI - Maternal Opioid Misuse (MOM)", | ||
| "Community Engagement", "Contingency Management", | ||
| "Continuous Eligibility", | ||
| "Delivery System Reform Incentive Payment (DSRIP)", | ||
| "Dental", "Designated State Health Programs (DSHP)", | ||
| "Employment Supports", "Enrollment Cap", | ||
| "End-Stage Renal Disease (ESRD)", "Expenditure Cap", | ||
| "Former Foster Care Youth (FFCY)", | ||
| "Global Payment Program (GPP)", "Health Equity", | ||
| "Health-Related Social Needs (HRSN)", | ||
| "Healthy Behavior Incentives", | ||
| "HIV", "Home Community Based Services (HCBS)", | ||
| "Lead Exposure", "Lifetime Limits", | ||
| "Long-Term Services and Supports (LTSS)", | ||
| "Managed Care", "Marketplace Coverage/Premium Assistance Wrap", | ||
| "New Adult Group Expansion", "Non-Eligibility Period", | ||
| "Non-Emergency Medical Transportation (NEMT)", | ||
| "Partial Expansion of the New Adult Group", "Pharmacy", "PHE-Appendix K", | ||
| "PHE-Reasonable Opportunity Period (ROP)", "PHE-Risk Mitigation", | ||
| "PHE-Vaccine Coverage", "Premiums/Cost-Sharing", | ||
| "Provider Cap", "Provider Restriction", "ReEntry", | ||
| "Reproductive Health: Family Planning", "Reproductive Health: Fertility", | ||
| "Reproductive Health: Hyde", "Reproductive Health: Maternal Health", | ||
| "Reproductive Health: Post-Partum Extension", "Reproductive Health: RAD", | ||
| "Retroactive Eligibility", "Serious Mental Illness (SMI)", "Special Needs", | ||
| "Substance Use Disorder (SUD)", "Targeted Population Expansion", "Tribal", | ||
| "Uncompensated Care","Value Based Care (VBC)", "Vision", | ||
| ]; | ||
| const demonstrationTypes = ["Section 1115", "Section 1915(b)", "Section 1915(c)"]; |
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.
i reallze it's very listy and slgihtly uggo, but it's better than voloptious lambda ipsum chalupa
And Connor, the demos you create will show in "my demos" so should be easy to tell.
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.
Pulled this from demonstration type from PMDA, just to add something a bit more "not latin"
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.
defining demonstrationTypes here might get a little confusing when we start building out the actual demonstrationTypes modal. It looks like that is only used for coming up with demonstration names, so it might be better to call this something like "areaOfFocus" or something.
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.
yeah, we do have a lot of name things for demos.
So that we can't just add like the kitchen sink to this, thus most configuring has to be done in the component and not where it's used.
Also cleaned up implementation in column fitler
The issue i am trying to fix is that the document dates are all the same, So hard to test filter.
Could be candidate for "and the rest of the input stuff" but not yet
| documentTypeId: stateApplicationDocumentType, | ||
| applicationId: amendmentId.id, | ||
| phaseId: applicationIntakePhaseName, | ||
| createdAt: randomBackdatedDate(), |
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.
This populates the doc tables inside demos, but gives range of dates so we can test filters.
| <DatePicker | ||
| label={`${columnDisplayName} Start`} | ||
| id="date-filter-start" | ||
| name="date-filter-start" | ||
| type="date" | ||
| className="w-full border border-border-fields px-1 py-1 text-sm rounded" | ||
| onChange={(e) => { | ||
| const value = e.target.value; | ||
| onRangeChange(parseISO(value), filterRangeValue.end); | ||
| }} | ||
| placeholder="Start date" | ||
| value={filterRangeValue.start ? format(filterRangeValue.start, "yyyy-MM-dd") : ""} | ||
| onValueChange={(val) => | ||
| onRangeChange(val ? parseISO(val) : null, filterRangeValue.end) | ||
| } | ||
| /> | ||
| </div> | ||
| <div> | ||
| <label | ||
| className="block text-sm font-bold mb-1" | ||
| htmlFor="date-filter-end" | ||
| >{`${columnDisplayName} End`}</label> | ||
| <input | ||
| <DatePicker | ||
| label={`${columnDisplayName} End`} | ||
| id="date-filter-end" | ||
| name="date-filter-end" | ||
| type="date" | ||
| onChange={(e) => onRangeChange(filterRangeValue.start, parseISO(e.target.value))} | ||
| className="w-full border border-border-fields px-1 py-1 text-sm rounded" | ||
| placeholder="End date" | ||
| value={filterRangeValue.end ? format(filterRangeValue.end, "yyyy-MM-dd") : ""} | ||
| onValueChange={(val) => | ||
| onRangeChange(filterRangeValue.start, val ? parseISO(val) : null) |
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.
All this does is implement the DatePicker. Everyting works as before.
| for (const demonstration of demonstrations) { | ||
| const fakeName = faker.lorem.sentence(2); | ||
| await prisma().document.create({ | ||
| data: { | ||
| name: fakeName, | ||
| description: "Application for " + fakeName, | ||
| s3Path: "s3://" + faker.lorem.word() + "/" + faker.lorem.word(), | ||
| ownerUserId: (await prisma().user.findRandom())!.id, | ||
| documentTypeId: stateApplicationDocumentType, | ||
| applicationId: demonstration.id, | ||
| phaseId: applicationIntakePhaseName, | ||
| createdAt: randomBackdatedDate(), | ||
| }, |
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.
I think this was pulled, but having a few documents with varying dates helps test the sorting on the doc table.
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.
this was intentionally reworked into the seedDocuments method towards the top of the seeder. It is currently set to populate 15 documents of random types on every application (demos, extensions, and amendments). The intention of that change was to make sure that if there is a seeded document in the db that it is also backed by a seeded file in s3, such that documents visible on the page can be deleted (primarily on Dev). It also retains the behavior for the simple local upload bypass, such that if that is set, the backing to s3 is not produced. I think we should probably pull out this particular section, so that we dont have a mix of documents with and without s3 backing. We can set some random dates to the created Documents there
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.
ok. That's all i was looking for was random dates.
| function randomBackdatedDate() { | ||
| const daysBack = faker.number.int({ min: 90, max: 210 }); // roughly 3-7 months ago | ||
| return faker.date.recent({ days: daysBack }); | ||
| } |
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.
Just sets a random date within the last 7 months. (oddly specific)
| let stateSelection = sampleFromArray(person.personStates, 1)[0]; | ||
| if (!stateSelection) { | ||
| const fallbackState = await prisma().state.findRandom(); | ||
| if (!fallbackState) { | ||
| throw new Error("No states available to assign to demonstration"); | ||
| } | ||
| stateSelection = { stateId: fallbackState.id, state: fallbackState, personId: person.id }; | ||
| } | ||
|
|
||
| const stateName = stateSelection.state?.name ?? stateSelection.stateId; | ||
| const waiverType = sampleFromArray(demonstrationTypes, 1)[0]; | ||
| const focusArea = sampleFromArray(healthFocusDemoTypes, 1)[0]; | ||
| const demoName = `${stateName} ${waiverType} Waiver: ${focusArea}`; | ||
|
|
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.
Now we just set those names randomly.
So we wind up with something like:
Arizona Section 1915(b) Waiver: Healthy Behavior Incentives
| return ( | ||
| <Input | ||
| type="date" | ||
| label={label} | ||
| name={name ?? id ?? ""} | ||
| isRequired={required ?? false} | ||
| value={value} | ||
| onChange={handleChange} | ||
| /> |
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.
This is like as simple as i could make and still work with ColumnFilter
connor-parke-icf
left a comment
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.
One of the things ive been trying to get working on Dev is how documents are seeded such that they can be downloaded or deleted. In order for this to work though, each of the documents should correspond to a file that exists in s3. If we have a document entry in the document table that does not have a file associated to it, it wont be able to be deleted (it will error). On our locals, this is resolved by using the SIMPLE_LOCAL_UPLOAD flag, but that isnt something i think we should be propagating to the other environments. So instead of a new section for seeding documents, i think we should just expand the existing one to introduce some of the random createdAt dates.
| for (const demonstration of demonstrations) { | ||
| const fakeName = faker.lorem.sentence(2); | ||
| await prisma().document.create({ | ||
| data: { | ||
| name: fakeName, | ||
| description: "Application for " + fakeName, | ||
| s3Path: "s3://" + faker.lorem.word() + "/" + faker.lorem.word(), | ||
| ownerUserId: (await prisma().user.findRandom())!.id, | ||
| documentTypeId: stateApplicationDocumentType, | ||
| applicationId: demonstration.id, | ||
| phaseId: applicationIntakePhaseName, | ||
| createdAt: randomBackdatedDate(), | ||
| }, |
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.
this was intentionally reworked into the seedDocuments method towards the top of the seeder. It is currently set to populate 15 documents of random types on every application (demos, extensions, and amendments). The intention of that change was to make sure that if there is a seeded document in the db that it is also backed by a seeded file in s3, such that documents visible on the page can be deleted (primarily on Dev). It also retains the behavior for the simple local upload bypass, such that if that is set, the backing to s3 is not produced. I think we should probably pull out this particular section, so that we dont have a mix of documents with and without s3 backing. We can set some random dates to the created Documents there
| const healthFocusDemoTypes = [ | ||
| "Beneficiary Engagement", | ||
| "PHE-COVID-19", "Aggregate Cap", "Annual Limits", | ||
| "Basic Health Plan (BHP)", "Behavioral Health", | ||
| "Children's Health Insurance Program (CHIP)", | ||
| "CMMI - AHEAD", "CMMI - Integrated Care for Kids (IncK)", | ||
| "CMMI - Maternal Opioid Misuse (MOM)", | ||
| "Community Engagement", "Contingency Management", | ||
| "Continuous Eligibility", | ||
| "Delivery System Reform Incentive Payment (DSRIP)", | ||
| "Dental", "Designated State Health Programs (DSHP)", | ||
| "Employment Supports", "Enrollment Cap", | ||
| "End-Stage Renal Disease (ESRD)", "Expenditure Cap", | ||
| "Former Foster Care Youth (FFCY)", | ||
| "Global Payment Program (GPP)", "Health Equity", | ||
| "Health-Related Social Needs (HRSN)", | ||
| "Healthy Behavior Incentives", | ||
| "HIV", "Home Community Based Services (HCBS)", | ||
| "Lead Exposure", "Lifetime Limits", | ||
| "Long-Term Services and Supports (LTSS)", | ||
| "Managed Care", "Marketplace Coverage/Premium Assistance Wrap", | ||
| "New Adult Group Expansion", "Non-Eligibility Period", | ||
| "Non-Emergency Medical Transportation (NEMT)", | ||
| "Partial Expansion of the New Adult Group", "Pharmacy", "PHE-Appendix K", | ||
| "PHE-Reasonable Opportunity Period (ROP)", "PHE-Risk Mitigation", | ||
| "PHE-Vaccine Coverage", "Premiums/Cost-Sharing", | ||
| "Provider Cap", "Provider Restriction", "ReEntry", | ||
| "Reproductive Health: Family Planning", "Reproductive Health: Fertility", | ||
| "Reproductive Health: Hyde", "Reproductive Health: Maternal Health", | ||
| "Reproductive Health: Post-Partum Extension", "Reproductive Health: RAD", | ||
| "Retroactive Eligibility", "Serious Mental Illness (SMI)", "Special Needs", | ||
| "Substance Use Disorder (SUD)", "Targeted Population Expansion", "Tribal", | ||
| "Uncompensated Care","Value Based Care (VBC)", "Vision", | ||
| ]; | ||
| const demonstrationTypes = ["Section 1115", "Section 1915(b)", "Section 1915(c)"]; |
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.
defining demonstrationTypes here might get a little confusing when we start building out the actual demonstrationTypes modal. It looks like that is only used for coming up with demonstration names, so it might be better to call this something like "areaOfFocus" or something.
|
So @connor-parke-icf @tresdonicf Take away from review:
|
|
The DatePicker changes look good to me! Deferring to Connor regarding the seeder changes |
The datepicker works!
Screen.Recording.2025-11-20.at.16.22.54.mov
OPTIONAL:

Some quality of life updates for seeder.
Better dates:
