sul-dlss / cocina-models

Cocina repository data model (implemented in Ruby)
https://sul-dlss.github.io/cocina-models/
3 stars 0 forks source link

subject identifier does not always need a source.code when creating MODS #538

Closed lwrubel closed 1 year ago

lwrubel commented 1 year ago

DSA will raise a NoMethodError when transforming descriptive metadata to MODS and a subject's identifier field lacks a source.code.

https://github.com/sul-dlss/cocina-models/blob/0d0ac20a901bb490b2458f4667e112019185687a/lib/cocina/models/mapping/to_mods/subject.rb#L436

@arcadiafalcone shared, "One of source.code, source.value, or source.uri should be required if there is identifier.value or identifier.code, but not required for identifier.uri. The URI is complete in itself, but a value or code needs the source info for it to be uniquely identifying."

jcoyne commented 1 year ago

@lwrubel being particular, the identifier lacks a source in the HB error you linked to.

arcadiafalcone commented 1 year ago

This applies to identifier anywhere in the descriptive schema.

ndushay commented 1 year ago

So is identifier missing source, or is the source incorrectly parallel with identifier?

Also - all of these errors are from a single collection - how was it loaded, was there a mistake, and can it easily be corrected?

Should we devs do anything?

example from https://argo.stanford.edu/view/qz472xb9161

image

"subject": [
           {
                "value": "Genu, Fetras",
                "type": "person",
                "identifier": [
                   {
                        "uri": "https://www.wikidata.org/wiki/Q99810743"
                    }
                ],
                "source": {
                    "code": "wikidata"
                }
            },
arcadiafalcone commented 1 year ago

The data is correct. We don't usually get this error because we don't usually have RWO identifiers for name subjects, but it was done for this collection. We do use them for contributor.identifier (e.g. ORCID) - is the code there doing something different to not get this error?

ndushay commented 1 year ago

@lwrubel if you need help with this, give a shout in the channel.