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

Setup MaternalHealthProvider.ts #3304

Closed
8 tasks done
benhammondmusic opened this issue May 15, 2024 · 3 comments · Fixed by #3324
Closed
8 tasks done

Setup MaternalHealthProvider.ts #3304

benhammondmusic opened this issue May 15, 2024 · 3 comments · Fixed by #3324

Comments

@benhammondmusic
Copy link
Collaborator

benhammondmusic commented May 15, 2024

Setting Up a New Data Provider

  • Create a new file named [YourDatasetName]Provider.ts in the frontend/data/providers/ directory.
  • Define a new class that extends VariableProvider. This class will encapsulate all functionality related to your dataset.
  • Initialize the provider with a unique identifier and a list of metric IDs that this provider will handle in the class constructor. These metric ids will be the column names for float data from the backend source, like {condition}_per_100k and {condition}_estimated_total
  • Implement the required methods based on the abstract methods in VariableProvider:
    • getDataSetId: Determines the correct dataset ID based on the provided breakdowns. The returned DatasetId will be the same as the BigQuery data_source + - + BigQuery table_name : e.g. cdc_hiv_data-sex_state_current
    • getDataInternal: Fetches and processes the data according to the metric query, applying filters and returning a MetricQueryResponse.
    • allowsBreakdowns: Checks if the requested demographic breakdowns are supported by this provider.
  • Implement any additional utility methods needed for filtering, renaming, or otherwise manipulating the data specific to your dataset.
  • Ensure your editor has imported necessary utilities and types, such as getDataManager for data fetching and various types for type-checking (e.g., Breakdowns, MetricQuery, MetricId).
  • Ensure the provider class is exported correctly so other application parts can utilize it.
  • Import new provider into VariableProviderMap.ts
JDemlow added a commit to JDemlow/health-equity-tracker that referenced this issue May 21, 2024
@JDemlow
Copy link
Collaborator

JDemlow commented May 21, 2024

I am receiving some TypeScript errors but they don't always appear in VSCode. I'm going to push my code and hopefully, the errors won't persist. I may not know enough about TypeScript yet to be able to double-check myself

@JDemlow
Copy link
Collaborator

JDemlow commented May 21, 2024

Looks like some of the merge tests failed. I'll try to go through the TS errors and learn as I go

@benhammondmusic
Copy link
Collaborator Author

Usually VSCode only runs its type checking stuff against the open files; however some changes are definitely rippling down and affecting other files that you haven't opened in VSCode. for this type of stuff where the PR (CI) tests are failing, the best is to try to figure out exactly what was running on CI to cause the failure and then replicate that. So here for instance, if you look at the failed step on the github action it was running the "build" command, which in turn was running the type checker tsc.

Screenshot 2024-05-21 at 10 54 39 AM

We should probably add a tsc check to our pre-commit step; I think we used to have it and I forgot to put it back in when I redid everything. but for now, you can either manually run tsc on your CLI in frontend/ and it should generate all these same errors, or usually I just look at which files are causing issues on the error log, and open them in VSCode, and then vscode will highlight the errors

benhammondmusic added a commit that referenced this issue Jun 5, 2024
# Description and Motivation
Closes #3304
Closes #3308 

## Has this been tested? How?

Yes. Using the CLI

## Screenshots (if appropriate)

<img width="697" alt="Code_6ZpGaEQYkw"
src="https://github.com/SatcherInstitute/health-equity-tracker/assets/14945785/fcd2b3b2-52f0-4765-85c2-c97602f2c7bc">


## Types of changes

- Created new file
- Added necessary import to other file 

(leave all that apply)


- New content or feature


## New frontend preview link is below in the Netlify comment 😎

---------

Co-authored-by: Ben Hammond <benjamin.hammond@gmail.com>
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 a pull request may close this issue.

2 participants