magda-io / magda-ckan-connector

A Magda connector for CKAN data sources
Other
0 stars 2 forks source link

Filter datasets harvested by custom fields #12

Closed t83714 closed 1 year ago

t83714 commented 1 year ago

Filter data via custom fields

Some data portal might create their own customised field through CKAN customisation.

e.g. this dataset https://catalogue.data.wa.gov.au/api/3/action/package_show?id=mining-tenements-dmirs-003 contains a custom field access_level, which we might need to filter data by.

This ticket is about creating a new feature to filter datasets harvested by custom fields.

Possible solution:

Update

We adopted solution option 1: https://github.com/magda-io/magda/issues/3100

t83714 commented 1 year ago

closed via PR: https://github.com/magda-io/magda-ckan-connector/pull/13

Tested with config like:

connector-wa:
  config:
    id: wa
    name: Western Australia Government
    sourceUrl: https://catalogue.data.wa.gov.au/
    pageSize: 25
    customJsFilterCode: |
      if(type === "Dataset") {
        return jsonData["access_level"]=="open" ? true : false;
      } else {
        return true;
      }