-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Publisher] Agency Settings - Add new agency-wide Courts + Supervision Subpopulation TIG elements #1541
Conversation
2184fbd
to
c6c4cb9
Compare
publisher/src/components/AgencySettings/IncludesExcludes/includesExcludes.ts
Outdated
Show resolved
Hide resolved
Looks good Mahmoud! Obviously this feature is still in progress, but is there any way to test the structure of this file? Also, is there any way we can add some sort of parity test between the two repos? |
Ah, hmm... I could strongly type the constants in this file and that will enforce each one's structure is consistent - which is a great call - but, let me know if I'm misunderstanding what you mean by testing the structure of this file or if you were thinking of a test for the entire file itself? Here's the strongly typed version: 432806c
There isn't a way that I can think of off the top of my head without having some sort of linkage between the two repos - which I'm not entirely sure how we would do without publishing one as a |
PROBATION_IN_LIEU_INCARCERATION: { | ||
label: | ||
"People sentenced to a period of probation in lieu of incarceration (including to electronic monitoring, home confinement, traditional supervision, etc.)", | ||
default: IncludesExcludesEnum.YES, | ||
}, |
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.
Could you link to where I can find these definitions on the JC websites?
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 can't find it on the link that is in the PR description.
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.
Oh strange - the link in the PR description takes me right to the supervision elements - I forgot to add the courts, which should be updated now.
Here is the a link to the file that Matt posted in Slack which includes both TIG elements along with the respective links to the JC websites that I used as reference: https://recidiviz.slack.com/archives/C04JL8A2ADB/p1727808639123169
Courts: https://jc-tig.netlify.app/courts#criminal-courts
Supervision subpopulations: https://jc-tig.netlify.app/community_supervision#supervision-types
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.
Thank you!!
thank you for this! I think this looks good! My original comment was referring to / asking how can we test that each given IncludesExcludes object is in the structure that the FE expects. However I'm not sure we can test this yet since it's not being used yet (if my understanding is correct) |
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.
Oh, gotcha!! In that case, I think the best way to enforce this/test it is by leveraging TypeScript and strongly typing it. That way, if you try to deviate from the structure you'll get hit with a TypeScript error immediately (directly in the IDE, via a pop-up in the browser when you run the app, and lint test failures). It would accomplish the same thing as if we wrote some quick smoke tests to make sure that each object has all the right fields and how I would go about checking & enforcing the structure. Later on, useful tests for us to include would be - based on the agency's sector, does it show this field in the Agency Settings page - and, when they click the edit button, does it show all of the relevant TIG fields for that sector, and does it show all of the right defaults when they click on the JC definitions, etc.? (Sorry if I'm stating something that might be obvious to you!) But, you gave me another idea to make it even more safe and strict - especially if we want to add more TIG elements in the future - I'll consolidate everything into one object keyed by sector and strictly type that, which will help continue to enforce the structure when we make new additions and leave no room for deviations in structure without also explicitly updating the type. |
OK - this commit bf11169 should be more secure and will error if you don't adhere to the structure: |
Oh, I thought about this a little more - I'm not sure how feasible this would be, but we might actually be able to write something on the |
Description of the change
Add new agency-wide Courts + Supervision Subpopulation TIG elements in preparation for the implementation of this feature outlined in #1540.
Reference TIG:
Also, I changed the folder name from
Settings
->AgencySettings
for more clarity (and b/c it was bugging me a lil' bit).Type of change
Related issues
Closes #1538
Checklists
Development
This box MUST be checked by the submitter prior to merging:
These boxes should be checked by the submitter prior to merging:
Code review
These boxes should be checked by reviewers prior to merging: