TheScienceMuseum / collectionsonline

Science Museum Group Collection Online
https://collection.sciencemuseumgroup.org.uk
MIT License
47 stars 3 forks source link

CO2.0: Images potentially in wrong order? [awaiting index change] #1548

Closed jamieu closed 8 months ago

jamieu commented 9 months ago

We appear to be missing sort and position on multimedia elements in the new index.

Like so: "sort": "2022-09-29 21:31:21.0", "position": "2",

sort = This is the original upload date of the image into iBase, appears in the CIIM, but not the public index. Easy fix. position = Is set manually in iBase ie. for back / front of photographs, but I am no longer seeing the field in the iBase interface or API? Is the field still in use?

The images order is based first on position (manually set in iBase), followed by sort (which is based on image upload date).

dev http://localhost:8000/objects/co8829091/a-photographic-print-of-industry-metal-miscellaneous-scrap-metal-photographic-print

live https://collection.sciencemuseumgroup.org.uk/objects/co8829091


Using 555502 as an example (API call)

These fields are used to order images

Sort Index iBase iBase API CIIM Example Note
position (1st) missing missing missing missing see live record below Can't even see position in iBase interface anymore?
sort (2nd) missing "uploaded_date":"29\/09\/2022" upload_sort: "29/09/2022" "sort": "2022-09-29 21:31:21.0" date image originally upload, so as not to be affected by iBase metadata modifications

iBase for 555502

Screenshot 2024-02-06 at 17 04 55

ES7/new

"multimedia": [{
        "@admin": {
            "uid": "i555502",
            "id": "media-555502",
            "source": "smgi",
            "uuid": "03401b65-ae3d-3ac4-8a34-bda00dc4d0fc"
        },
        "@processed": <snip>
        "@type": "image",
        "legal": {
            "rights": [{
                "copyright": "© Hulton Archive/Getty Images",
                "usage_terms": "Contact the picture library team (SMG Images) to clear permissions"
            }]
        },
        "title": [{
            "type": "caption",
            "value": "A photographic print of Industry, Metal"
        }],
        "@entity": "reference"
    },
    {
        "@admin": {
            "uid": "i555498",
            "id": "media-555498",
            "source": "smgi",
            "uuid": "2307f2db-afb0-32df-8e93-5084c077aebf"
        },
        "@processed": <snip>
        "@type": "image",
        "legal": {
            "rights": [{
                "copyright": "© Hulton Archive/Getty Images",
                "usage_terms": "Contact the picture library team (SMG Images) to clear permissions"
            }]
        },
        "title": [{
            "type": "caption",
            "value": "A photographic print of Industry, Metal"
        }],
        "@entity": "reference"
    }
],

live

      "multimedia": [
        {
          "@link": {
            "type": "reference"
          },
          "admin": {
            "id": "media-555498",
            "source": "smgi",
            "uid": "i555498",
            "uuid": "2307f2db-afb0-32df-8e93-5084c077aebf"
          },
          "credit": "Science Museum Group",
          "for_sale": "0",
          "identifier": [
            {
              "type": "iBase id",
              "value": "555498"
            }
          ],
          "position": "1",
          "priority": "0.5",
          "processed": snip
          "public_view": "1",
          "publish": "1",
          "sort": "2022-09-29 21:30:33.0",
          "source": {
            "legal": {
              "rights": [
                {
                  "details": "© Hulton Archive/Getty Images",
                  "usage_terms": "Contact the picture library team (SMG Images) to clear permissions"
                }
              ]
            },
            "title": [
              {
                "type": "caption",
                "value": "A photographic print of Industry, Metal"
              },
              {
                "type": "main title",
                "value": "A photographic print of Industry, Metal, Miscellaneous - Scrap Metal"
              }
            ]
          },
          "type": {
            "base": "media",
            "type": "image"
          }
        },
        {
          "@link": {
            "type": "reference"
          },
          "admin": {
            "id": "media-555502",
            "source": "smgi",
            "uid": "i555502",
            "uuid": "03401b65-ae3d-3ac4-8a34-bda00dc4d0fc"
          },
          "credit": "Science Museum Group",
          "for_sale": "0",
          "identifier": [
            {
              "type": "iBase id",
              "value": "555502"
            }
          ],
          "position": "2",
          "priority": "0.5",
          "processed": <snip>
          "public_view": "1",
          "publish": "1",
          "sort": "2022-09-29 21:31:21.0",
          "source": {
            "legal": {
              "rights": [
                {
                  "details": "© Hulton Archive/Getty Images",
                  "usage_terms": "Contact the picture library team (SMG Images) to clear permissions"
                }
              ]
            },
            "title": [
              {
                "type": "caption",
                "value": "A photographic print of Industry, Metal"
              },
              {
                "type": "main title",
                "value": "A photographic print of Industry, Metal, Miscellaneous - Scrap Metal"
              }
            ]
          },
          "type": {
            "base": "media",
            "type": "image"
          }
        }
      ]
    },

[1] API response for 555502

Screenshot 2024-02-06 at 16 46 31
jamieu commented 9 months ago

API response for (A photographic print of Industry, Metal)

{
    "totalItems": 1,
    "items": [
    {
        "kind": "item",
        "id": 555502,
        "title": "A photographic print of Industry, Metal",
        "reference": "555502",
        "type":
        {
            "kind": "itemType",
            "id": 1,
            "name": "Digital Item"
        },
        "state":
        {
            "kind": "itemState",
            "id": 2,
            "state": "active",
            "name": "Active",
            "desc": "This item is active and ready to use"
        },
        "previousState":
        {
            "kind": "itemState",
            "id": 1,
            "state": "importing",
            "name": "Importing",
            "desc": "This item is being imported"
        },
        "priority": 0.5,
        "changeFreq": "Monthly",
        "owner": null,
        "createUser": null,
        "createDate": "2022-09-29 21:31:18",
        "modifiedUser": null,
        "modifiedDate": "2023-10-16 10:40:00",
        "thumbnail":
        {
            "kind": "asset",
            "assetType": "thumbnail",
            "mimeType": "image\/jpeg",
            "fileExt": "jpeg",
            "digest": "sha256:",
            "width": 198,
            "height": 250,
            "transparency": 0,
            "src": ""
        },
        "assets":
        {
            "stream reference": [
            {
                "kind": "asset",
                "assetType": "image",
                "mimeType": "image\/jpeg",
                "fileExt": "jpeg",
                "fileSize": 382605,
                "createDate": "2023-09-24 01:19:36",
                "digest": "sha256:",
                "width": 476,
                "height": 600,
                "depth": 32,
                "transparency": 0,
                "src": "",
                "name": "image reference",
                "desc": "JPEG (600px, sRGB)"
            }],
            "stream zoom": [
            {
                "kind": "asset",
                "assetType": "image",
                "mimeType": "image\/jpeg",
                "fileExt": "jpeg",
                "fileSize": 2369851,
                "createDate": "2023-09-24 01:20:10",
                "digest": "sha256:",
                "width": 1189,
                "height": 1500,
                "depth": 32,
                "transparency": 0,
                "src": "",
                "name": "image zoom",
                "desc": "JPEG (1500px, sRGB)"
            }],
            "original": [
            {
                "kind": "asset",
                "assetType": "image",
                "mimeType": "image\/tiff",
                "fileExt": "tiff",
                "fileSize": 54169834,
                "createDate": "2022-09-29 21:31:54",
                "digest": "sha1:",
                "width": 5221,
                "height": 6589,
                "depth": 24
            }]
        },
        "text":
        {
            "kind": "text",
            "data":
            {
                "data_id": 1087362,
                "ibase_id": 555502,
                "resource_identifier": null,
                "caption": "A photographic print of Industry, Metal",
                "title": "A photographic print of Industry, Metal, Miscellaneous - Scrap Metal",
                "description": "A photographic print from the Daily Herald Archive folder: Industry \u00bb Metal \u00bb Miscellaneous - Scrap Metal.",
                "notes": null,
                "uploaded_date": "29\/09\/2022",
                "location": null,
                "creator": null,
                "rights_holder": null,
                "collection": null,
                "keyword_tags": null,
                "source_file_ext": "TIFF",
                "asset_date": null,
                "digital_image_no": "SMG00349148_(1002)",
                "object_identifiers": "1983-5236\/56182",
                "copyright": "\u00a9 Hulton Archive\/G... Images",
                "credit": "Science Museum Group",
                "rights_usage_terms": "Contact the picture library team (SMG Images) to clear permissions",
                "traffic_light": null,
                "keywords": "archive; daily; folder; herald; industry; metal; miscellaneous; photographic; print; scrap",
                "keywords_legacy": null,
                "asset_place": null,
                "collection_location": "Science Museum (ScM), London",
                "collection_type": "NSMM - Photographs",
                "project": "\"Daily Herald Archive - Google Arts and Culture\"",
                "author": null,
                "date_created": null,
                "master_format": null,
                "location_of_original": null,
                "publish_to_god": "Yes",
                "capture_device": null,
                "last_modified_date": "16\/10\/2023",
                "last_modified_by": "LB@example.com",
                "image_notes": "52 MB\r\nLZW\r\n300 DPI\r\n",
                "date_original_made": null,
                "place_original_made": null,
                "original_analogue_format": null,
                "mimsy_named_collection": "Daily Herald Archive",
                "mimsy_object_name": "photographic print",
                "record_type": "Collection Item",
                "service_type": null,
                "internal_image_standard": null,
                "collection_item_aspect": null,
                "licence": null
            },
            "Identifier Data": []
        },
        "canonicalUrl": "",
        "navigateUrl": "",
        "editUrl": "",
        "permissions":
        {
            "view": true,
            "add": false,
            "edit": false,
            "delete": false,
            "select": false,
            "share": true,
            "download": false,
            "purchase": false,
            "print": false,
            "upload other": false
        },
        "selected": false
    }]
}
jamieu commented 9 months ago

ToDo:

Test record http://medialibrary.sciencemuseum.ac.uk/api/v2/items/555502

Unknown

jamieu commented 9 months ago

In progress KI #5229, awaiting index update & testing + minor refactoring

jamieu commented 8 months ago

position now in index, but test record only has one image position, need better example to test http://localhost:8000/api/objects/co8829091

Screenshot 2024-02-16 at 16 10 12
jamieu commented 8 months ago

Updated lib/helpers/jsonapi-response/sort-images.js to set default value to 0 if no position field found.

jamieu commented 8 months ago

https://github.com/TheScienceMuseum/collectionsonline/compare/fix-media-fields?expand=1