[MODEXPW-105] Update item statuses Created: 04/Feb/22  Updated: 21/Apr/22  Resolved: 21/Apr/22

Status: Closed
Project: mod-data-export-worker
Components: None
Affects versions: None
Fix versions: None

Type: Story Priority: P3
Reporter: Magda Zacharska Assignee: Siarhei Charniak
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original estimate: Not Specified

Attachments: File 2022-04-21-Errors-barcode.csv     File barcode.csv    
Issue links:
Defines
defines UXPROD-3469 Bulk Edit - in app approach - item st... Closed
Sprint: Firebird Sprint 138
Story Points: 3
Development Team: Firebird
RCA Group: TBD

 Description   

Purpose/Overview:
Once the user confirms the changes that need to be committed the backend will update identified records.

Requirements/Scope:
1. Only records with supported statues are updated
2. If the record has a status that is not supported then it should be skipped and noted in the list of errors. The notification should include affected record (identifier) and the existing item status

Note: BE to verify if the already implemented functionality in mod-inventory-storage covers this functionality. After that is determined the story can be estimated.

Approach:

Acceptance criteria:

  • All submitted records are processed
  • Only records with supported statues are update
  • Records that cannot be processed are reported in the error log
  • The list of supported item statuses might changed during the live of the app so it will need to be configurable
  • API tests are written and executed

Additional information:
List of supported statuses:

From status To status From status To status From status To status
Available Missing
Withdrawn
In process (non-requestable)
Intellectual item
Long missing
Restricted
Unavailable
Unknown
Missing Available
Withdrawn
In process (non-requestable)
Intellectual item
Long missing
Restricted
Unavailable
Unknown
Withdrawn Available
Missing
In process (non-requestable)
Intellectual item
Long missing
Restricted
Unavailable
Unknown
In process (non-requestable)
 
Available
Missing
Withdrawn
Intellectual item
Long missing
Restricted
Unavailable
Unknown
Intellectual Item Available
Missing
Withdrawn
In process (non-requestable)
Long missing
Restricted
Unavailable
Unknown
Long missing Available
Missing
Withdrawn
In process (non-requestable)
Intellectual item
Restricted
Unavailable
Unknown
Restricted Available
Missing
Withdrawn
In process (non-requestable)
Intellectual item
Long missing
Unavailable
Unknow
Unavailable Available
Missing
Withdrawn
In process (non-requestable)
Intellectual item
Long missing
Restricted
Unknown
Unknown Available
Missing
Withdrawn
In process (non-requestable)
Intellectual item
Long missing
Restricted
Unavailable


 Comments   
Comment by Siarhei Charniak [ 16/Mar/22 ]

mod-inventory module has no restrictions on status changes (any value can be changed to any other).

Comment by Siarhei Charniak [ 21/Apr/22 ]

Magda Zacharska

Verified on folio-snapshot

1. Update item with allowed status
Create a new job

curl --location --request POST 'https://folio-snapshot-okapi.dev.folio.org:443/data-export-spring/jobs' \
--header 'x-okapi-tenant: diku' \
--header "x-okapi-token: $TOKEN" \
--header 'Content-Type: application/json' \
--data-raw '{
  "type": "BULK_EDIT_IDENTIFIERS",
  "exportTypeSpecificParameters": {
      
  },
  "identifierType": "BARCODE",
  "entityType": "ITEM"
}'

Response

{
    "id": "0d3108de-93d8-4bae-87a4-cd01be756f15",
    "name": "000002",
    "source": "diku_admin",
    "isSystemSource": false,
    "type": "BULK_EDIT_IDENTIFIERS",
    "exportTypeSpecificParameters": {},
    "status": "SCHEDULED",
    "metadata": {
        "createdDate": "2022-04-21T04:53:23.019+00:00",
        "createdByUserId": "a273ecdc-7f40-5a86-89d5-1ff24d2c0491",
        "createdByUsername": "diku_admin",
        "updatedDate": "2022-04-21T04:53:23.019+00:00",
        "updatedByUserId": "a273ecdc-7f40-5a86-89d5-1ff24d2c0491",
        "updatedByUsername": "diku_admin"
    },
    "identifierType": "BARCODE",
    "entityType": "ITEM"
}

Upload attached barcode.csv file

curl --location --request POST 'https://folio-snapshot-okapi.dev.folio.org:443/bulk-edit/null/upload' \
--header 'x-okapi-tenant: diku' \
--header "x-okapi-token: $TOKEN" \
--header 'Content-Type: multipart/form-data' \
--form 'file=@"/Users/siarhei/Desktop/barcode.csv"'

Start job

curl --location --request POST 'https://folio-snapshot-okapi.dev.folio.org:443/bulk-edit/null/start' \
--header 'x-okapi-tenant: diku' \
--header "x-okapi-token: $TOKEN" \
--header 'Content-Type: application/json'

Post content update - allowed status Missing

curl --location --request POST 'https://folio-snapshot-okapi.dev.folio.org:443/bulk-edit/null/items-content-update/upload' \
--header 'x-okapi-tenant: diku' \
--header "x-okapi-token: $TOKEN" \
--header 'Content-Type: application/json' \
--data-raw '{
  "entityType": "ITEM",
  "contentUpdates": [
    {
       "option": "STATUS",
        "action": "REPLACE_WITH",
        "value": "Missing"
    }
  ],
  "totalRecords": 1
}'

Response - item status was changed in preview

{
    "items": [
        {
            "id": "100d10bf-2f06-4aa0-be15-0b95b2d9f9e3",
            "_version": 2,
            "hrid": "item000000000015",
            "holdingsRecordId": "e3ff6133-b9a2-4d4c-a1c9-dc1867d4df19",
            "formerIds": [],
            "discoverySuppress": null,
            "title": "A semantic web primer",
            "contributorNames": [
                {
                    "name": "Antoniou, Grigoris"
                },
                {
                    "name": "Van Harmelen, Frank"
                }
            ],
            "callNumber": "TK5105.88815 . A58 2004 FT MEADE",
            "barcode": "90000",
            "effectiveShelvingOrder": "TK 45105.88815 A58 42004 FT MEADE",
            "accessionNumber": null,
            "itemLevelCallNumber": "TK5105.88815 . A58 2004 FT MEADE",
            "itemLevelCallNumberPrefix": null,
            "itemLevelCallNumberSuffix": null,
            "itemLevelCallNumberTypeId": null,
            "effectiveCallNumberComponents": {
                "callNumber": "TK5105.88815 . A58 2004 FT MEADE",
                "prefix": null,
                "suffix": null,
                "typeId": "512173a7-bd09-490e-b773-17d83f2b63fe"
            },
            "volume": null,
            "enumeration": null,
            "chronology": null,
            "yearCaption": [],
            "itemIdentifier": null,
            "copyNumber": null,
            "numberOfPieces": null,
            "descriptionOfPieces": null,
            "numberOfMissingPieces": null,
            "missingPieces": null,
            "missingPiecesDate": null,
            "itemDamagedStatusId": null,
            "itemDamagedStatusDate": null,
            "administrativeNotes": [],
            "notes": [],
            "circulationNotes": [],
            "status": {
                "name": "Missing",
                "date": 1650516872648
            },
            "materialType": {
                "id": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
                "name": "book"
            },
            "isBoundWith": false,
            "boundWithTitles": [],
            "permanentLoanType": {
                "id": "2b94c631-fca9-4892-a730-03ee529ffe27",
                "name": "Can circulate"
            },
            "temporaryLoanType": null,
            "permanentLocation": {
                "id": "fcd64ce1-6995-48f0-840e-89ffa2288371",
                "name": "Main Library"
            },
            "temporaryLocation": {
                "id": "53cf956f-c1df-410b-8bea-27f712cca7c0",
                "name": "Annex"
            },
            "effectiveLocation": {
                "id": "53cf956f-c1df-410b-8bea-27f712cca7c0",
                "name": "Annex"
            },
            "electronicAccess": [
                {
                    "uri": "http://www.loc.gov/catdir/toc/ecip0718/2007020429.html",
                    "linkText": "Links available",
                    "materialsSpecification": "Table of contents",
                    "publicNote": "Table of contents only",
                    "relationshipId": "3b430592-2e09-4b48-9a0c-0636d66b9fb3"
                }
            ],
            "inTransitDestinationServicePointId": null,
            "statisticalCodeIds": [
                "b5968c9e-cddc-4576-99e3-8e60aed8b0dd"
            ],
            "purchaseOrderLineIdentifier": null,
            "metadata": null,
            "tags": {
                "tagList": []
            },
            "lastCheckIn": null
        }
    ],
    "totalRecords": 1,
    "resultInfo": null
}

Start job

curl --location --request POST 'https://folio-snapshot-okapi.dev.folio.org:443/bulk-edit/0d3108de-93d8-4bae-87a4-cd01be756f15/start' \
--header 'x-okapi-tenant: diku' \
--header "x-okapi-token: $TOKEN" \
--header 'Content-Type: application/json'

Check job status

curl --location --request GET 'https://folio-snapshot-okapi.dev.folio.org:443/data-export-spring/jobs/0d3108de-93d8-4bae-87a4-cd01be756f15' \
--header 'x-okapi-tenant: diku' \
--header "x-okapi-token: $TOKEN" \
--header 'Content-Type: application/json'

Response - successful

{
    "id": "0d3108de-93d8-4bae-87a4-cd01be756f15",
    "name": "000002",
    "source": "diku_admin",
    "isSystemSource": false,
    "type": "BULK_EDIT_IDENTIFIERS",
    "exportTypeSpecificParameters": {},
    "status": "SUCCESSFUL",
    "files": [
        "https://folio-snapshot-export.s3.us-east-1.amazonaws.com/2022-04-21-Matched-Records-barcode.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIA2VGNPE73JV77RBGE%2F20220421%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220421T045353Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=85da4310ab03acec3b566910caa99ba4be668a76664507795ed0a4270c92d41e"
    ],
    "startTime": "2022-04-21T05:00:07.703+00:00",
    "endTime": "2022-04-21T05:00:08.215+00:00",
    "metadata": {
        "createdDate": "2022-04-21T04:53:23.019+00:00",
        "createdByUserId": "a273ecdc-7f40-5a86-89d5-1ff24d2c0491",
        "createdByUsername": "diku_admin",
        "updatedDate": "2022-04-21T05:00:08.257+00:00",
        "updatedByUserId": "a273ecdc-7f40-5a86-89d5-1ff24d2c0491",
        "updatedByUsername": "diku_admin"
    },
    "identifierType": "BARCODE",
    "entityType": "ITEM",
    "progress": {
        "total": 1,
        "processed": 1,
        "progress": 100
    }
}

Check item

curl --location --request GET 'https://folio-snapshot-okapi.dev.folio.org:443/inventory/items?query=barcode==90000' \
--header 'x-okapi-tenant: diku' \
--header "x-okapi-token: $TOKEN" \
--header 'Content-Type: application/json'

Response - item status was changed

{
    "items": [
        {
            "id": "100d10bf-2f06-4aa0-be15-0b95b2d9f9e3",
            "_version": "3",
            "status": {
                "name": "Missing",
                "date": "2022-04-21T05:00:08.176+00:00"
            },
            "administrativeNotes": [],
            "title": "A semantic web primer",
            "callNumber": "TK5105.88815 . A58 2004 FT MEADE",
            "hrid": "item000000000015",
            "contributorNames": [
                {
                    "name": "Antoniou, Grigoris"
                },
                {
                    "name": "Van Harmelen, Frank"
                }
            ],
            "formerIds": [],
            "discoverySuppress": null,
            "holdingsRecordId": "e3ff6133-b9a2-4d4c-a1c9-dc1867d4df19",
            "barcode": "90000",
            "itemLevelCallNumber": "TK5105.88815 . A58 2004 FT MEADE",
            "notes": [],
            "circulationNotes": [],
            "tags": {
                "tagList": []
            },
            "yearCaption": [],
            "electronicAccess": [
                {
                    "uri": "http://www.loc.gov/catdir/toc/ecip0718/2007020429.html",
                    "linkText": "Links available",
                    "materialsSpecification": "Table of contents",
                    "publicNote": "Table of contents only",
                    "relationshipId": "3b430592-2e09-4b48-9a0c-0636d66b9fb3"
                }
            ],
            "statisticalCodeIds": [
                "b5968c9e-cddc-4576-99e3-8e60aed8b0dd"
            ],
            "purchaseOrderLineIdentifier": null,
            "materialType": {
                "id": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
                "name": "book"
            },
            "permanentLoanType": {
                "id": "2b94c631-fca9-4892-a730-03ee529ffe27",
                "name": "Can circulate"
            },
            "permanentLocation": {
                "id": "fcd64ce1-6995-48f0-840e-89ffa2288371",
                "name": "Main Library"
            },
            "temporaryLocation": {
                "id": "53cf956f-c1df-410b-8bea-27f712cca7c0",
                "name": "Annex"
            },
            "metadata": {
                "createdDate": "2022-04-21T01:52:22.728+00:00",
                "updatedDate": "2022-04-21T05:00:08.172+00:00",
                "updatedByUserId": "a273ecdc-7f40-5a86-89d5-1ff24d2c0491"
            },
            "links": {
                "self": "http://folio-snapshot-okapi.dev.folio.org/inventory/items/100d10bf-2f06-4aa0-be15-0b95b2d9f9e3"
            },
            "effectiveCallNumberComponents": {
                "callNumber": "TK5105.88815 . A58 2004 FT MEADE",
                "prefix": null,
                "suffix": null,
                "typeId": "512173a7-bd09-490e-b773-17d83f2b63fe"
            },
            "effectiveShelvingOrder": "TK 45105.88815 A58 42004 FT MEADE",
            "isBoundWith": false,
            "effectiveLocation": {
                "id": "53cf956f-c1df-410b-8bea-27f712cca7c0",
                "name": "Annex"
            }
        }
    ],
    "totalRecords": 1
}

2. Update item with not allowed status
Create a new job

curl --location --request POST 'https://folio-snapshot-okapi.dev.folio.org:443/data-export-spring/jobs' \
--header 'x-okapi-tenant: diku' \
--header "x-okapi-token: $TOKEN" \
--header 'Content-Type: application/json' \
--data-raw '{
  "type": "BULK_EDIT_IDENTIFIERS",
  "exportTypeSpecificParameters": {
      
  },
  "identifierType": "BARCODE",
  "entityType": "ITEM"
}'

Response

{
    "id": "dda6d273-f2f7-4f8d-800a-2541ea24c4a2",
    "name": "000003",
    "source": "diku_admin",
    "isSystemSource": false,
    "type": "BULK_EDIT_IDENTIFIERS",
    "exportTypeSpecificParameters": {},
    "status": "SCHEDULED",
    "metadata": {
        "createdDate": "2022-04-21T05:18:27.358+00:00",
        "createdByUserId": "a273ecdc-7f40-5a86-89d5-1ff24d2c0491",
        "createdByUsername": "diku_admin",
        "updatedDate": "2022-04-21T05:18:27.358+00:00",
        "updatedByUserId": "a273ecdc-7f40-5a86-89d5-1ff24d2c0491",
        "updatedByUsername": "diku_admin"
    },
    "identifierType": "BARCODE",
    "entityType": "ITEM"
}

Post attached barcode.csv file

curl --location --request POST 'https://folio-snapshot-okapi.dev.folio.org:443/bulk-edit/null/upload' \
--header 'x-okapi-tenant: diku' \
--header "x-okapi-token: $TOKEN" \
--header 'Content-Type: multipart/form-data' \
--form 'file=@"/Users/siarhei/Desktop/barcode.csv"'

Start job

curl --location --request POST 'https://folio-snapshot-okapi.dev.folio.org:443/bulk-edit/dda6d273-f2f7-4f8d-800a-2541ea24c4a2/start' \
--header 'x-okapi-tenant: diku' \
--header "x-okapi-token: $TOKEN" \
--header 'Content-Type: application/json'

Post content updates - not aloowed status Aged to lost

curl --location --request POST 'https://folio-snapshot-okapi.dev.folio.org:443/bulk-edit/dda6d273-f2f7-4f8d-800a-2541ea24c4a2/items-content-update/upload' \
--header 'x-okapi-tenant: diku' \
--header "x-okapi-token: $TOKEN" \
--header 'Content-Type: application/json' \
--data-raw '{
  "entityType": "ITEM",
  "contentUpdates": [
    {
       "option": "STATUS",
        "action": "REPLACE_WITH",
        "value": "Aged to lost"
    }
  ],
  "totalRecords": 1
}'

Response - item status waa not changed on preview

{
    "items": [
        {
            "id": "100d10bf-2f06-4aa0-be15-0b95b2d9f9e3",
            "_version": 3,
            "hrid": "item000000000015",
            "holdingsRecordId": "e3ff6133-b9a2-4d4c-a1c9-dc1867d4df19",
            "formerIds": [],
            "discoverySuppress": null,
            "title": "A semantic web primer",
            "contributorNames": [
                {
                    "name": "Antoniou, Grigoris"
                },
                {
                    "name": "Van Harmelen, Frank"
                }
            ],
            "callNumber": "TK5105.88815 . A58 2004 FT MEADE",
            "barcode": "90000",
            "effectiveShelvingOrder": "TK 45105.88815 A58 42004 FT MEADE",
            "accessionNumber": null,
            "itemLevelCallNumber": "TK5105.88815 . A58 2004 FT MEADE",
            "itemLevelCallNumberPrefix": null,
            "itemLevelCallNumberSuffix": null,
            "itemLevelCallNumberTypeId": null,
            "effectiveCallNumberComponents": {
                "callNumber": "TK5105.88815 . A58 2004 FT MEADE",
                "prefix": null,
                "suffix": null,
                "typeId": "512173a7-bd09-490e-b773-17d83f2b63fe"
            },
            "volume": null,
            "enumeration": null,
            "chronology": null,
            "yearCaption": [],
            "itemIdentifier": null,
            "copyNumber": null,
            "numberOfPieces": null,
            "descriptionOfPieces": null,
            "numberOfMissingPieces": null,
            "missingPieces": null,
            "missingPiecesDate": null,
            "itemDamagedStatusId": null,
            "itemDamagedStatusDate": null,
            "administrativeNotes": [],
            "notes": [],
            "circulationNotes": [],
            "status": {
                "name": "Missing",
                "date": 1650517208176
            },
            "materialType": {
                "id": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
                "name": "book"
            },
            "isBoundWith": false,
            "boundWithTitles": [],
            "permanentLoanType": {
                "id": "2b94c631-fca9-4892-a730-03ee529ffe27",
                "name": "Can circulate"
            },
            "temporaryLoanType": null,
            "permanentLocation": {
                "id": "fcd64ce1-6995-48f0-840e-89ffa2288371",
                "name": "Main Library"
            },
            "temporaryLocation": {
                "id": "53cf956f-c1df-410b-8bea-27f712cca7c0",
                "name": "Annex"
            },
            "effectiveLocation": {
                "id": "53cf956f-c1df-410b-8bea-27f712cca7c0",
                "name": "Annex"
            },
            "electronicAccess": [
                {
                    "uri": "http://www.loc.gov/catdir/toc/ecip0718/2007020429.html",
                    "linkText": "Links available",
                    "materialsSpecification": "Table of contents",
                    "publicNote": "Table of contents only",
                    "relationshipId": "3b430592-2e09-4b48-9a0c-0636d66b9fb3"
                }
            ],
            "inTransitDestinationServicePointId": null,
            "statisticalCodeIds": [
                "b5968c9e-cddc-4576-99e3-8e60aed8b0dd"
            ],
            "purchaseOrderLineIdentifier": null,
            "metadata": null,
            "tags": {
                "tagList": []
            },
            "lastCheckIn": null
        }
    ],
    "totalRecords": 1,
    "resultInfo": null
}

Start job

curl --location --request POST 'https://folio-snapshot-okapi.dev.folio.org:443/bulk-edit/dda6d273-f2f7-4f8d-800a-2541ea24c4a2/start' \
--header 'x-okapi-tenant: diku' \
--header "x-okapi-token: $TOKEN" \
--header 'Content-Type: application/json'

Check job status

curl --location --request GET 'https://folio-snapshot-okapi.dev.folio.org:443/data-export-spring/jobs/dda6d273-f2f7-4f8d-800a-2541ea24c4a2' \
--header 'x-okapi-tenant: diku' \
--header "x-okapi-token: $TOKEN" \
--header 'Content-Type: application/json'

Response contains errors - see attached 2022-04-21-Errors-barcode.csv file

{
    "id": "dda6d273-f2f7-4f8d-800a-2541ea24c4a2",
    "name": "000003",
    "source": "diku_admin",
    "isSystemSource": false,
    "type": "BULK_EDIT_IDENTIFIERS",
    "exportTypeSpecificParameters": {},
    "status": "SUCCESSFUL",
    "files": [
        "",
        "https://folio-snapshot-export.s3.us-east-1.amazonaws.com/2022-04-21-Errors-barcode.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIA2VGNPE73JV77RBGE%2F20220421%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220421T052130Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=07dd92089cbd6a017adbbe720e02e475cccec62f7ce8f726838357132d68b431"
    ],
    "startTime": "2022-04-21T05:21:30.134+00:00",
    "endTime": "2022-04-21T05:21:30.556+00:00",
    "metadata": {
        "createdDate": "2022-04-21T05:18:27.358+00:00",
        "createdByUserId": "a273ecdc-7f40-5a86-89d5-1ff24d2c0491",
        "createdByUsername": "diku_admin",
        "updatedDate": "2022-04-21T05:21:30.683+00:00",
        "updatedByUserId": "a273ecdc-7f40-5a86-89d5-1ff24d2c0491",
        "updatedByUsername": "diku_admin"
    },
    "identifierType": "BARCODE",
    "entityType": "ITEM",
    "progress": {
        "total": 1,
        "processed": 1,
        "progress": 100
    }
}
Generated at Thu Feb 08 22:30:32 UTC 2024 using Jira 1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d.