Skip to content

Commit

Permalink
Small Refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
CHRISCARLON committed Sep 21, 2024
1 parent 1d21ecd commit 90eb648
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/herding_cats_explorer_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest requests loguru pandas polars duckdb==1.0.0
pip install pytest requests loguru pandas polars duckdb==1.0.0 boto3
- name: Create pytest.ini
run: |
Expand Down
1 change: 1 addition & 0 deletions HerdingCats/api_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ class CkanDataCatalogues(Enum):
SUBAK = "https://data.subak.org"
HUMANITARIAN = "https://data.humdata.org"
AFRICA = "https://open.africa"
CANADA_GOV = "https://search.open.canada.ca/opendata"
# Add more default catalogues as needed...
8 changes: 6 additions & 2 deletions HerdingCats/herding_cats.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,10 @@ def catalogue_freshness(self):
Returns a view of how many resources have been updated in the last 6 months
as a percentage of the total number of resources, based on unique package names.
"""
logger.warning(
"This method might not work for all catalogues, and will return 0s"
)

url = (
self.cat_session.base_url + CkanApiPaths.CURRENT_PACKAGE_LIST_WITH_RESOURCES
)
Expand Down Expand Up @@ -1291,7 +1295,7 @@ def aws_s3_data_loader(

# Example usage...
if __name__ == "__main__":
with CkanCatSession(CkanDataCatalogues.SUBAK) as session:
with CkanCatSession(CkanDataCatalogues.CANADA_GOV) as session:
explore = CkanCatExplorer(session)
fresh = explore.catalogue_freshness()
fresh = explore.package_list_dataframe("polars")
print(fresh)

0 comments on commit 90eb648

Please sign in to comment.