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

TYLERB/APPEALS-30892: Report Generation through ‘Generate task report’ button #20024

Merged
merged 70 commits into from
Dec 20, 2023

Conversation

TylerBroyles
Copy link
Contributor

@TylerBroyles TylerBroyles commented Nov 22, 2023

Resolves APPEALS-30892
Epic link: https://jira.devops.va.gov/browse/APPEALS-26499

Description

The primary purpose of this PR is to link the Report Page form submission, the change history event generation, and the csv creation together. This PR also creates all of the mappings between the form values and the backend values in the ReportPage.jsx ui component and the DecisionReviewsController in order to prepare the values for use in event generation. In addition to the primary focus, there were additional changes made to the change history query to accommodate AttorneyClaimants and Unrecognized claimants. The query was also changed to work with the completed_by_id field on a task in addition to the already working task version whodunnit value for determining which user completed a task/disposition.

Acceptance Criteria

  • CSV
    • The CSV fields for each event type match the example CSV or what UI/UX has decided it should be
    • Name of the .csv is ‘taskreport-date_time.csv’ e.g.taskreport-20231122_1323.csv.
    • The filter params are displayed as the first row of the CSV and it matches designs
    • The second row of the CSV is the column headers and it matches designs
    • The CSV generated has the correct event data for the filters that were given
  • Report Generation
    • Status report
      • All statuses can be generated with any number of conditions
      • Specific statuses can be generated with any number of conditions
      • Last action taken can be generated with any number of conditions
      • Summary can be generated with any number of conditions
    • Event report
      • All events report can be generated with or without timing
      • Specific events report can be generated with or without timing
    • Conditions
      • Issue dispositions condition is passed down and correctly used in the event generation
      • Issue Types condition is passed down and correctly used in the event generation
      • Facilities condition is passed down and correctly used in the event generation
      • Personnel condition is passed down and correctly used in the event generation
      • Days waiting condition is passed down and correctly used in the event generation
    • General form behavior
      • The ui accurately reflects that a CSV is being generated and indicates that a CSV has been generated
      • The submission button is disabled while the CSV is being generated
      • The Form fields do not get reset after clicking the submit button
      • The Clear filters button should reset the form to a default state and none of the original form data should be used if the form is submitted again

Testing Plan

  1. Login as a user that is an admin of the vha business line.
  2. Navigate to the report page at the url /decision_reviews/vha/report
  3. On the Report page verify that you can generate a report by clicking and that it creates a CSV with the file name of taskreport-date_time.csv.
  4. Verify that the filter row in the CSV includes the report type of event and timing.
  5. Verify that the column header rows in the CSV is correct and matches the designed spreadsheet.
  6. Verify that the event rows are correct for your data
  7. Try out an event submission with specific events filtered and a timing
  8. Try out a status submission with the last action taken submitted and verify that each task in your data only has one event per task in the CSV and it's the last action taken on that task.
  9. Try a status submission of type summary. It should be the exact same results as a default event report submission.
  10. Try an Issue Type condition with one or many values and verify that the data is only issues that include that issue type.
  11. Try an Issue Disposition condition with one or many values and verify that the data is only issues that include that disposition value
  12. Try a days waiting condition and verify the data
  13. Try a facilities condition and verify that the events showing were performed by a user from that station.
  14. Try a personnel condition (it can't be done at the same time as facilities) and verify that the events in the CSV were performed by that user
  15. Try a decision reviews condition and verify that the events showing are of the correct claim type that you selected.
  16. Try a lot of different permutations of various conditions and report types until satisfied.
  • For feature branches merging into master: Was this deployed to UAT?

Frontend

User Facing Changes

  • Screenshots of UI changes added to PR & Original Issue
BEFORE AFTER

Storybook Story

For Frontend (Presentation) Components

  • Add a Storybook file alongside the component file (e.g. create MyComponent.stories.js alongside MyComponent.jsx)
  • Give it a title that reflects the component's location within the overall Caseflow hierarchy
  • Write a separate story (within the same file) for each discrete variation of the component

Backend

Database Changes

Only for Schema Changes

  • Add typical timestamps (created_at, updated_at) for new tables
  • Update column comments; include a "PII" prefix to indicate definite or potential PII data content
  • Have your migration classes inherit from Caseflow::Migration, especially when adding indexes (use add_safe_index) (see Writing DB migrations)
  • Verify that migrate:rollback works as desired (change supported functions)
  • Perform query profiling (eyeball Rails log, check bullet and fasterer output)
  • For queries using raw sql was an explain plan run by System Team
  • Add appropriate indexes (especially for foreign keys, polymorphic columns, unique constraints, and Rails scopes)
  • Run make check-fks; add any missing foreign keys or add to config/initializers/immigrant.rb (see Record associations and Foreign Keys)
  • Add belongs_to for associations to enable the schema diagrams to be automatically updated
  • Document any non-obvious semantics or logic useful for interpreting database data at Caseflow Data Model and Dictionary

Integrations: Adding endpoints for external APIs

  • Check that Caseflow's external API code for the endpoint matches the code in the relevant integration repo
    • Request: Service name, method name, input field names
    • Response: Check expected data structure
    • Check that calls are wrapped in MetricService record block
  • Check that all configuration is coming from ENV variables
    • Listed all new ENV variables in description
    • Worked with or notified System Team that new ENV variables need to be set
  • Update Fakes
  • For feature branches: Was this tested in Caseflow UAT

Best practices

Code Documentation Updates

  • Add or update code comments at the top of the class, module, and/or component.

Tests

Test Coverage

Did you include any test coverage for your code? Check below:

  • RSpec
  • Jest
  • Other

Code Climate

Your code does not add any new code climate offenses? If so why?

  • No new code climate issues added

Monitoring, Logging, Auditing, Error, and Exception Handling Checklist

Monitoring

  • Are performance metrics (e.g., response time, throughput) being tracked?
  • Are key application components monitored (e.g., database, cache, queues)?
  • Is there a system in place for setting up alerts based on performance thresholds?

Logging

  • Are logs being produced at appropriate log levels (debug, info, warn, error, fatal)?
  • Are logs structured (e.g., using log tags) for easier querying and analysis?
  • Are sensitive data (e.g., passwords, tokens) redacted or omitted from logs?
  • Is log retention and rotation configured correctly?
  • Are logs being forwarded to a centralized logging system if needed?

Auditing

  • Are user actions being logged for audit purposes?
  • Are changes to critical data being tracked ?
  • Are logs being securely stored and protected from tampering or exposing protected data?

Error Handling

  • Are errors being caught and handled gracefully?
  • Are appropriate error messages being displayed to users?
  • Are critical errors being reported to an error tracking system (e.g., Sentry, ELK)?
  • Are unhandled exceptions being caught at the application level ?

Exception Handling

  • Are custom exceptions defined and used where appropriate?
  • Is exception handling consistent throughout the codebase?
  • Are exceptions logged with relevant context and stack trace information?
  • Are exceptions being grouped and categorized for easier analysis and resolution?

@TylerBroyles TylerBroyles changed the base branch from master to feature/APPEALS-26499 November 22, 2023 23:29
Copy link

codeclimate bot commented Nov 22, 2023

Code Climate has analyzed commit cc807cb and detected 0 issues on this pull request.

View more on Code Climate.

…erver side mapping. Fixed a bug where the date object was not being preserved when converting the object keys to snake case in the ApiUtils convertToSnakeCase recursive method. Updated the decision reviews controller spec to match the new change history filter strong params definitions. Started a spec file for the change history reporter class and added a few tests to it.
…VHA. Added in a css class to make adding feature tests for it easier.
…ry to fill out some conditions on the form and submit the page. Also added some code to check the generated CSV.
…clude last event for each task_id if the status filter for 'last_action_taken' is one of the included filters.
…number for claims without intakes. It now joins to both of the claim tables and coalesces the veteran file number field from the 3 tables.
… using the BGS_FACILITY_CODES json file. Also added this helper to the as_csv instead of the user_facility getter.
… the event generation to be incorrect since the first version state change is handled differently from the rest.
…ere being modified by the QueryBuilder. Altered the way that the filter params are being formatted by the change history csv reporter. Fixed a bug where the specific event filter parser was containing event filters that were not checked anymore. Added the report type to the parsed filters so it can be displayed in the change history csv reporter.
…history event spec to use the new readable facility name helper for the csv_method test. Updated the change history reporter test to use the new filter formatting. Fixed the claim history service spec to work with the updated task factory and added a new test for the 'last_action_taken' status_report_type filter.
 it's instance variable instead of passing around params.
…dded_issue events instead of added_issue_without_decision_date events.
…ded an edge case fall back that could happen if the request issue that was being parsed was not added during intake and the request issue update that is being parsed in the same database row is the correct request issues updates row. Added a test to support this and updated tests to work with this fallback.
… since it is already storing the results in the events attribute. Removed the filters= and replaced it with an attr writer. Moved some of the event array checks into constants instead of method declarations. Added an additional checkto the request issue updates database fetch fallback to avoid a database hit if there is no request issues update or intake for a claim.
…row that is being parsed is the request issue that is being processed for the request issue update.
…fetching. Removed some todo statements. Fixed other code climate issues.
…o test the format of every type of event when it is converted into a csv row.
@craigrva craigrva changed the base branch from master to feature/APPEALS-26499 December 14, 2023 19:49
…eing passed down to the server as 'last_x_days' when the backend was expecting 'last x days'.
… in the database that do not have a disposition. Added the 'Blank' filter into the claim history service class as well. Added rspec tests for the business line and claim history service to cover this new filter.
…nd as a fallback in the event generation so those issues would not be completely blank. Adjusted how the filter gets displayed in the csv and changed the test to match.
@TylerBroyles TylerBroyles marked this pull request as ready for review December 20, 2023 15:14
@craigrva craigrva merged commit fda3869 into feature/APPEALS-26499 Dec 20, 2023
13 of 14 checks passed
@craigrva craigrva deleted the TYLERB/APPEALS-30892 branch December 20, 2023 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ART: VHA Change History: Claims Report History javascript Pull requests that update Javascript code Product: Decision Review Queues ruby Pull requests that update Ruby code Stakeholder: VHA Functionality associated with Veterans Health Administration workflows/feature requests Team: Saturn 🪐 A development team for the VHA business line
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants