Skip to content

Commit

Permalink
Adds option to exclude dataset from analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfdsilva committed Sep 23, 2023
1 parent 88c046c commit 04cd7df
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/scripts/components/analysis/define/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export const allAvailableDatasetsLayers: DatasetLayer[] = Object.values(
)
.map((dataset) => (dataset as VedaDatum<DatasetData>).data.layers)

Check warning on line 115 in app/scripts/components/analysis/define/index.tsx

View workflow job for this annotation

GitHub Actions / lint

Use a ! assertion to more succinctly remove null and undefined from the type
.flat()
.filter((d) => d.type !== 'vector');
.filter((d) => d.type !== 'vector' && !d.analysis?.exclude);

export default function Analysis() {
const { params, setAnalysisParam } = useAnalysisParams();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function useAnalysisParams(): {
// When accessing the object values with Object.values, they'll always
// be defined.
(d) => d!.data.layers
);
).filter((l) => !l.analysis?.exclude);
const layers = datasetsLayers.split('|').map((id) =>
// Find the one we're looking for.
allDatasetLayers.find((l) => l.id === id)
Expand Down
5 changes: 5 additions & 0 deletions docs/content/frontmatter/layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ Configuration options for the analysis of the dataset layer.

```yaml
metrics: string[]
exclude: boolean
```

**analysis.metrics**
Expand All @@ -224,6 +225,10 @@ Available metrics:
- max (Max)
- std (Standard Deviation)
- median (Median)
-
**analysis.exclude**
`boolean`
Controls whether this layer should be excluded from the analysis page. If set to `true` the layer will not be available for analysis.

### Compare

Expand Down
2 changes: 2 additions & 0 deletions mock/datasets/no2.data.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ layers:
- "#c13b72"
- "#461070"
- "#050308"
analysis:
exclude: true
- id: no2-monthly-diff
stacCol: no2-monthly-diff
name: No2 (Diff) - let's make this title reaaaaaaly long
Expand Down
1 change: 1 addition & 0 deletions parcel-resolver-veda/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ declare module 'veda' {
legend?: LayerLegendCategorical | LayerLegendGradient;
analysis?: {
metrics: string[];
exclude: boolean;
}
}

Expand Down

0 comments on commit 04cd7df

Please sign in to comment.