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

View Submitted Applications and Their Current Status #13

Conversation

klondikemarlen
Copy link
Member

@klondikemarlen klondikemarlen commented Aug 7, 2023

Relates to:

Depends on:

Context

Right now the portal is only displaying items from the application_draft table, but we need to surface data from the application table as well as assessments and other related things.

The API was returning that information previously, but it's been commented out.

We need a landing page for student applications that has details (non-editable), documents related to the application, letters related to the application, funding requests, etc. formatted similarly to the draft screens. An application dashboard of sorts.

@datajohnson will do the screen design and @klondikemarlen can do the wiring and API work.

Concerns

  1. There are a lot of "ids" that are being passed around, which are not labeled as such.
    e.g. program: 3
    I believe this will cause a lot inconvenience and confusion in the future.
    It is more predictable to sufix it with "id" if it is an ID field.
    e.g. programId: 3
  2. A lot of the data that is being served up might work better if computed in the front-end. Why? Because, if we do it in the back-end, we need to duplicated the conversion process between the draft and application and UI.
  3. Many fields that are being returned as a single blob, would be better served as being retrieved from a model specific endpoint. This would vastly reduce code complexity, increase isolation, and speed up data retrieval.

Expected Endpoints and Data Formats

See https://guides.rubyonrails.org/routing.html#crud-verbs-and-actions for a stable example of route naming conventions.

  • /api/portal/students/:studentId/applications
    • list format (few fields)
  • /api/portal/students/:studentId/applications/:application-id
    • item format (many fields)
  • /api/portal/students/:studentId/draft-applications
    • list format (few fields)
  • /api/portal/students/:studentId/draft-applications/:draft-application-id
    • item format (many fields)

TODO: it might also be worth making flat URL such as

  • /api/portal/applications/:application-id
    TODO: application and draft-application formats should be identical, except for a "type"??? column.
example of list format
{
  "data": [
    {
      "id": 6,
      "studentid": 124479,
      "academicYearId": 2023,
      "createDate": "2023-07-28T19:38:41.000Z",
      "updateDate": "2023-07-28T20:16:15.000Z",
      "isActive": true,
      "submitDate": "2023-07-28T20:16:15.000Z",
      "status": "Submitted",
      "description": "This application was created on July 28, 2023 and last saved 3 days ago."
    }
  ]
}
example of item format
{
  "termsAgree": true,
  "programDetails": {
    "programDuration": "",
    "programName": "",
    "startDate": "",
    "institution": {},
    "yearEntering": "1",
    "startDateOfClasses": "2023-08-02T00:00:00.000Z",
    "institutionId": 2392,
    "studyArea": 618,
    "program": 3,
    "attendance": "Full Time",
    "durationOfProgram": "2",
    "endDateOfClasses": "2024-02-29T20:10:00.000Z"
  },
  "fundingSources": {
    "sources": ["Yukon Grant"],
    "csfaAmounts": "Full amount loans and grants"
  },
  "personalDetails": {
    "firstName": "Marlen",
    "middleName": null,
    "lastName": "Brunner",
    "homeEmail": "klondikemarlen@gmail.com",
    "homePhone": "12342134123",
    "birthDate": "2023-07-28T00:00:00.000Z",
    "sin": "******868",
    "category": 9
  },
  "addresses": {
    "homeAddress1": {
      "first": "asdfsdf",
      "city": 1,
      "region": 3,
      "postal": "Y1A OR1"
    },
    "homeAddress2": {},
    "primary": "Permanent",
    "homeAddress1Id": -1,
    "homeAddress2Id": -1
  },
  "statistical": {
    "language": "French",
    "gender": "Male",
    "disability": "Permanent",
    "maritalStatus": 1,
    "citizenship": 2
  },
  "consent": { "consents": [], "allowOthers": false },
  "residency": {
    "residencyHistory": [
      {
        "start": "2021/05",
        "end": "2023/06",
        "city": 844,
        "province": 3,
        "country": 1,
        "in_school": 1
      }
    ],
    "hasTraveled": 1,
    "lastReturnDate": "2023/08"
  },
  "education": {
    "educationHistory": [{ "leftHighSchool": "2023/02", "school": 310 }]
  },
  "otherFunding": {},
  "studentDependants": { "dependants": [] },
  "csfaAccomodation": {},
  "csfaIncome": { "incomes": [] },
  "csfaExpenses": { "expenses": [] },
  "parents": {},
  "parentDependants": {},
  "spouse": {},
  "documents": {}
}

Data Flow Modeling

How a Draft becomes an Application

NOTE: Students can't edit a submitted application.

Application Submission Pipeline

Testing Instructions

  1. Boot the sfa-client back-end via API_PORT=3100 dev up
  2. Boot the student-financial-aid back-end via
cd /src/api
npm run start
  1. Boot the student-finanacial-aid front-end via
cd /src/web
npm run start
  1. Log in to the app at http://localhost:8080
  2. Go to http://localhost:3000/api/portal/students/16442/applications/30243 and check that disbursements are include in the application -> funding requests -> assessments package.
  3. Another example student is http://localhost:3000/api/portal/students/250/applications/4299

@klondikemarlen klondikemarlen added the enhancement New feature or request label Aug 7, 2023
@klondikemarlen klondikemarlen self-assigned this Aug 7, 2023
@klondikemarlen klondikemarlen force-pushed the student-financial-aid--issues-2/view-submitted-applications-and-their-current-status branch from 75c17a7 to 9408168 Compare August 7, 2023 16:17
@klondikemarlen klondikemarlen added the has unmerged dependencies This PR depends on another PR, which has not been merged. label Aug 7, 2023
@klondikemarlen klondikemarlen force-pushed the student-financial-aid--issues-2/view-submitted-applications-and-their-current-status branch 2 times, most recently from 5931a96 to 3df6832 Compare August 7, 2023 19:38
@klondikemarlen klondikemarlen changed the base branch from test to issue-16/dev-tooling--add-basic-test-suite-setup-to-project August 7, 2023 19:38
@klondikemarlen klondikemarlen force-pushed the student-financial-aid--issues-2/view-submitted-applications-and-their-current-status branch from 3df6832 to d607e73 Compare August 7, 2023 21:22
@klondikemarlen klondikemarlen changed the base branch from issue-16/dev-tooling--add-basic-test-suite-setup-to-project to marlen/dependency-bundle August 7, 2023 21:22
@klondikemarlen klondikemarlen force-pushed the student-financial-aid--issues-2/view-submitted-applications-and-their-current-status branch from 71e8be6 to ec0cac0 Compare August 8, 2023 00:00
@klondikemarlen
Copy link
Member Author

I wish I had Sequelize for eager loading: https://sequelize.org/docs/v6/advanced-association-concepts/eager-loading/

@klondikemarlen klondikemarlen force-pushed the student-financial-aid--issues-2/view-submitted-applications-and-their-current-status branch 2 times, most recently from 9a9d59d to 273439a Compare August 8, 2023 22:56
@klondikemarlen klondikemarlen changed the base branch from marlen/dependency-bundle to issue-16/dev-tooling--add-basic-test-suite-setup-to-project August 8, 2023 22:56
@klondikemarlen klondikemarlen force-pushed the student-financial-aid--issues-2/view-submitted-applications-and-their-current-status branch from 3e2993b to 51152ea Compare August 8, 2023 23:49
@klondikemarlen klondikemarlen force-pushed the issue-16/dev-tooling--add-basic-test-suite-setup-to-project branch from e9d3ce3 to 228e549 Compare August 9, 2023 23:13
@datajohnson
Copy link

datajohnson commented Aug 10, 2023

{ 
 application: {
   id:1235, 
   fundingRequests: [
     { 
       request_type_id: 2,
       ... 
       assessments: [
         {
           id:112, 
           disbursements: []  
         }
       ]
     }
   ]
}

@klondikemarlen klondikemarlen force-pushed the issue-16/dev-tooling--add-basic-test-suite-setup-to-project branch from 52a33d1 to bdc04e7 Compare August 10, 2023 19:02
@klondikemarlen klondikemarlen force-pushed the student-financial-aid--issues-2/view-submitted-applications-and-their-current-status branch 3 times, most recently from e89fe1e to 24ff7ba Compare August 10, 2023 20:44
Base automatically changed from issue-16/dev-tooling--add-basic-test-suite-setup-to-project to test August 11, 2023 14:39
@klondikemarlen klondikemarlen marked this pull request as ready for review August 11, 2023 15:18
@klondikemarlen klondikemarlen force-pushed the student-financial-aid--issues-2/view-submitted-applications-and-their-current-status branch from df15696 to 424ffda Compare August 11, 2023 15:41
}

asDetailedView() {
return this.#applicationDraft
Copy link
Member Author

Choose a reason for hiding this comment

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

In the future, it would probably be a good idea to unpack the JSON hear and camelize all the keys.

Copy link
Member Author

Choose a reason for hiding this comment

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

See fa52c93

I wasn't returning ids for sub-objects as part of the parent object.
A person might not have a sex or language so these need to be left joins to avoid excluding valid person data.
Why? To match the table name. Yeah its redundant, but I think simplicity is best for now.
I haven't been adding all the relationships, just the ones I've used so far.
Why? To make room for actual funding requests section.
Why? So I can generate the massive ERD that this project uses.
@klondikemarlen klondikemarlen force-pushed the student-financial-aid--issues-2/view-submitted-applications-and-their-current-status branch from 424ffda to b7e8d27 Compare August 11, 2023 18:59
@klondikemarlen klondikemarlen removed the has unmerged dependencies This PR depends on another PR, which has not been merged. label Aug 11, 2023
Copy link

@datajohnson datajohnson left a comment

Choose a reason for hiding this comment

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

It'll be interesting to try out the new controller pattern!

@datajohnson datajohnson merged commit 4d7dec5 into test Aug 11, 2023
@datajohnson datajohnson deleted the student-financial-aid--issues-2/view-submitted-applications-and-their-current-status branch August 11, 2023 20:31
@klondikemarlen
Copy link
Member Author

klondikemarlen commented Aug 11, 2023

It'll be interesting to try out the new controller pattern!

Yay! Partially, its about making space for code to grow, but it also provides a standard way to assemble routes, making it easier to identify all available routes.
i.e.

/some-route + action -> maps to -> some-controller.

At some point, I'm going to put a readme in each folder to define the specific boundaries and responsibilities associated with each object type. Mostly I'm just copying from Rails, because what they have works really well at scale.

@klondikemarlen
Copy link
Member Author

klondikemarlen commented Aug 11, 2023

If we were using a heavier library than Express we would get these kinds of things for free, so we may want to investigate that avenue at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants