-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: consolidate shared types and extract constants #3
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
Open
ashkanrdn
wants to merge
1
commit into
fix/dead-code-and-bugs
Choose a base branch
from
refactor/type-consolidation
base: fix/dead-code-and-bugs
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import type { Feature } from 'geojson'; | ||
|
|
||
| /** | ||
| * Extends the standard GeoJSON Feature to include calculated properties | ||
| * based on the selected metric and data source. | ||
| */ | ||
| export interface EnhancedFeature extends Feature { | ||
| properties: { | ||
| name: string; | ||
| [metricKey: string]: any; // Allows indexing by selectedMetric string | ||
| rawValue: number; // Original aggregated value from the data | ||
| perCapitaValue?: number; // Value calculated per capita if applicable | ||
| rowCount: number; // Number of data rows contributing to the aggregation | ||
| totalCostValue?: number; // Specifically calculated total cost for county_prison data | ||
| avgCostPerPrisonerValue?: number; // Specifically calculated average cost per prisoner | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /** | ||
| * Static descriptions for different data sources and their metrics. | ||
| * Used to display information in the description box on the map. | ||
| */ | ||
| export const dataDescriptions = { | ||
| arrest: { | ||
| name: 'Arrest Data', | ||
| description: | ||
| 'Explore how California counties use arrests as a response to crime, revealing justice system practices and community impacts across demographics and offense types.', | ||
| metrics: { | ||
| Arrest_rate: 'Rate of arrests per population for the selected filters and county.', | ||
| Total_Arrests: 'Total number of arrests recorded for the selected filters and county.', | ||
| }, | ||
| }, | ||
| county_prison: { | ||
| name: 'County Prison Data', | ||
| description: | ||
| 'Examine imprisonment patterns and associated costs to understand how local sentencing practices impact state resources and community safety outcomes.', | ||
| metrics: { | ||
| Imprisonments: 'Total number of imprisonments recorded for the county.', | ||
| Cost_per_prisoner: 'Average cost per prisoner for the county.', | ||
| Total_Cost: 'Calculated total cost based on imprisonments and cost per prisoner.', | ||
| }, | ||
| }, | ||
| jail: { | ||
| name: 'Jail Data', | ||
| description: 'Understand how counties rely on local incarceration and the extent of pretrial detention in California\'s justice system.', | ||
| metrics: { | ||
| ADPtotrate: 'Average Daily Population total rate per capita for the county.', | ||
| ADPtotal: 'Total Average Daily Population count for the county.', | ||
| Felony: 'Total count of felony-related jail population for the county (Juvenile only).', | ||
| Misd: 'Total count of misdemeanor-related jail population for the county (Juvenile only).', | ||
| Postdisp: 'Post-disposition jail population count for the county.', | ||
| Predisp: 'Pre-disposition jail population count for the county.', | ||
| }, | ||
| }, | ||
| // Add other data sources as needed | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /** Delay in ms before showing the loading indicator after worker starts */ | ||
| export const LOAD_DELAY_MS = 500; | ||
|
|
||
| /** Zoom level used when flying to a selected county */ | ||
| export const FLY_TO_ZOOM = 10; | ||
|
|
||
| /** Animation duration in ms for fly-to transitions */ | ||
| export const TRANSITION_DURATION_MS = 1000; | ||
|
|
||
| /** Fill color for counties not in the active selection [R, G, B, A] */ | ||
| export const UNSELECTED_COUNTY_COLOR: [number, number, number, number] = [200, 200, 200, 150]; | ||
|
|
||
| /** | ||
| * Geographic bounds constraining map panning (roughly California). | ||
| * [ [minLongitude, minLatitude], [maxLongitude, maxLatitude] ] | ||
| */ | ||
| export const MAP_BOUNDS: [[number, number], [number, number]] = [ | ||
| [-117.595944, 33.386416], // Southwest corner | ||
| [-120.999866, 42.183974], // Northeast corner | ||
| ]; | ||
|
|
||
| /** Minimum zoom level — prevents zooming out too far */ | ||
| export const MIN_ZOOM = 5; | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): MAP_BOUNDS longitudes appear reversed (west > east), which may break consumers expecting [west, south], [east, north].
These bounds are
[-117.595944, 33.386416]to[-120.999866, 42.183974]. Since -120.999866 < -117.595944, this encodes[east, south]→[west, north]instead of[west, south]→[east, north]. Many mapping APIs (Mapbox, deck.gl) assume west < east and may fail or behave oddly with reversed longitudes, especially now that this constant is shared. If this isn’t intentional, please swap the longitudes and align the comments with the correct convention.