IATI / ckanext-iati

CKAN extension for the IATI Registry
http://iatiregistry.org
9 stars 6 forks source link

API endpoint package_search seems to be missing four fields present on #460

Open simon-20 opened 2 months ago

simon-20 commented 2 months ago

Brief Description The package_search endpoint lists dataset/package metadata according to the search criteria. The metadata object it returns for each dataset appears to be, and I think should be, the same as the metadata object that is returned for a single dataset by the package_show API endpoint. However, the metadata entries returned by the package_search endpoint lack four fields that are present on the package_show endpoint.

Severity Low

Issue Location https://iatiregistry.org/api/3/action/package_search

Steps to Reproduce

Use httpie to fetch a single dataset from the package_search endpoint and run it through jq to extract just the metadata for the single dataset requested:

http "https://iatiregistry.org/api/3/action/package_search" rows=1 | jq ".result.results[0]"

On 27-08-2024 this returned:

{
  "author": null,
  "author_email": "pbellordre@gsma.com",
  "creator_user_id": "65cbf70a-cac5-4904-bf4d-758d42c8b3f7",
  "id": "e5c1eea4-c9bf-41ca-b9ed-caa0a232e758",
  "isopen": true,
  "license_id": "other-at",
  "license_title": "Other (Attribution)",
  "maintainer": null,
  "maintainer_email": null,
  "metadata_created": "2024-03-04T10:24:11.373108",
  "metadata_modified": "2024-05-07T15:38:58.740018",
  "name": "gsma_foundation-040324",
  "notes": "",
  "num_resources": 1,
  "num_tags": 0,
  "organization": {
    "id": "d69fb5d3-582a-4109-9771-401fcf892ea8",
    "name": "gsma_foundation",
    "title": "GSMA Foundation",
    "type": "organization",
    "description": "",
    "image_url": "",
    "created": "2020-02-24T20:56:01.763851",
    "is_organization": true,
    "approval_status": "approved",
    "state": "active"
  },
  "owner_org": "d69fb5d3-582a-4109-9771-401fcf892ea8",
  "private": false,
  "state": "active",
  "title": "040324",
  "type": "dataset",
  "url": null,
  "version": null,
  "extras": [
    {
      "key": "activity_count",
      "value": "158"
    },
    {
      "key": "country",
      "value": "GB"
    },
    {
      "key": "data_updated",
      "value": "2024-03-01 14:24:09"
    },
    {
      "key": "filetype",
      "value": "activity"
    },
    {
      "key": "iati_version",
      "value": "2.03"
    },
    {
      "key": "language",
      "value": ""
    },
    {
      "key": "secondary_publisher",
      "value": ""
    },
    {
      "key": "validation_status",
      "value": "Not Found"
    }
  ],
  "resources": [
    {
      "cache_last_updated": null,
      "cache_url": null,
      "created": "2024-05-07T15:38:57.312249",
      "description": null,
      "format": "IATI-XML",
      "hash": "f6bb14d61bb2652f1014d6ebfee3c4b873241bac",
      "id": "57bae570-9890-46d9-9212-5dc2bf7c2548",
      "last_modified": null,
      "metadata_modified": "2024-05-07T15:38:58.757860",
      "mimetype": "",
      "mimetype_inner": null,
      "name": null,
      "package_id": "e5c1eea4-c9bf-41ca-b9ed-caa0a232e758",
      "position": 0,
      "resource_type": null,
      "size": 399382,
      "state": "active",
      "url": "https://philippob33220.github.io/IATI/01032024.xml",
      "url_type": null
    }
  ],
  "tags": [],
  "groups": [],
  "relationships_as_subject": [],
  "relationships_as_object": []
}

If you request the same dataset metadata direct from package_show, using the this command:

http "https://iatiregistry.org/api/action/package_show" id=e5c1eea4-c9bf-41ca-b9ed-caa0a232e758 | jq ".result" You get the following result, which is identical except that it has four additional fields at the end:

{
  "author": null,
  "author_email": "pbellordre@gsma.com",
  "creator_user_id": "65cbf70a-cac5-4904-bf4d-758d42c8b3f7",
  "id": "e5c1eea4-c9bf-41ca-b9ed-caa0a232e758",
  "isopen": true,
  "license_id": "other-at",
  "license_title": "Other (Attribution)",
  "maintainer": null,
  "maintainer_email": null,
  "metadata_created": "2024-03-04T10:24:11.373108",
  "metadata_modified": "2024-05-07T15:38:58.740018",
  "name": "gsma_foundation-040324",
  "notes": "",
  "num_resources": 1,
  "num_tags": 0,
  "organization": {
    "id": "d69fb5d3-582a-4109-9771-401fcf892ea8",
    "name": "gsma_foundation",
    "title": "GSMA Foundation",
    "type": "organization",
    "description": "",
    "image_url": "",
    "created": "2020-02-24T20:56:01.763851",
    "is_organization": true,
    "approval_status": "approved",
    "state": "active"
  },
  "owner_org": "d69fb5d3-582a-4109-9771-401fcf892ea8",
  "private": false,
  "state": "active",
  "title": "040324",
  "type": "dataset",
  "url": null,
  "version": null,
  "extras": [
    {
      "key": "activity_count",
      "value": "158"
    },
    {
      "key": "country",
      "value": "GB"
    },
    {
      "key": "data_updated",
      "value": "2024-03-01 14:24:09"
    },
    {
      "key": "filetype",
      "value": "activity"
    },
    {
      "key": "iati_version",
      "value": "2.03"
    },
    {
      "key": "language",
      "value": ""
    },
    {
      "key": "secondary_publisher",
      "value": ""
    },
    {
      "key": "validation_status",
      "value": "Not Found"
    }
  ],
  "resources": [
    {
      "cache_last_updated": null,
      "cache_url": null,
      "created": "2024-05-07T15:38:57.312249",
      "description": null,
      "format": "IATI-XML",
      "hash": "f6bb14d61bb2652f1014d6ebfee3c4b873241bac",
      "id": "57bae570-9890-46d9-9212-5dc2bf7c2548",
      "last_modified": null,
      "metadata_modified": "2024-05-07T15:38:58.757860",
      "mimetype": "",
      "mimetype_inner": null,
      "name": null,
      "package_id": "e5c1eea4-c9bf-41ca-b9ed-caa0a232e758",
      "position": 0,
      "resource_type": null,
      "size": 399382,
      "state": "active",
      "url": "https://philippob33220.github.io/IATI/01032024.xml",
      "url_type": null
    }
  ],
  "tags": [],
  "groups": [],
  "relationships_as_subject": [],
  "relationships_as_object": [],
  "publisher_source_type": "primary_source",
  "publisher_organization_type": "60",
  "publisher_iati_id": "US-EIN-37-1552838",
  "publisher_country": "US"
}

Expected Results/Behaviour I would expect the four fields shown in package_show to also be returned by package_search.

siwhitehouse commented 2 months ago

Thanks for raising this @simon-20 - this looks well described to me.

@cormachallinanderilinx This has a low priority and isn't blocking anything from my side, so no need to act on this atm.

@dan-odsc We should sanity check with @robredpath if this has any higher priority.