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

Vamc 15446 spike vamc police data page #1753

Merged
merged 21 commits into from
Nov 1, 2023

Conversation

eselkin
Copy link
Contributor

@eselkin eselkin commented Oct 20, 2023

Description

relates to department-of-veterans-affairs/va.gov-cms#15446

Creates a new process for queryType: "curl" in static-data-files

This allows an arbitrarily large number of files to be downloaded via curly/node-libcurl GET and a postProcess step that receives the data in an array and can process the resulting data in any manner needed.

It uses libcurl because node-fetch has problems using file:// URLs which we need for the police instance.

The police postProcess step writes the files to temporary files and reads them in with csvtojson to later process (this ticket only starts the structure, since it is unknown what the format of the CSVs will be at the moment).

Changes were made to the static file creation, in that if any of the files are not present, all are generated. Previously only a test was done to determine if the directory exists, but now that there are multiple processes generating files, it seemed appropriate to convert to a per-file test.

Testing done & Screenshots

Added cypress testing for the existence of all JSON static data files.

QA steps

What needs to be checked to prove it didn't break any related things?
What variations of circumstances (users, actions, values) need to be checked?

  1. Check if https://web-w1a5evfuonymjntciz3pduj1ofhepwky.demo.cms.va.gov/data/cms/vamc-facility-supplemental-status.json exists
  2. Check if https://web-w1a5evfuonymjntciz3pduj1ofhepwky.demo.cms.va.gov/data/cms/vamc-ehr.json exists
  3. Check if https://web-w1a5evfuonymjntciz3pduj1ofhepwky.demo.cms.va.gov/data/cms/vamc-police.json exists
    1. it is an empty object because I didn't want to put fake data into production.

Acceptance criteria

  • A skeleton is started for the general file structure pending any missing information. (e.g., if the output has to be JSON, the Ruby requirements are documented)

Definition of done

  • Events are logged appropriately
  • Documentation has been updated, if applicable (added testing with comments, looking for other locations for other notes about static data files)
  • A link has been provided to the originating GitHub issue (or connected to it via ZenHub)
  • No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs

@va-vfs-bot va-vfs-bot requested a review from a team October 20, 2023 06:08
Copy link
Collaborator

@va-vfs-bot va-vfs-bot left a comment

Choose a reason for hiding this comment

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

ESLint is disabled

vets-website uses ESLint to help enforce code quality. In most situations we would like ESLint to remain enabled.

What you can do

See if the code can be refactored to avoid disabling ESLint, or wait for a VSP review.

@va-vfs-bot va-vfs-bot temporarily deployed to master/main/VAMC-15446-Spike-VAMC-Police-Data-Page October 20, 2023 06:13 Inactive
Copy link
Contributor Author

@eselkin eselkin left a comment

Choose a reason for hiding this comment

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

Following a pattern from drupal graphql static files here. Not sure if at some point we'll need any of these variables.

Copy link
Contributor

@swirtSJW swirtSJW left a comment

Choose a reason for hiding this comment

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

Not really an official review. This is shaping up pretty nicely. Mainly just a couple questions to help me understand it better.

@va-vfs-bot va-vfs-bot temporarily deployed to master/main/VAMC-15446-Spike-VAMC-Police-Data-Page October 20, 2023 21:56 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to master/main/VAMC-15446-Spike-VAMC-Police-Data-Page October 20, 2023 23:23 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to master/main/VAMC-15446-Spike-VAMC-Police-Data-Page October 20, 2023 23:49 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to master/main/VAMC-15446-Spike-VAMC-Police-Data-Page October 21, 2023 00:04 Inactive
@eselkin
Copy link
Contributor Author

eselkin commented Oct 21, 2023

ESLint is disabled

vets-website uses ESLint to help enforce code quality. In most situations we would like ESLint to remain enabled.

What you can do

See if the code can be refactored to avoid disabling ESLint, or wait for a VSP review.

I think this is a funny message, considering this is not a vets-website PR.

@va-vfs-bot va-vfs-bot temporarily deployed to master/main/VAMC-15446-Spike-VAMC-Police-Data-Page October 22, 2023 00:55 Inactive
@eselkin eselkin marked this pull request as ready for review October 22, 2023 01:57
@eselkin eselkin requested review from a team as code owners October 22, 2023 01:57
Copy link
Collaborator

@va-vfs-bot va-vfs-bot left a comment

Choose a reason for hiding this comment

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

ESLint is disabled

vets-website uses ESLint to help enforce code quality. In most situations we would like ESLint to remain enabled.

What you can do

See if the code can be refactored to avoid disabling ESLint, or wait for a VSP review.

@va-vfs-bot va-vfs-bot temporarily deployed to master/main/VAMC-15446-Spike-VAMC-Police-Data-Page October 26, 2023 14:01 Inactive
@eselkin eselkin requested a review from maxx1128 October 26, 2023 16:19
Copy link
Contributor

@maxx1128 maxx1128 left a comment

Choose a reason for hiding this comment

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

The pull request looks good to me, I just have a few suggestions and questions before I'm ready to approve. Overall, it's looking good!

url
.pathToFileURL(join(__dirname, 'vaPoliceData', 'police-events.csv'))
.toString(),
]),
Copy link
Contributor

Choose a reason for hiding this comment

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

This could maybe be simplified so we have an array of the two strings in each pathToFileURL function, and we map them out to get this.

    query: queryVAPoliceData(['police-contact.csv', 'police-events.csv']
              .map(filename => url.pathToFileURL(join(__dirname, 'vaPoliceData', filename)))
    ),

src/site/stages/build/drupal/static-data-files/generate.js Outdated Show resolved Hide resolved
Copy link
Collaborator

@va-vfs-bot va-vfs-bot left a comment

Choose a reason for hiding this comment

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

ESLint is disabled

vets-website uses ESLint to help enforce code quality. In most situations we would like ESLint to remain enabled.

What you can do

See if the code can be refactored to avoid disabling ESLint, or wait for a VSP review.

@va-vfs-bot va-vfs-bot temporarily deployed to master/main/VAMC-15446-Spike-VAMC-Police-Data-Page October 27, 2023 21:51 Inactive
Copy link
Collaborator

@va-vfs-bot va-vfs-bot left a comment

Choose a reason for hiding this comment

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

ESLint is disabled

vets-website uses ESLint to help enforce code quality. In most situations we would like ESLint to remain enabled.

What you can do

See if the code can be refactored to avoid disabling ESLint, or wait for a VSP review.

@@ -3,7 +3,8 @@ describe('Static Data Files Test', () => {
/* This is not a visual test -- no accessibility involvement */
/* eslint-disable @department-of-veterans-affairs/axe-check-required */
it('has the EHR JSON static file', () => {
cy.deleteFileOrFolder('../cypress/downloads/vamc-ehr.json');
cy.deleteFileOrDir('../cypress/downloads/vamc-ehr.json');
cy.fileOrDirExists('cypress/downloads/vamc-ehr.json').should('eq', false);
Copy link
Contributor

Choose a reason for hiding this comment

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

👏

Copy link
Contributor

@rmessina1010 rmessina1010 left a comment

Choose a reason for hiding this comment

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

LGTM

@randimays
Copy link
Contributor

ESLint is disabled

vets-website uses ESLint to help enforce code quality. In most situations we would like ESLint to remain enabled.

What you can do

See if the code can be refactored to avoid disabling ESLint, or wait for a VSP review.

I think this is a funny message, considering this is not a vets-website PR.

Sharp eye 👀 Seems it's just copy/pasta

Copy link
Contributor

@chriskim2311 chriskim2311 left a comment

Choose a reason for hiding this comment

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

LGTM

@eselkin eselkin merged commit 7b9d00a into main Nov 1, 2023
34 checks passed
@eselkin eselkin deleted the VAMC-15446-Spike-VAMC-Police-Data-Page branch November 1, 2023 19:23
@eselkin eselkin restored the VAMC-15446-Spike-VAMC-Police-Data-Page branch November 7, 2023 03:08
@eselkin eselkin deleted the VAMC-15446-Spike-VAMC-Police-Data-Page branch January 18, 2024 00:41
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.

7 participants