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

Use same endpoint for download results as the results list view #8110

Merged
merged 8 commits into from
Sep 23, 2024

Conversation

mpbrown
Copy link
Collaborator

@mpbrown mpbrown commented Sep 11, 2024

BACKEND AND FRONTEND PULL REQUEST

Related Issue

Changes Proposed

  • Updates CSV results downloader to use new GetResultsForDownload query which hits the same endpoint at the main results list view. This makes the results download consistent with the results list by returning the data based on Results rather than TestEvents as the CSV download was previously doing.

Additional Information

  • This change should be okay with any concerns about GraphQL frontend backwards compatibility because it only adds a new query and the AOE survey data is ignored for the regular results list page.
  • Because we are no longer handling the download through TestEvents, but rather through Results directly, this simplifies the logic for the CSV data parsing so we don't have to worry about filtering out any feature disabled diseases from TestEvent data.

Testing

  • Deployed to dev6
  • Use various combinations of filters and make sure the download matches what is shown on the results list page

@mpbrown
Copy link
Collaborator Author

mpbrown commented Sep 11, 2024

Ready for review but noting that the Chromatic CI checks apparently detected some difference with dropdown icons where it is saying that main has these strange overlapping icons while this PR doesn't. Maybe one of the previous Chromatic builds had some visual bug?

Main (seems like some visual bug)
image

PR branch (seems normal as expected)
image

@mpbrown
Copy link
Collaborator Author

mpbrown commented Sep 12, 2024

FYI investigating an error Elisa found that so far only appears on dev6 instead of locally

@bobbywells52
Copy link
Collaborator

Tested a variety of different filter configs in dev6 and everything LGTM. All of the new tests are also passing for me locally. Thanks for your great work on this Mike! I agree with you and Merethe that it makes much more sense to be querying these results from the backend.

One thing of note that is outside the scope of this ticket:
I find it odd that we do include the symptoms and their onset date from the AOE survey as their own respective cols in the CSV but we don't include the pregnancy survey question as a col. Does anyone know if this is a decision that was explicitly made as an implementation decision? If not, should we consider adding pregnancy and the other missing AOE Q's to the results download? CC @DanielSass @jayna-SkylightDigital

bobbywells52
bobbywells52 previously approved these changes Sep 12, 2024
@emyl3
Copy link
Collaborator

emyl3 commented Sep 17, 2024

@mpbrown Something I'm noticing about these changes is that in the downloaded file if there is a date value in the "Symptom onset" column, it is showing up as "Invalid date".

I noticed in other envs we are able to display the correct date if there is a date in that field. Let me know if you can repro.

@mpbrown
Copy link
Collaborator Author

mpbrown commented Sep 17, 2024

@mpbrown Something I'm noticing about these changes is that in the downloaded file if there is a date value in the "Symptom onset" column, it is showing up as "Invalid date".

I noticed in other envs we are able to display the correct date if there is a date in that field. Let me know if you can repro.

Good catch! I'll look into how it's parsing the date

@mpbrown
Copy link
Collaborator Author

mpbrown commented Sep 18, 2024

Setting this back to Draft while I fix up the tests in TestResultTest

@mpbrown mpbrown marked this pull request as draft September 18, 2024 17:12
@mpbrown
Copy link
Collaborator Author

mpbrown commented Sep 19, 2024

@bobbywells52 @emyl3 ready for re-review!

return new ResolvedSurveyData(result.getSurveyData());
}

@SchemaMapping(typeName = "Result", field = "patientLink")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need the patientLink field? I don't think we are using it on the results page or mapping it to the CSV when we download the results 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm pretty sure there was some error it ran into with the tests, but I can't remember what it specifically was so maybe that error was made obsolete by other changes, gonna test out removing that patient link then. patientLink is on the TestResult type which might be on the path to being deprecated in favor of Result now

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For TestResultTest, this line expects patientLink to be there on the result. This old unit test might be left over from when we used to need the patient link on the result but maybe we no longer do? Do you think we should edit/remove the unit test or add patient link for now?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ahhhh oops sorry for missing that! Thank you for looking into that again 😓 I think maybe for now we can put the patientLink field back so the tests could pass and this bug fix can be merged in. Thank you for your patience with me on this 😅 🙏

But if you think it'll be helpful, we can make a tech debt ticket to clean this up. That field doesn't seem to be used (based on my rough reading of the codebase) but probably best to dig more thoroughly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sounds good! I'll create a new ticket to address some of that tech debt around TestResult vs Result overall

@mpbrown mpbrown force-pushed the mike/7948-results-csv-download-query-refactor branch from 5b89bcc to eca5da8 Compare September 20, 2024 14:48
@mpbrown mpbrown requested a review from emyl3 September 20, 2024 14:50
Copy link
Collaborator

@emyl3 emyl3 left a comment

Choose a reason for hiding this comment

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

Left one question to see if filtering by supported disease matters or not... Otherwise looks good to me and tested on dev6 as well!

Copy link

sonarcloud bot commented Sep 20, 2024

Copy link
Collaborator

@emyl3 emyl3 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for your patience with me and addressing my comments!! 🙌 Tested locally (with syphilis feature flag off) and on dev6.

@mpbrown mpbrown added this pull request to the merge queue Sep 23, 2024
Merged via the queue into main with commit 00710d9 Sep 23, 2024
42 checks passed
@mpbrown mpbrown deleted the mike/7948-results-csv-download-query-refactor branch September 23, 2024 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Fix download csv test results filters
3 participants