bcgov / digital-journeys

PSA Forms System
https://bcgov.github.io/digital-journeys/
Apache License 2.0
8 stars 7 forks source link

SL Review: Ability to search within BC gov by name #572

Closed HasanSifat closed 1 year ago

HasanSifat commented 2 years ago

User Story As an ADM filling out the SL review form, I want to be able to search for anyone in the government with his/her name so that i cant easily select the person I want to nominate for the process

Tasks

Acceptance Criteria

bhumin-fw commented 2 years ago

@HasanSifat @T854236 Explore the below API to fetch employee details. https://analytics-testapi.psa.gov.bc.ca/apiserver/api.rst#Datamart_PECSF_employee_demo

question: Can we apply filer on name, first/last name here?

In this API we can apply filters as per below. Search is a query param, it applies search in all the text fields. like name, supervision name, email, city, position, etc. Let's see how it works, Request URL: https://analytics-testapi.psa.gov.bc.ca/apiserver/api.rsc/Datamart_Telework_employee_demo?$search='mark' Result: Mark L Bakusko, L. Darcy Houston, Wendy Knott Notes: Here, the first result(Mark L Bakusko) looks good. The second and 3rd names do not match with the keyword 'mark' still we see those in the result because their supervisor name is Mark Carter & Mark Van Tassel respectively.

question: Can we apply filter based on supervison_email? In this form ADM/Supervisors add details for employee who reports them. we can run API https://analytics-testapi.psa.gov.bc.ca/apiserver/api.rsc/Datamart_Telework_employee_demo?$filter=supervisor_email eq 'xxxxlda.xxxxxio@gov.bc.ca' to get employee whose supervisor email match with the provided. It helps to eliminate security risks like any user trying to access employees who are not reporting to them.

T854236 commented 2 years ago

Using the $filter function of the API service allows better control on what fields to filter vs. the search function. As you have discovered, it will search for all fields and return records that matches the criteria.

bhumin-fw commented 2 years ago

@T854236 filter does not allow a LIKE kind of query on the string value. And if possible then I want to know that keyword(that search in the field as LIKE in SQL) it works with a short form like eq (equal), or gt (greater than). In employee search, we do not have a full name to match using eq. We have to pass a partial name and expect to autocomplete the result on it(LIKE query in SQL).

notjustinchoy commented 2 years ago

Please try this: https://analytics-testapi.psa.gov.bc.ca/apiserver/api.rsc/Datamart_Telework_employee_demographic?$search='insert partial name' This endpoint has two differences in comparison to Datamart_Telework_employee_demo:

  1. Only 1 row is returned per employee (even if they have concurrent positions).
  2. Only the name column is searchable. Using the $search filter function translates to a LIKE in SQL.

If you have any other questions, please email me.

Stella-Archer commented 2 years ago

we've got the ok signal from the PIA people to hook up the end points & test

HasanSifat commented 2 years ago

tested successfully in DEV. One issue I noticed, once a selection has been made, it's difficult to cut through to re-edit the field. There is a small cross button that needs to be clicked to remove that name and select a new one. Being able to press backspace would be more friendly from an accessibility point of view.

image.png

bhumin-fw commented 2 years ago

@HasanSifat For now, it enables you to start a new search without clicking on the x icon. When you click on the name again it will open a search popup and you can begin typing a new name.

The same control is not allowed in the selected name itself. It's a select component hence value cannot be changed. To enable backspace in the name, we must introduce a new component in which we will add a text box, and attach a search popup that connects with a remote API. It seems a little bit bigger task here as we are trying to replicate features from one to another component. @simensma-fresh @iman-jamali-fw Let's connect and see if its fesible and try to estimate efforts.

simensma-fresh commented 2 years ago

@bhumin-fw @HasanSifat Agreed! Making it into more of a textbox (with back button support) would be a fairly big effort as it's currently not supported by form.io

HasanSifat commented 2 years ago

@bhumin-fw @simensma-fresh That makes sense. The team has agreed to stick with the drop-down field. Also I tested the feature to day this morning. It's not working right now

@EduardoRamirezBC @JodiLittle please review and confirm if this feature is working correctly and as per requirements for you.

HasanSifat commented 2 years ago

@bhumin-fw the enter name field is still not working in Dev. Did you have a chance to look at it? the pre-population fields are also not filling out with that selected person's info

bhumin-fw commented 2 years ago

@HasanSifat I'm trying to generate the same scenario on dev or local, But no luck, It works fine for Simen, Iman, and mine login. I did check issues in the form-io library but no such issue logged so far. I'll keep you posted if I'll find anything that we can note down or fix in the form itself.

Meanwhile, could you please check with anyone else on your side if its working fine or not?

HasanSifat commented 2 years ago

@bhumin-fw One bug I noticed, the search field does not refresh if someone made a typo. The search feature does not give out any options if I remove anything I typed before

bhumin-fw commented 2 years ago

@HasanSifat Fixed the issue of the typo and the search just stop loading new data. Now it will start searching as soon as you type minimum 3 characters in the search box.

HasanSifat commented 2 years ago

Looks good in DEV. Ready to be transferred to TEST/PROD

T854236 commented 2 years ago

confirming the endpoint used is deployed to PROD for the BI API service.

MeghanStothers commented 2 years ago

Okay to move test

HasanSifat commented 2 years ago

After initial UX testing, we identified a bug with the search field where it stops giving options after users type in something wrong. @bhumin-fw i can debrief you on this on monday

Video recording to show the bug- https://images.zenhubusercontent.com/439477060/38ae53c1-a61f-4ec2-bdca-2ff2c710a7f6/recording_1665787283509.mp4

simensma-fresh commented 2 years ago

@HasanSifat This happens if you type special characters in the search field (the ' in O'leary), but works if you do not add any special characters. It's going to take a bit of effort to get this fixed, so it will not be fixed for the testing tomorrow

HasanSifat commented 2 years ago

Thanks @simensma-fresh at least we now know what is causing the search feature to break. We can address this in our test tomorrow by informing the ADMs if needed and it looks like a refresh of the page makes the search work again.

MeghanStothers commented 2 years ago

Works fine except those special characters notes above - Bhumin working on this one.

bhumin-fw commented 2 years ago

@HasanSifat Fix the special character break search functionality issue. Also, handle errors so search functionality will not be blocked. It's available to test on DEV.

HasanSifat commented 2 years ago

Tested successfully in DEV. Ready to be transferred to TEST/PROD

JodiLittle commented 2 years ago

Approved

HasanSifat commented 2 years ago

tested successfully in TEST