<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
p.xmsonormal, li.xmsonormal, div.xmsonormal
        {mso-style-name:x_msonormal;
        margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Thank you Mark for your reply, much appreciated. <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">We ended up fixing it via the API using some Python code that our Digital Archivist, Elizabeth James, wrote. She ran her code after we took a snapshot of the VM, and it worked fine to suppress and then merge the records. So, all is well
 with our instance now thanks to Elizabeth!<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Just wanted to give you an update on this.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks again!<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="xmsonormal">Steve Giessler<o:p></o:p></p>
<p class="xmsonormal">Professional Technologist<o:p></o:p></p>
<p class="xmsonormal">WVU Libraries<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black"><archivesspace_users_group-bounces@lyralists.lyrasis.org> on behalf of Mark Cooper <mark.cooper@lyrasis.org><br>
<b>Reply-To: </b>Archivesspace Users Group <archivesspace_users_group@lyralists.lyrasis.org><br>
<b>Date: </b>Friday, August 12, 2022 at 9:04 PM<br>
<b>To: </b>Archivesspace Users Group <archivesspace_users_group@lyralists.lyrasis.org><br>
<b>Subject: </b>Re: [Archivesspace_Users_Group] date_type accession record errors<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">Hi Steve, <o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I think you're essentially correct here.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Direct DB updates are generally frowned upon but are the easiest way out in this case.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">I'm going completely off memory so backup and try things carefully as I may not be 100% accurate with the SQL:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Get the ids for the controlled values from the `enumeration_value` table.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">===<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">SELECT ev.id, ev.value FROM enumeration_value ev JOIN enumeration e ON e.id = ev.enumeration_id WHERE e.name = 'date_type';<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">===<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Update the `date` table `date_type_id` replacing the capitalized value id with the lower case value id.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Simplest update would be something like:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">===<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">UPDATE `date` SET date_type_id = $lower_case_value_id WHERE date_type_id = $capitalized_value_id;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">===<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">With no relationships to the capitalized value it should be possible to delete it:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">===<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">DELETE FROM `enumeration_value` WHERE id = $capitalized_value_id;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">===<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">And I'm not completely sure but I think newer versions of ASpace prevent this from occurring, but I could be wrong on that.
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Best,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Mark<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">LYRASIS<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="0" width="100%" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> archivesspace_users_group-bounces@lyralists.lyrasis.org <archivesspace_users_group-bounces@lyralists.lyrasis.org> on behalf of Steven Giessler <Steve.Giessler@mail.wvu.edu><br>
<b>Sent:</b> Friday, August 12, 2022 2:30 PM<br>
<b>To:</b> archivesspace_users_group@lyralists.lyrasis.org <archivesspace_users_group@lyralists.lyrasis.org><br>
<b>Subject:</b> [Archivesspace_Users_Group] date_type accession record errors</span>
<o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="xmsonormal">Dear ArchivesSpace Users Group,<o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal">Here at West Virginia University, we have a problem where a batch upload of accession records are resulting in new errors appearing in the logs with:<o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal">F, [2022-08-11T20:14:53.833183 #10996] FATAL -- :<br>
F, [2022-08-11T20:14:53.833850 #10996] FATAL -- : ActionView::Template::Error (No such template: "date_type_Single"):<br>
F, [2022-08-11T20:14:53.834690 #10996] FATAL -- : 45: <% end %><o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal">When you try to Edit each record, and you cannot edit but simply get the dreaded: “<b>We're sorry, but something went wrong.”
</b> <o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal">Based on the error message in the logs we see when we click “Edit,” we believe that the Value field single was accidentally capitalized during the batch uploads in .csv files used for the uploads. So, it should have been lower case “single”
 instead of “Single” (we surmise).  The first attached screenshot (I hope screenshots are allowed to be included with postings here) shows that we now have a couple of extra value columns now for date_type, with records separated into two groups for each of
 the erroneous Value fields (Single, and Inclusive which you can see are the last two rows under Controlled Value List: Date Type (date_type). The 2<sup>nd</sup> attached screenshot shows a sample of the column in the .csv used for the batch upload with the
 capitalized date_1_type fields.<o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal">We are thinking to fix this, we probably need to merge “Single” items with “single” and “Inclusive” items with “inclusive” with lower case Values being the ones they get merged into and then deleting the corresponding capitalized Value
 instances.<o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal">Does this make sense? If so, how can we clean this up? I am guessing we may need to edit the MySQL database directly? Or is there a better way through the GUI? With many other Controlled Value Lists there are three options (Suppress/Merge/Delete)
 in the GUI for each Value, but not so for date_type which only has “Suppress” as an option. If we could Merge and then Delete we could probably clean this up in the GUI, but that doesn’t appear to be an option for us.<o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal">We are presently running ArchivesSpace version 2.8.0 on Red Hat Enterprise Linux 7.<o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal">Thank you in advance for any suggestions,<o:p></o:p></p>
<p class="xmsonormal"> <o:p></o:p></p>
<p class="xmsonormal">Steve Giessler<o:p></o:p></p>
<p class="xmsonormal">Professional Technologist<o:p></o:p></p>
<p class="xmsonormal">WVU Libraries<o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>