NEU-Libraries / cerberus

Digital Repository Service
8 stars 0 forks source link

Edit form alters XML #779

Open sarahjeansweeney opened 9 years ago

sarahjeansweeney commented 9 years ago

Similar/related to issue #760, when metadata is edited using the Edit form, certain XML fields are removed, swapped, or munged in unexpected ways. Here's what Dan reported to me:

"However, if you merely click on the “Edit” form – as I did for “Corn Poppy” (https://repository.library.northeastern.edu/files/neu:344090), and now also “German Iris” (https://repository.library.northeastern.edu/files/neu:344120) – the Name in the MODS record is split into first and last name fields. And in the case of Jacques Le Moyne de Morgues, the “Le Moyne” part of his name and his dates are deleted. And in the case of “Dog Rose” (https://repository.library.northeastern.edu/files/neu:344115), I clicked on the regular “edit” function and then saved the changes I made to the Abstract. This not only changed the MODS Name field, but also somehow moved the Title to the Related Item: Title field node."

(I added the URLs for the examples he mentions, but he used the XML editor to correct the metadata)

dgcliff commented 9 years ago

I don't think there's a fix for this. We may be able to implement the safe guard we discussed, where if you only edit permissions, that this doesn't occur, but otherwise, the form can't know or understand the open-ended nature of man made MODS xml, there are too many possibilities.

sarahjeansweeney commented 9 years ago

Let's go with the edit permissions safeguard, then. I'll advise anyone with XML editor access to use the edit form for permission changes only.

sarahjeansweeney commented 6 months ago

Reopening this because I think the permissions safeguard will need to be implemented for captions as well.

Earlier today Drew and Kim reported that files that recently had their caption files updated had suffered unexpected changes to the XML. Drew provided some good examples, which I've shared below, but it's worth noting that this issue seems intermittent - not every record with an updated caption has experienced these changes.

When captions are added to a record, the metadata for the personal and corporate creator names is changed. It appears as though it only happens when a namePart sub-element is repeated and within the same name type (personal or corporate). The repeated namePart element replaces the matching namePart element for the next creator/contributor (see personal example) OR if there isn’t another name listed, it creates a new name of the same type with the second namePart subelement as the new name (see corporate example).

You can see this change in the MODS history, and it’s changing the same day that the captions are being added to the record.

PERSONAL EXAMPLE: http://hdl.handle.net/2047/D20259814

BEFORE:

<mods:name type="personal" usage="primary" authorityURI="[http://id.loc.gov/authorities/names"](http://id.loc.gov/authorities/names%22) valueURI="[http://id.loc.gov/authorities/names/n2005036897">](http://id.loc.gov/authorities/names/n2005036897%22%3E)
      <mods:namePart type="given">Daniel J.</mods:namePart>
       <mods:namePart type="given">(Daniel Jared)</mods:namePart>
       <mods:namePart type="family">Cohen</mods:namePart>
       <mods:namePart type="date">1968-</mods:namePart>
      <mods:role>
           <mods:roleTerm authority="marcrelator" authorityURI="[http://id.loc.gov/vocabulary/relators"](http://id.loc.gov/vocabulary/relators%22) valueURI="[http://id.loc.gov/vocabulary/relators/cre"](http://id.loc.gov/vocabulary/relators/cre%22) type="text">Creator</mods:roleTerm>
      </mods:role>
  </mods:name>

  <mods:name type="corporate" usage="primary" authorityURI="[http://id.loc.gov/authorities/names"](http://id.loc.gov/authorities/names%22) valueURI="[http://id.loc.gov/authorities/names/n84066203">](http://id.loc.gov/authorities/names/n84066203%22%3E)
      <mods:namePart>Northeastern University (Boston, Mass.)</mods:namePart>
      <mods:namePart>Libraries</mods:namePart>
      <mods:role>
           <mods:roleTerm authority="marcrelator" authorityURI="[http://id.loc.gov/vocabulary/relators"](http://id.loc.gov/vocabulary/relators%22) valueURI="[http://id.loc.gov/vocabulary/relators/cre"](http://id.loc.gov/vocabulary/relators/cre%22) type="text">Creator</mods:roleTerm></mods:role></mods:name>

           <mods:name type="personal" authorityURI="[http://id.loc.gov/authorities/names"](http://id.loc.gov/authorities/names%22) valueURI="[http://id.loc.gov/authorities/names/n98013297">](http://id.loc.gov/authorities/names/n98013297%22%3E)
      <mods:namePart type="given">Ellen</mods:namePart>
       <mods:namePart type="family">Cushman</mods:namePart>
       <mods:namePart type="date">1967-</mods:namePart>
      <mods:role>
           <mods:roleTerm authority="marcrelator" authorityURI="[http://id.loc.gov/vocabulary/relators"](http://id.loc.gov/vocabulary/relators%22) valueURI="[http://id.loc.gov/vocabulary/relators/ctr"](http://id.loc.gov/vocabulary/relators/ctr%22) type="text">Contributor</mods:roleTerm>
      </mods:role>
  </mods:name>

AFTER:

<mods:name type="personal" usage="primary" authorityURI="[http://id.loc.gov/authorities/names"](http://id.loc.gov/authorities/names%22) valueURI="[http://id.loc.gov/authorities/names/n2005036897">](http://id.loc.gov/authorities/names/n2005036897%22%3E)

      <mods:namePart type="given">Daniel J.</mods:namePart>
       <mods:namePart type="family">Cohen</mods:namePart>
       <mods:namePart type="date">1968-</mods:namePart>
      <mods:role>
           <mods:roleTerm authority="marcrelator" authorityURI="[http://id.loc.gov/vocabulary/relators"](http://id.loc.gov/vocabulary/relators%22) valueURI="[http://id.loc.gov/vocabulary/relators/cre"](http://id.loc.gov/vocabulary/relators/cre%22) type="text">Creator</mods:roleTerm>
      </mods:role>
  <mods:namePart/></mods:name>

  <mods:name type="corporate" authorityURI="[http://id.loc.gov/authorities/names"](http://id.loc.gov/authorities/names%22) valueURI="[http://id.loc.gov/authorities/names/n84066203">](http://id.loc.gov/authorities/names/n84066203%22%3E)

      <mods:namePart>Northeastern University (Boston, Mass.)</mods:namePart>
      <mods:role>
           <mods:roleTerm authority="marcrelator" authorityURI="[http://id.loc.gov/vocabulary/relators"](http://id.loc.gov/vocabulary/relators%22) valueURI="[http://id.loc.gov/vocabulary/relators/cre"](http://id.loc.gov/vocabulary/relators/cre%22) type="text">Creator</mods:roleTerm></mods:role></mods:name><mods:name type="corporate"><mods:namePart>Libraries</mods:namePart></mods:name>

           <mods:name type="personal" authorityURI="[http://id.loc.gov/authorities/names"](http://id.loc.gov/authorities/names%22) valueURI="[http://id.loc.gov/authorities/names/n98013297">](http://id.loc.gov/authorities/names/n98013297%22%3E)
      <mods:namePart type="given">(Daniel Jared)</mods:namePart>
       <mods:namePart type="family">Cushman</mods:namePart>
       <mods:namePart type="date">1967-</mods:namePart>
      <mods:role>
           <mods:roleTerm authority="marcrelator" authorityURI="[http://id.loc.gov/vocabulary/relators"](http://id.loc.gov/vocabulary/relators%22) valueURI="[http://id.loc.gov/vocabulary/relators/ctr"](http://id.loc.gov/vocabulary/relators/ctr%22) type="text">Contributor</mods:roleTerm>
      </mods:role>
  <mods:namePart/>
</mods:name>

CORPORATE EXAMPLE: http://hdl.handle.net/2047/D20234682 BEFORE:

<mods:name type="corporate" usage="primary" authority="lcnaf" authorityURI="[http://id.loc.gov/authorities/names"](http://id.loc.gov/authorities/names%22) valueURI="[http://id.loc.gov/authorities/names/n80044968">](http://id.loc.gov/authorities/names/n80044968%22%3E)
       <mods:namePart>Northeastern University.</mods:namePart>
       <mods:namePart>Boston, Mass.</mods:namePart>
      <mods:role>
          <mods:roleTerm valueURI="[http://id.loc.gov/vocabulary/relators/cre"](http://id.loc.gov/vocabulary/relators/cre%22) authority="marcrelator" authorityURI="[http://id.loc.gov/vocabulary/relators"](http://id.loc.gov/vocabulary/relators%22) type="text">Creator</mods:roleTerm>
      </mods:role>
      <mods:affiliation>Northeastern University</mods:affiliation>
  </mods:name>

AFTER:

<mods:name type="corporate" usage="primary" authority="lcnaf"
                  authorityURI="[http://id.loc.gov/authorities/names”](http://id.loc.gov/authorities/names%E2%80%9D) valueURI="[http://id.loc.gov/authorities/names/n80044968">](http://id.loc.gov/authorities/names/n80044968%22%3E)
       <mods:namePart>Northeastern University.</mods:namePart>
<mods:role>
<mods:roleTerm valueURI="[http://id.loc.gov/vocabulary/relators/cre"](http://id.loc.gov/vocabulary/relators/cre%22) authority="marcrelator"        authorityURI="[http://id.loc.gov/vocabulary/relators"](http://id.loc.gov/vocabulary/relators%22) type="text">Creator</mods:roleTerm>
</mods:role>
<mods:affiliation>Northeastern University</mods:affiliation>
</mods:name>
<mods:name type="corporate">
       <mods:namePart>Boston, Mass.</mods:namePart>
</mods:name>
sarahjeansweeney commented 6 months ago

Drew just confirmed that this is also happening when a thumbnail is replaced, not just the caption file.

dgcliff commented 6 months ago

Taking a look at it as of today - Yes, I'm not surprised it happens with the thumbnail, caption or anything else - I'm like 99% sure it'd happen even if you changed nothing on the form, but still hit the submit button. It's the POST and backend applying the save that applies that bad MODS logic to happen. The issue lies in that ORM code, but hopefully we can come up with a patch 👍

dgcliff commented 6 months ago

This should be fixed with 7da5699 but I'll wait to to close until I've demo'd with someone in DPS