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

Integrates STAC metadata request #645

Merged
merged 7 commits into from
Sep 14, 2023

Conversation

danielfdsilva
Copy link
Collaborator

When datasets are added to the timeline, metadata from STAC is requested and reconciles with local data

@danielfdsilva danielfdsilva requested a review from nerik September 4, 2023 19:30
@netlify
Copy link

netlify bot commented Sep 4, 2023

Deploy Preview for veda-ui ready!

Name Link
🔨 Latest commit 957ad79
🔍 Latest deploy log https://app.netlify.com/sites/veda-ui/deploys/64ff2a2a5ea6240008b5baf4
😎 Deploy Preview https://deploy-preview-645--veda-ui.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Comment on lines 38 to 49
export interface TimelineDatasetData extends DatasetLayer {
isPeriodic: boolean;
timeDensity: TimeDensity;
domain: Date[];
}

export interface TimelineDataset {
status: TimelineDatasetStatus;
data: any;
data: TimelineDatasetData;
error: any;
settings: {
// user defined settings like visibility, opacity
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@nerik How much type narrowing should we be doing?

The isPeriodic and so on properties are only available when the status is success, otherwise they're undefined. We could do this type narrowing or set it to be possibly undefined. On one hand we have a more complicated type, but with undefined, we need to check every prop, instead of relying on status. Thoughts?

Copy link
Contributor

@nerik nerik left a comment

Choose a reason for hiding this comment

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

At first glance, not sure what's going on, but do the following:

  • Add a dataset. Time extent displays fine on the timeline
  • Add another dataset. After the STAC endpoint fetch, no time extent displayed for both datasets.

Comment on lines 69 to 114
// END TimelineDatasetAnalysis type discriminants

export interface TimelineDatasetData extends DatasetLayer {
isPeriodic: boolean;
timeDensity: TimeDensity;
domain: Date[];
}

// TimelineDataset type discriminants
export interface TimelineDatasetIdle {
status: TimelineDatasetStatus.IDLE;
data: DatasetLayer;
error: null;
settings: {
// user defined settings like visibility, opacity
isVisible?: boolean;
opacity?: number;
};
analysis: TimelineDatasetAnalysisIdle;
}
export interface TimelineDatasetLoading {
status: TimelineDatasetStatus.LOADING;
data: DatasetLayer;
error: null;
settings: {
// user defined settings like visibility, opacity
isVisible?: boolean;
opacity?: number;
};
analysis: TimelineDatasetAnalysisIdle;
}
export interface TimelineDatasetError {
status: TimelineDatasetStatus.ERROR;
data: DatasetLayer;
error: unknown;
settings: {
// user defined settings like visibility, opacity
isVisible?: boolean;
opacity?: number;
};
analysis: TimelineDatasetAnalysisIdle;
}
export interface TimelineDatasetSuccess {
status: TimelineDatasetStatus.SUCCESS;
data: TimelineDatasetData;
error: null;
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be simplified by:

  • wrapping settings into a common Settings typr:
interface Settings {
  isVisible?: boolean;
  opacity?: number;
}
  • extend a base type for all the unioned types:
interface TimelineDatasetBase {
  data: DatasetLayer | TimelineDatasetData;
  error: unknown | null;
  settings: Settings;
  analysis: TimelineDatasetAnalysisIdle | TimelineDatasetAnalysis;
}

@danielfdsilva
Copy link
Collaborator Author

@nerik whit which datasets did you notice this happening?

@danielfdsilva danielfdsilva requested a review from nerik September 8, 2023 14:35
@danielfdsilva
Copy link
Collaborator Author

@nerik now that we addresses the issues with the dataset domain, I think this is good to go. Can you have a final check?

@danielfdsilva danielfdsilva merged commit 29f79cc into feature/exploration Sep 14, 2023
8 checks passed
@danielfdsilva danielfdsilva deleted the feature/stac-metadata branch September 14, 2023 13:15
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.

2 participants