bcgov / cas-registration

A web app for Registration in OBPS under the Clean Growth branch
Apache License 2.0
1 stars 1 forks source link

Move data transformation to django ninja schemas #755

Open BCerki opened 7 months ago

BCerki commented 7 months ago

Description of the Tech Debt

In some of our forms, we transform the data received from the backend before passing it to an rjsf form. This transformation has caused a couple bugs (e.g. https://github.com/bcgov/cas-registration/pull/729#issuecomment-1912852671), so this ticket is about moving the transformation into a django ninja schema instead (unnest, use resolvers to change type if needed, etc.). Then, we can put the data directly into rjsf without any manipulation on the front end.

Note: django ninja has been updated since we wrote most of our schemas, so while looking at existing examples will help, there may be additional new features that could help with this ticket: https://django-ninja.dev/whatsnew_v1/

The following files need to be refactored:

Tech Debt Triage

The purpose of our technical debt triage process is to analyze technical debt to determine risk level of the technical debt and the value in tackling that technical debt.

Risk Value Scoring:

Level Value
High 3
Medium 2
Low 1
Technical Debt - Risk Types Level Value
Business Area Risk - Risk of business area visibility / damage to user experience
Developer Fault Risk - How likely will this tech debt cause a future error related to coding on top of it
System Fault Risk - Risk of system errors or application downtime
Time Scale Risk - Compound risk effect if left alone. How much more difficult to fix or dangerous will this become over time?
Time Sink Risk - How much will this tech debt slow the development process down
TOTAL SCORE:
andrea-williams commented 5 months ago

@BCerki do you think we still need this ticket?

BCerki commented 5 months ago

@BCerki do you think we still need this ticket?

Yes, I think so--we still have frontend formData conversion happening in client/app/components/routes/operations/form/Operation.tsx and this strategy caused a bug in the past

nanyangpro commented 5 months ago

@marcellmueller suggested splitting it by forms for reviewing purposes.

andrea-williams commented 5 months ago

@BCerki to add to this ticket list of schemas that are involved in this work

BCerki commented 5 months ago

I've left this as a single ticket instead of creating separate tickets per file because the first bullet is just renaming a variable

BCerki commented 3 months ago

This ticket may no longer be relevant if the registration part 2 form is so different it doesn't use the same schemas.