311-data icon indicating copy to clipboard operation
311-data copied to clipboard

DEV - validate filters form and load SR data on form submit

Open rayneng opened this issue 1 year ago β€’ 14 comments

Overview

We need data to be loaded when users submit a query with search criteria rather than on page load, per Blank Map user flows.

More Info

On page load, we are loading the entire 2025 (or current year) dataset. This is an instance of overfetching, we have loaded more data into memory than we intend to use. The design team has provided us user flows on how to discourage overfetching by requiring users to select all search criteria before submitting their data fetch:

Click to see: πŸ†Ž Helpful abbreviations

SR = service request NC = neighborhood council

Click to see: πŸ” All filter criteria

  • 🏘️ Neighborhood Council
    • address search can select a neighborhood council IFF the searched address falls within an NC
    • the neighborhood council dropdown will also result in the selection of a neighborhood council
  • πŸ“† Date Range
    • user selects a start-date and end-date from these dropdowns
  • 🎯 Request Types
    • user must select at least one option in this multi-select
  • πŸ“‚ Request Status
    • user must select at least one option in this multi-select

What Not to Implement

Click to see: ❌ Which features are NOT part of this ticket

This ticket will NOT implement:

  • filtering HF or socrata data:
    • https://github.com/hackforla/311-data/issues/2013
    • https://github.com/hackforla/311-data/issues/1937
  • updated date-selector
    • https://github.com/hackforla/311-data/issues/1868
  • address form bugs
    • https://github.com/hackforla/311-data/issues/1931
  • map zoom behavior changes
    • https://github.com/hackforla/311-data/issues/1989
  • new confirmation modals, error modals
    • e.g. within "Finalized Handoff": https://github.com/hackforla/311-data/issues/1944#finalized-handoff
    • new modals incoming
      • https://github.com/hackforla/311-data/issues/2010
      • https://github.com/hackforla/311-data/issues/2009


Action Items

Dev Todo Items

Modify Form Elements

  • [x] Add a new button, "Display Data"
  • [x] Modify export button to appear under "Display Data"
  • [x] Request status selection now is a multi-select (rather than Open, Closed, All radio buttons)

Modify Form Controls

  • [x] Display Data button triggers form validation error messages if any validation is un-met, only fetches data if there are no validation errors
  • [x] export button becomes disabled until data is successfully fetched and loaded

Add Form Validations (see Developer Resources: Input Validation)

  • [x] either address search or Neighborhood Council dropdown valid input required (e.g. one and only one NC must be selected)
  • [x] a start date and end date must be selected
    • [x] If both are missing β†’ "Please select a date range"
    • [x] If only start date is missing β†’ "Please select a start date"
    • [x] If only end date is missing β†’ "Please select an end date"
  • [x] at least one request type should be selected
  • [x] at least one request status should be selected

Modify Data Flow

  • [x] Remove data from being loaded in 's componentDidMount()
    • ensure Map/index.jsx::createRequestsTable() is not called, as this triggers download of the HF parquet file
    • ensure Map/index.jsx::setData() is not called, leaving it in will likely crash the component
  • [x] Hook up the Display Data button's on-click to Redux so that it triggers data to be downloaded
    • createRequestsTable() and setData() can be called when this Redux action is called

Ticket Bookkeeping

  • [ ] https://github.com/hackforla/311-data/issues/1989
    • [x] remove the dependency label
    • [ ] move the ticket to New Issue Approval
    • [x] add "ready for dev lead" label

Resources/Instructions

Developer Resources: Input Validation

Click to see details on: 🚨 Form validation elements

Error Hexcode #DE2800

#DE2800

Screenshot with designer notes on validation

Image

Screenshot of validation errors, zoomed in

Image

Related Tickets

  • https://github.com/hackforla/311-data/issues/1868

Figma

  • Figma Section: Hand-Off - Issue #1944
  • Related Design Ticket: https://github.com/hackforla/311-data/issues/1944

Screenshots

Screenshot before proposed changes

Image

Screenshot of Figma

Entire Flow (reference only)

Image

Entire Flow (filtered for #2035 dev requirements)

Image

Search and Filters Modal (annotated)

  • section in yellow designates that we do not need to implement new date-picker styles (see What Not to Implement) Image

Screenshot of new feature from localhost

[insert screenshot here]

rayneng avatar Sep 13 '25 23:09 rayneng

Wanted to confirm that the screenshot under Entire Flow (reference only) is the old flow, and I should base this new implementation on the figma screenshot in Entire Flow (filtered for #2035 dev requirements). Essentially going to get rid of those loading modals as well (on top of the defined action items)?

githelsui avatar Sep 14 '25 02:09 githelsui

TLDR: the sections in red is work marked for future dev tickets (and some future design+dev tickets). This user-flow is quite large, and so we are needing to do partial handoffs to keep work manageable for individual volunteers.

@githelsui I've updated Entire Flow (filtered for #2035 dev requirements) to indicate that the parts marked in red are for future tickets. For full context on the Blank Map flow, see the following resources:

  • https://github.com/hackforla/311-data/issues/1943
    • https://github.com/hackforla/311-data/issues/1848
      • (see dropdown below to peek at low-fidelity user flow)

Hopefully that puts this ticket's Figma designs into context. If you follow #1944's Figma from section to section, you can see how it implements the low-fidelity user-flow.

Click to see: Low fidelity blank map user flow

Image

rayneng avatar Sep 14 '25 19:09 rayneng

Lastly, @githelsui please provide your initial update:

Instructions
  1. Progress: "What is the current status of your project? What have you completed and what is left to do?"
  2. Blockers: "Difficulties or errors encountered."
  3. Availability: "How much time will you have this week to work on this issue?"
  4. ETA: "When do you expect this issue to be completed?"
  5. Pictures (if necessary): "Add any pictures that will help illustrate what you are working on."
  1. ~Progress:~
  2. Blockers:
  3. Availability:
  4. ETA:
  5. ~Pictures (if necessary):~

rayneng avatar Sep 14 '25 20:09 rayneng

@ryanfchase Thanks for providing that clarification! The diagram is now easier to follow and it is helpful to know how this ticket fits into the larger scope of the user flow.

Progress:

Blockers:

  • N/A

Availability: Fri-Sun

ETA: 2 wks

Pictures:

Pictures

Image

githelsui avatar Sep 15 '25 02:09 githelsui

@githelsui per design team, they've asked that we make the start/end date validation message as follows:

  • If both start date & end date are missing β†’ "Please select a date range"
  • If only start date is missing β†’ "Please select a start date"
  • If only end date is missing β†’ "Please select an end date"

I have updated the Action Items in the main ticket to reflect this. I don't think it will affect scope too greatly, but let me know if you are concerned. Thanks!

rayneng avatar Sep 15 '25 07:09 rayneng

@ryanfchase Thanks for the updates. The details for the new date validation is easy to follow. Will reach out if I run into any other blocks.

githelsui avatar Sep 16 '25 04:09 githelsui

Hey @githelsui , we've added action items, "Ticket Bookkeeping" to help us manage the project board after you've completed your action items. If you have any questions, @ryanfchase can help you with that once you get there. Thank you!

danagfleming avatar Sep 16 '25 20:09 danagfleming

Progress:

Feature Branch: /2035-validate-filters-form-load-sr Section 1: Modified Form Elements

  • Updated Request Status Selection to multi-select

Blockers: N/A

Availability: Fri-Sun

  • Note: Won’t have as time to work on this as it's been extremely busy time at work and need to do overtime some days for it.

ETA: 2 wks

Pictures: Image

githelsui avatar Sep 22 '25 05:09 githelsui

Progress:

Feature Branch: /2035-validate-filters-form-load-sr

COMPLETED:

  • Section 2: Modified Form Control
    • Display Data button triggers form validation error messages
  • Section 3: Added Form Validations
    • Address OR Council Validation
    • Request Type Validation
    • Request Status Validation CURRENT TO- DO
  • Date Range Form Validation
  • Disable Export Button

Blockers:

  • Section 3: Date Range Form Validation:
    • @ryanfchase The current DateSelector does not have a way for me to test a case where there is no startDate or endDate as the DatePicker requires user to input these two regardless. What can I do in this case? I believe I am not suppose to update the DateSelector to the new design for this ticket, but I may have misunderstood.

Availability: Fri-Sun

Note: Won’t have as time to work on this as it's been extremely busy time at work and need to do overtime some days for it. ETA: 2 wks

Pictures:

  • Select Display Data -> Invalid Form Image

  • Select Display Data -> Valid Form Image

githelsui avatar Sep 23 '25 05:09 githelsui

Progress:

Feature Branch: /2035-validate-filters-form-load-sr

COMPLETED:

Section 2: Modified Form Control

  • Export button disabled until data is fetched and loaded Section 4: Modified Data Flow
  • Hooked up Display Data button from FilterMenu component to Redux to trigger data download

Blockers:

  • Section 3: Date Range Form Validation (Continued)
  • Section 4: Removing createRequestTable() and setData() from componentDidMount() causes page to stay stuck on loading modal on initial load of site
  • Some issues with the new Display Data button trigger: - Loading time for new Display Button takes quite a while, not sure if this is normal (Pin load time: 153581 ms) - How to trigger zoom into selected address pin? My current version does not do this, but not sure if I need to implement that in this ticket [Ref Image 1].
[Ref Image 1] Image below of valid address without selected address pin on the map

Image

Availability: Fri-Sun Note: Won’t have as time to work on this as it's been extremely busy time at work and need to do overtime some days for it.

ETA: 2 wks

Pictures:

Disabled Export Button with Invalid Form

Image

Enabled Export Button with Valid Form and Triggers Redux to Fetch Data


Console Show Printed Logs For:
- New redux action triggered by Display Data button: TRIGGER_DISPLAY_DATA
- Redux actions for getting DB requests: GET_DB_REQUEST_SUCCESS
- Redux action for resetting display data for the ability to make another query: RESET_DISPLAY_DATA Image

githelsui avatar Sep 23 '25 23:09 githelsui

Progress:

Feature Branch: /2035-validate-filters-form-load-sr

COMPLETED: Section 2: Modified Form Control

  • updated DateSelector and DatePicker to be empty (startDate, endDate = null) upon initial load
  • Implemented UI errors for invalid form for empty date picker values

Section 3: Modified Data Flow

  • createRequestsTable() and setData() are no longer being called upon initial website load
  • updated initial state for isDbLoad to false for redux data.jsx to prevent loading modal from appearing on initial website load

TO-DO:

  • Update DatePicker so that dates can be selected (currently blocked due to blank initial dates, refer to Blockers section for more details)
  • Continue logic for Date Form Validation: need to account for if only start date, or if only end date is missing

Blockers:

  • DateSelector will not allow user to select a date after my updates making the initial dates state empty/null

ETA: My work capacity has increased at my place of work so my availability for this ticket has decreased for the next week. Will continue to work on this ticket on my free hours (Fri, Sundays)

Pictures:

  • Invalid Form Validation for all fields (now including Dates): Image

githelsui avatar Oct 03 '25 23:10 githelsui

Progress:

Feature Branch: /2035-validate-filters-form-load-sr

COMPLETED:

  • Accounted for date form validation:
    • both start and end date are missing returns Please select a date range
    • end date not selected returns Please select an end date
  • Resolved block regarding DateSelector not allowing user to select a date after updating the initial dates' state as empty/null for the blank map implementation
    • Fixed by updating its child component ReactDayPicker so that dates can be selected with edits to the onClick event

TO-DO:

  • Continue logic for Date Form Validation, need to account for
    • CASE: if only start date is missing (ReactDayPicker's first user selection will always bet he start date... applied this case's validation in the form validation but have not been able to test)
  • Resolve bug with Search Address Section - flags as null input even with contents inside search bar after each Display Data click (need more time to look into this, related to a flag to manually check if content existed in search bar)

Blockers: N/A

ETA: My work capacity has increased at my place of work so my availability for this ticket has decreased for the next week. Will continue to work on this ticket on my free hours (Fri, Sundays)

Pictures:

DateSelector now able to initially load with empty dates, and user can now select dates: Image

DateSelector with only start date selected, but missing end date selection: Image

DateSelector missing both start date and end date selection: Image

githelsui avatar Oct 15 '25 04:10 githelsui

Progress:

Feature Branch: /2035-validate-filters-form-load-sr

COMPLETED:

  • Accounted for all date form validation cases:
    1. both start and end date are missing returns Please select a date range
    2. end date not selected returns Please select an end date
    3. start date not selected returns Please select a start date

TO-DO:

  • Resolve bug with Search Address Section - flags as null input even with contents inside search bar after each Display Data click (need more time to look into this, related to a flag to manually check if content existed in search bar)

Blockers: Resolving bug with Address Section

ETA: My work capacity has increased at my place of work so my availability for this ticket has decreased for the next week. Will continue to work on this ticket on my free hours (Fri, Sundays)

Pictures:

Start Date Missing

Returns 'Please select a start date' Image

End Date Missing

Returns 'Please select an end date' Image

Both End and Start Date Missing

Returns 'Please select a date range' Image

githelsui avatar Oct 29 '25 23:10 githelsui

Progress:

Feature Branch: /2035-validate-filters-form-load-sr

COMPLETED:

  • Resolved bug regarding Search Address Section:
    • Previous Error: When clearing search bar, form validation does not register the search bar as empty and incorrectly approves the form
    • Solution: Include an event listener that listened to 'clear' events for the geocoder (search bar) and send an empty string to FilterMenu when this is triggered to indicate that the search bar has been cleared. This updates the form validation inputs required in the FilterMenu as well.

ETA: My work capacity has increased at my place of work so my availability for this ticket has decreased for the next week. Will continue to work on this ticket on my free hours (Fri, Sundays)

Pictures:

Resolved Bug

1. Valid search address Input 2. Select Display Data 3. Reset search address input 4. Successful form validation for empty search address after resubmission (Bug now resoled)

githelsui avatar Nov 19 '25 00:11 githelsui