collectionsonline icon indicating copy to clipboard operation
collectionsonline copied to clipboard

CO2.0: Ensure consistent source of parent title value

Open jamieu opened this issue 11 months ago • 2 comments

Which is the correct value to identify a MPHs' parent record?

The parent of a MPH child record (for example co8413707) appears in four different places (at least on most MPH child records) in the index.

1. parent

    "parent": [
    {
      "summary":
      {
        "title": "Collection of objects and archives from Boddingtons Brewery at Strangeways (collection of objects and archives)"
      },
      "@admin":
      {
        "uid": "co8413731",
        "id": "object-8413731",
        "uuid": "773bf2c3-52ca-3038-bc57-f102fd268dce"
      },
      "@entity": "reference"
    }],

2. hierarch

    "@hierarch": [
    {
      "summary":
      {
        "title": "Collection of objects and archives from Boddingtons Brewery at Strangeways (collection of objects and archives)"
      },
      "@admin":
      {
        "uid": "co8413731",
        "id": "object-8413731",
        "uuid": "773bf2c3-52ca-3038-bc57-f102fd268dce"
      },
      "@entity": "reference"
    }],

3. hierarchy

    "@hierarchy": [
      [
      {
        "summary":
        {
          "title": "Collection of objects and archives from Boddingtons Brewery at Strangeways (collection of objects and archives)"
        },
        "@admin":
        {
          "uid": "co8413731",
          "id": "object-8413731",
          "uuid": "773bf2c3-52ca-3038-bc57-f102fd268dce"
        },
        "@entity": "reference"
      },
      {
        "summary":
        {
          "title": "Postcard advertising Boddingtons (postcard)"
        },
        "@admin":
        {
          "uid": "co8413707",
          "id": "object-8413707",
          "uuid": "40261e70-38a5-3999-9794-4d866cffe8fb"
        },
        "@entity": "reference"
      }]


4. grouping

    "grouping": [
    {
      "summary":
      {
        "title": "Collection of objects and archives from Boddingtons Brewery at Strangeways (collection of objects and archives)"
      },
      "@link":
      {
        "type": "MPH"
      },
      "@admin":
      {
        "uid": "co8413731",
        "id": "object-8413731",
        "uuid": "773bf2c3-52ca-3038-bc57-f102fd268dce"
      },
      "@entity": "reference"
    }],

Which field are currently being used

We are currently filtering the child record to display on a MPH parent record (co8413731) by the grouping element. This feels correct.

However, we seem to be retrieving the title and link (back to the parent record) from the parent element. This is wrong / inconsistent with the above. We should change this to use grouping in order to be consistent.

Screenshot 2024-03-12 at 10 47 29
  • [ ] Update code to use grouping when passing/displaying parent title/link.

Why do some records only have a parent element?

On further investigation it seem that in the case of 1924-793 and 1924-793/1, 1924-793 has OPTION13=COLLECTION.

Therefore the parent record is behaving correctly in not displaying any child records. The child record is currently incorrectly showing a link to the parent as we are currently pulling the title/link from the parent element (which all child records have) rather than the grouping element (which only MPH children have)

  • [ ] Update code to use grouping when passing/displaying parent title/link.

~~It appears that some records (1924-793/1) contain only a parent element. Why is this? https://collection.sciencemuseumgroup.org.uk/objects/co8226380/components-of-the-james-watt-workshop-reproduction-replica-workshop-work-space~~

~~This result in those record not being grouped or displayed under the MPH parent as that logic uses the grouping element. which for these child records doesn't exists.~~

  • ~~Why do these record have a parent but not a grouping element?~~
  • ~~What is the relationship between 1924-793 and 1924-793/1 in Mimsy?~~
  • ~~Should these records (1924-793/1) have a grouping element? ie. are they direct dependent of a parent MPH record (1924-793) and we would expect to display on that parent page (co52336).~~

jamieu avatar Mar 12 '24 10:03 jamieu

We also seem to be setting a parent link in getLinks within jsonapi-response.js on the data.links element, but there is also a parent elect on the data.relationships element too.

We should problay go over all this very careful as documents already uses parent in a very special way to drive the archive navigator and its tree like structure (which we don't to accidentally break).

We should probably use the grouping elements to drive and hold parent/child structure for objects, rarther the the existing parent element (as that has a very specific and existing use, relating to documents, within the codebase).

Screenshot 2024-03-12 at 14 57 23 Screenshot 2024-03-12 at 15 00 50

jamieu avatar Mar 12 '24 14:03 jamieu

Root issue resolved https://github.com/TheScienceMuseum/collectionsonline/pull/1661

But we should probably take a fresh look over all of this before we forget ;-)

jamieu avatar Mar 12 '24 15:03 jamieu