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

Feature/refactor resource #7

Merged
merged 4 commits into from
Sep 17, 2024
Merged

Feature/refactor resource #7

merged 4 commits into from
Sep 17, 2024

Conversation

koenvo
Copy link
Contributor

@koenvo koenvo commented Sep 17, 2024

This changes the api of a Source.

The discover_datasets is replaced with find_datasets.

The find_datasets method should yield the available DatasetResources. Each DatasetResource contains one or more files, and a FileResource describes how to load the data. This can be:

  1. Already contains the json data via json_content
  2. Has a url defined with optional http_options
  3. Custom file_loader which must accept a FileResource and optional File (current_file)

Example:

dataset_resource = DatasetResource(
    # Set the Identifier of the Dataset
    dict(
        competition_id=competition_id,
        season_id=season_id,
        match_id=match["match_id"]
    ),
    dataset_type=dataset_type,
    provider=self.provider,
    name=name,
    metadata=match,
    state=state
)

dataset_resource.add_file(
    last_modified=last_modified,
    data_feed_key="match",
    data_spec_version=match_data_spec_version,
    json_content=match
)

@koenvo koenvo merged commit f40e3df into main Sep 17, 2024
8 checks passed
@koenvo koenvo deleted the feature/refactor-resource branch September 17, 2024 20: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.

1 participant