NASA-PDS / doi-ui

The web interface for the PDS DOI Service providing the ability management PDS archive DOIs. See the DOI Service for more details on the available capabilities. https://nasa-pds.github.io/doi-service/
Apache License 2.0
0 stars 4 forks source link

Change Identifier To String #128 #129

Closed eddiesarevalo closed 2 years ago

eddiesarevalo commented 2 years ago

🗒️ Summary

-Added a fix for changing the identifier to a string. The parser converts it to _text but should just be a normal string. This only happens when the identifier is a number. If it is a string it doesn't get converted that way.

⚙️ Test Data and/or Report

Run the doi-ui locally and connect to the api through a tunnel. Create a dummy doi in create menu. Copy the doi number and open the release page. Change the value of the identifier to a number for example 1234 Then submit. There should be no error about {"_text":20151} The number will be what was inputted before.

The upload payload in the console should look like: identifiers: [{identifier: "1234", identifierType: "Site ID"}] for the identifiers part. The number will be what was inputted before.

The error before was identifiers: [{identifier: {"_text":20151}, identifierType: "Site ID"}]

♻️ Related Issues

-fixes #128

eddiesarevalo commented 2 years ago

@tloubrieu-jpl I added the fix for an array of identifiers.

tloubrieu-jpl commented 2 years ago

Thanks @eddiesarevalo for the fix for multiple identifier.

I've tested the update but I am bumping into the same type of error for the tag suffix, just above.

See this example DOI XML (I should have started there): `

10.17189/20151 dois 10.17189/20151 20151 20151 IAD ID urn:nasa:pds:insight_cameras::1.0 Site ID Personal J. Maki Personal P. Zamani Personal H. Abarca Personal R. Deen InSight Cameras Bundle en NASA Planetary Data System 2019 Organizational Planetary Data System: PDS Cartography and Imaging Sciences Discipline Node DataCurator Collection PDS4 Bundle https://pds.jpl.nasa.gov/ds-view/pds/viewBundle.jsp?identifier=urn%3Anasa%3Apds%3Ainsight_cameras&version=1.0 2020-05-07T22:12:05.000000Z 2020-05-07T22:12:05.000000Z findable en http://datacite.org/schema/kernel-4

` The translated json gives:


{
  "doi": "10.17189/20151",
  "suffix": {
    "_text": 20151
  },
  "identifiers": [
    {
      "identifier": "20151",
      "identifierType": "IAD ID"
    },
    {
      "identifier": "urn:nasa:pds:insight_cameras::1.0",
      "identifierType": "Site ID"
    }
  ],
  "creators": [
    {
      "nameType": "Personal",
      "name": "J. Maki"
    },
    {
      "nameType": "Personal",
      "name": "P. Zamani"
    },
    {
      "nameType": "Personal",
      "name": "H. Abarca"
    },
    {
      "nameType": "Personal",
      "name": "R. Deen"
    }
  ],
  "titles": [
    {
      "title": "InSight Cameras Bundle",
      "lang": "en"
    }
  ],
  "publisher": "NASA Planetary Data System",
  "publicationYear": "2019",
  "contributors": [
    {
      "nameType": "Organizational",
      "name": "Planetary Data System: PDS Cartography and Imaging Sciences Discipline Node",
      "contributorType": "DataCurator"
    }
  ],
  "types": {
    "resourceTypeGeneral": "Collection",
    "resourceType": "PDS4 Bundle"
  },
  "url": "https://pds.jpl.nasa.gov/ds-view/pds/viewBundle.jsp?identifier=urn%3Anasa%3Apds%3Ainsight_cameras&version=1.0",
  "created": "2020-05-07T22:12:05.000000Z",
  "updated": "2020-05-07T22:12:05.000000Z",
  "state": "findable",
  "language": "en",
  "schemaVersion": "http://datacite.org/schema/kernel-4"
}

Could you add a routine on the json which would transform any of these objects { "_text": value } into "value"

Unless there is a specific case where we know we want an integer (as you did for the publication year).

Would that work ?

eddiesarevalo commented 2 years ago

@tloubrieu-jpl I added a generic version of the fix. It iterates through the record json and replaces any _text with its own value. I was able to test with your example and some of my own.