cgspace-notes/docs/2023-02/index.html

360 lines
17 KiB
HTML

<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta property="og:title" content="February, 2023" />
<meta property="og:description" content="2023-02-01
Export CGSpace to cross check the DOI metadata with Crossref
I want to try to expand my use of their data to journals, publishers, volumes, issues, etc&hellip;
" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://alanorth.github.io/cgspace-notes/2023-02/" />
<meta property="article:published_time" content="2023-02-01T10:57:36+03:00" />
<meta property="article:modified_time" content="2023-02-13T10:33:16+03:00" />
<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="February, 2023"/>
<meta name="twitter:description" content="2023-02-01
Export CGSpace to cross check the DOI metadata with Crossref
I want to try to expand my use of their data to journals, publishers, volumes, issues, etc&hellip;
"/>
<meta name="generator" content="Hugo 0.110.0">
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BlogPosting",
"headline": "February, 2023",
"url": "https://alanorth.github.io/cgspace-notes/2023-02/",
"wordCount": "1019",
"datePublished": "2023-02-01T10:57:36+03:00",
"dateModified": "2023-02-13T10:33:16+03:00",
"author": {
"@type": "Person",
"name": "Alan Orth"
},
"keywords": "Notes"
}
</script>
<link rel="canonical" href="https://alanorth.github.io/cgspace-notes/2023-02/">
<title>February, 2023 | CGSpace Notes</title>
<!-- combined, minified CSS -->
<link href="https://alanorth.github.io/cgspace-notes/css/style.c6ba80bc50669557645abe05f86b73cc5af84408ed20f1551a267bc19ece8228.css" rel="stylesheet" integrity="sha256-xrqAvFBmlVdkWr4F&#43;GtzzFr4RAjtIPFVGiZ7wZ7Ogig=" crossorigin="anonymous">
<!-- minified Font Awesome for SVG icons -->
<script defer src="https://alanorth.github.io/cgspace-notes/js/fontawesome.min.f5072c55a0721857184db93a50561d7dc13975b4de2e19db7f81eb5f3fa57270.js" integrity="sha256-9QcsVaByGFcYTbk6UFYdfcE5dbTeLhnbf4HrXz&#43;lcnA=" crossorigin="anonymous"></script>
<!-- RSS 2.0 feed -->
</head>
<body>
<div class="blog-masthead">
<div class="container">
<nav class="nav blog-nav">
<a class="nav-link " href="https://alanorth.github.io/cgspace-notes/">Home</a>
</nav>
</div>
</div>
<header class="blog-header">
<div class="container">
<h1 class="blog-title" dir="auto"><a href="https://alanorth.github.io/cgspace-notes/" rel="home">CGSpace Notes</a></h1>
<p class="lead blog-description" dir="auto">Documenting day-to-day work on the <a href="https://cgspace.cgiar.org">CGSpace</a> repository.</p>
</div>
</header>
<div class="container">
<div class="row">
<div class="col-sm-8 blog-main">
<article class="blog-post">
<header>
<h2 class="blog-post-title" dir="auto"><a href="https://alanorth.github.io/cgspace-notes/2023-02/">February, 2023</a></h2>
<p class="blog-post-meta">
<time datetime="2023-02-01T10:57:36+03:00">Wed Feb 01, 2023</time>
in
<span class="fas fa-folder" aria-hidden="true"></span>&nbsp;<a href="/categories/notes/" rel="category tag">Notes</a>
</p>
</header>
<h2 id="2023-02-01">2023-02-01</h2>
<ul>
<li>Export CGSpace to cross check the DOI metadata with Crossref
<ul>
<li>I want to try to expand my use of their data to journals, publishers, volumes, issues, etc&hellip;</li>
</ul>
</li>
</ul>
<ul>
<li>First, extract a list of DOIs for use with <code>crossref-doi-lookup.py</code>:</li>
</ul>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>$ csvcut -c <span style="color:#e6db74">&#39;cg.identifier.doi[en_US]&#39;</span> ~/Downloads/2023-02-01-cgspace.csv <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span> | csvgrep -c 1 -m &#39;doi.org&#39; \
</span></span><span style="display:flex;"><span> | csvgrep -c 1 -m &#39; &#39; -i \
</span></span><span style="display:flex;"><span> | csvgrep -c 1 -r &#39;.*cifor.*&#39; -i \
</span></span><span style="display:flex;"><span> | sed 1d &gt; /tmp/2023-02-01-dois.txt
</span></span><span style="display:flex;"><span>$ ./ilri/crossref-doi-lookup.py -e a.orth@cgiar.org -i /tmp/2023-02-01-dois.txt -o ~/Downloads/2023-01-31-crossref-results.csv -d
</span></span></code></pre></div><ul>
<li>Then extract the ID, DOI, journal, volume, issue, publisher, etc from the CGSpace dump and rename the <code>cg.identifier.doi[en_US]</code> to <code>doi</code> so we can join on it with the Crossref results file:</li>
</ul>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>$ csvcut -c <span style="color:#e6db74">&#39;id,cg.identifier.doi[en_US],cg.journal[en_US],cg.volume[en_US],cg.issue[en_US],dcterms.publisher[en_US],cg.number[en_US],dcterms.license[en_US]&#39;</span> ~/Downloads/2023-02-01-cgspace.csv <span style="color:#ae81ff">\
</span></span></span><span style="display:flex;"><span><span style="color:#ae81ff"></span> | csvgrep -c &#39;cg.identifier.doi[en_US]&#39; -r &#39;.*cifor.*&#39; -i \
</span></span><span style="display:flex;"><span> | sed -e &#39;1s/cg.identifier.doi\[en_US\]/doi/&#39; \
</span></span><span style="display:flex;"><span> -e &#39;s_https://doi.org/__g&#39; \
</span></span><span style="display:flex;"><span> -e &#39;s_https://dx.doi.org/__g&#39; \
</span></span><span style="display:flex;"><span> &gt; /tmp/2023-02-01-cgspace-doi-metadata.csv
</span></span><span style="display:flex;"><span>$ csvjoin -c doi /tmp/2023-02-01-cgspace-doi-metadata.csv ~/Downloads/2023-02-01-crossref-results.csv &gt; /tmp/2023-02-01-cgspace-crossref-check.csv
</span></span></code></pre></div><ul>
<li>And import into OpenRefine for analysis and cleaning</li>
<li>I just noticed that Crossref also has types, so we could use that in the future too!</li>
<li>I got a few corrections after examining manually, but I didn&rsquo;t manage to identify any patterns that I could use to do any automatic matching or cleaning</li>
</ul>
<h2 id="2023-02-05">2023-02-05</h2>
<ul>
<li>Normalize text lang attributes in PostgreSQL, run a quick Discovery index, and then export CGSpace to check Initiative mappings and countries/regions</li>
<li>Run all system updates on CGSpace (linode18) and reboot it</li>
</ul>
<h2 id="2023-02-06">2023-02-06</h2>
<ul>
<li>Peter said that a new Initiative was approved last month so we need to add it to CGSpace: <code>Fragility, Conflict, and Migration</code></li>
<li>There is lots of discussion about the &ldquo;issue date&rdquo; versus &ldquo;available date&rdquo; with Enrico and IFPRI, after lots of feedback from the PRMS QA
<ul>
<li>I filed <a href="https://github.com/AgriculturalSemantics/cg-core/issues/43">an issue on CG Core to propose using <code>dcterms.available</code> as an optional field to indicate the online date</a></li>
</ul>
</li>
</ul>
<h2 id="2023-02-07">2023-02-07</h2>
<ul>
<li>IFPRI&rsquo;s web developer Tony managed to get his Drupal harvester to have a useful user agent:</li>
</ul>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>54.x.x.x - - [06/Feb/2023:10:10:32 +0100] &#34;POST /rest/items/find-by-metadata-field?limit=%22100&amp;offset=0 HTTP/1.1&#34; 200 58855 &#34;-&#34; &#34;IFPRI drupal POST harvester&#34;
</span></span></code></pre></div><ul>
<li>He also noticed that there is no pagination on POST requests to <code>/rest/items/find-by-metadata-field</code>, and that he needs to increase his timeout for requests that return 100+ results, ie:</li>
</ul>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>curl -f -H &#34;Content-Type: application/json&#34; -X POST &#34;https://dspacetest.cgiar.org/rest/items/find-by-metadata-field&#34; -d &#39;{&#34;key&#34;:&#34;cg.subject.actionArea&#34;, &#34;value&#34;:&#34;Systems Transformation&#34;, &#34;language&#34;: &#34;en_US&#34;}&#39;
</span></span></code></pre></div><ul>
<li>I need to ask on the DSpace Slack about this POST pagination</li>
<li>Abenet and Udana noticed that the Handle server was not running
<ul>
<li>Looking in the <code>error.log</code> file I see that the service is complaining about a lock file being present</li>
<li>This is because Linode had to do emergency maintenance on the VM host this morning and the Handle server didn&rsquo;t shut down properly</li>
</ul>
</li>
<li>I&rsquo;m having an issue with <code>poetry update</code> so I spent some time debugging and filed <a href="https://github.com/python-poetry/poetry/issues/7482">an issue</a></li>
<li>Proof and import nine items for the Digital Innovation Inititive for IFPRI
<ul>
<li>There were only some minor issues in the metadata</li>
<li>I also did a duplicate check with <code>check-duplicates.py</code> just in case</li>
</ul>
</li>
<li>I did some minor updates on csv-metadata-quality
<ul>
<li>First, to reduce warnings on non-SPDX licenses like &ldquo;Copyrighted; all rights reserved&rdquo; and &ldquo;Other&rdquo; since they are very common for us and I&rsquo;m sick of seeing the warnings</li>
<li>Second, to skip whitespace and newline fixes on the abstract field since so many times they are intended</li>
</ul>
</li>
</ul>
<h2 id="2023-02-08">2023-02-08</h2>
<ul>
<li>Make some edits to IFPRI records requested by Jawoo and Leigh</li>
<li>Help Alessandra upload a last minute report for SAPLING</li>
<li>Proof and upload twenty-seven IFPRI records to CGSpace
<ul>
<li>It&rsquo;s a good thing I did a duplicate check because I found three duplicates!</li>
</ul>
</li>
<li>Export CGSpace to update Initiative mappings and country/region mappings
<ul>
<li>Then start a harvest on AReS</li>
</ul>
</li>
</ul>
<h2 id="2023-02-09">2023-02-09</h2>
<ul>
<li>Do some minor work on the CSS on the DSpace 7 test</li>
</ul>
<h2 id="2023-02-10">2023-02-10</h2>
<ul>
<li>I noticed a large number of PostgreSQL locks from dspaceWeb on CGSpace:</li>
</ul>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>$ psql -c <span style="color:#e6db74">&#39;SELECT * FROM pg_locks pl LEFT JOIN pg_stat_activity psa ON pl.pid = psa.pid;&#39;</span> | grep -o -E <span style="color:#e6db74">&#39;(dspaceWeb|dspaceApi|dspaceCli)&#39;</span> | sort | uniq -c
</span></span><span style="display:flex;"><span> 2033 dspaceWeb
</span></span></code></pre></div><ul>
<li>Looking at the lock age, I see some already 1 day old, including this curious query:</li>
</ul>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>select nextval (&#39;public.registrationdata_seq&#39;)
</span></span></code></pre></div><ul>
<li>I killed all locks that were more than a few hours old</li>
<li>Export CGSpace to update Initiative collection mappings</li>
<li>Discuss adding <code>dcterms.available</code> to the submission form
<ul>
<li>I also looked in the <code>dcterms.description</code> field on CGSpace and found ~1,500 items where the is an indication of an online published date</li>
<li>Using some facets in OpenRefine I narrowed down the ones mentioning &ldquo;online&rdquo; and then extracted the dates to a new column:</li>
</ul>
</li>
</ul>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>cells[&#39;dcterms.description[en_US]&#39;].value.replace(/.*?(\d+{2}) ([a-zA-Z]+) (\d+{2}).*/,&#34;$3-$2-$1&#34;)
</span></span></code></pre></div><ul>
<li>Then to handle formats like &ldquo;2022-April-26&rdquo; and &ldquo;2021-Nov-11&rdquo; I used some replacement GRELs (note the order so we don&rsquo;t replace short patterns in longer strings prematurely):</li>
</ul>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-console" data-lang="console"><span style="display:flex;"><span>value.replace(&#34;January&#34;,&#34;01&#34;).replace(&#34;February&#34;,&#34;02&#34;).replace(&#34;March&#34;,&#34;03&#34;).replace(&#34;April&#34;,&#34;04&#34;).replace(&#34;May&#34;,&#34;05&#34;).replace(&#34;June&#34;,&#34;06&#34;).replace(&#34;July&#34;,&#34;07&#34;).replace(&#34;August&#34;,&#34;08&#34;).replace(&#34;September&#34;,&#34;09&#34;).replace(&#34;October&#34;,&#34;10&#34;).replace(&#34;November&#34;,&#34;11&#34;).replace(&#34;December&#34;,&#34;12&#34;)
</span></span><span style="display:flex;"><span>value.replace(&#34;Jan&#34;,&#34;01&#34;).replace(&#34;Feb&#34;,&#34;02&#34;).replace(&#34;Mar&#34;,&#34;03&#34;).replace(&#34;Apr&#34;,&#34;04&#34;).replace(&#34;May&#34;,&#34;05&#34;).replace(&#34;Jun&#34;,&#34;06&#34;).replace(&#34;Jul&#34;,&#34;07&#34;).replace(&#34;Aug&#34;,&#34;08&#34;).replace(&#34;Sep&#34;,&#34;09&#34;).replace(&#34;Oct&#34;,&#34;10&#34;).replace(&#34;Nov&#34;,&#34;11&#34;).replace(&#34;Dec&#34;,&#34;12&#34;)
</span></span></code></pre></div><ul>
<li>This covered about 1,300 items, then I did about 100 more messier ones with some more regex wranling
<ul>
<li>I removed the <code>dcterms.description[en_US]</code> field from items where I updated the dates</li>
</ul>
</li>
<li>Then I added <code>dcterms.available</code> to the submission form and the item view
<ul>
<li>We need to announce this to the editors</li>
</ul>
</li>
</ul>
<h2 id="2023-02-13">2023-02-13</h2>
<ul>
<li>Export CGSpace to do some metadata quality checks
<ul>
<li>I added CGIAR Trust Fund as a donor to some new Initiative outputs</li>
<li>I moved some abstracts from the description field</li>
<li>I moved some version information to the <code>cg.edition</code> field</li>
</ul>
</li>
</ul>
<h2 id="2023-02-14">2023-02-14</h2>
<ul>
<li>The PRMS team in Colombia sent some questions about countries on CGSpace
<ul>
<li>I had to fix some, that were clearly wrong, but there is also a difference between CGSpace and MEL because we use mostly iso-codes, and MEL uses the UN M.49 list</li>
<li>Then I re-ran the country code tagger from cgspace-java-helpers, forcing the update on all items in the Initiatives community</li>
</ul>
</li>
<li>Remove Alliance research levers from <code>cg.contributor.crp</code> field after discussing with Daniel and Maria
<ul>
<li>This was a mistake on TIP&rsquo;s part, and there is no direct mapping between research levers and CRPs</li>
</ul>
</li>
<li>I exported CGSpace to check Initiative collection mappings, regions, and licenses
<ul>
<li>Peter told me that all CGIAR blog posts for the Initiatives should be CC-BY-4.0, and I see the logo at the bottom in light gray!</li>
<li>I had previously missed that and removed some licenses for blog posts</li>
<li>I checked cgiar.org, ifpri.org, icarda.org, iwmi.cgiar.org, irri.org, etc and corrected a handful</li>
</ul>
</li>
<li>Start a harvest on AReS</li>
</ul>
<!-- raw HTML omitted -->
</article>
</div> <!-- /.blog-main -->
<aside class="col-sm-3 ml-auto blog-sidebar">
<section class="sidebar-module">
<h4>Recent Posts</h4>
<ol class="list-unstyled">
<li><a href="/cgspace-notes/2023-02/">February, 2023</a></li>
<li><a href="/cgspace-notes/2023-01/">January, 2023</a></li>
<li><a href="/cgspace-notes/2022-12/">December, 2022</a></li>
<li><a href="/cgspace-notes/2022-11/">November, 2022</a></li>
<li><a href="/cgspace-notes/2022-10/">October, 2022</a></li>
</ol>
</section>
<section class="sidebar-module">
<h4>Links</h4>
<ol class="list-unstyled">
<li><a href="https://cgspace.cgiar.org">CGSpace</a></li>
<li><a href="https://dspacetest.cgiar.org">DSpace Test</a></li>
<li><a href="https://github.com/ilri/DSpace">CGSpace @ GitHub</a></li>
</ol>
</section>
</aside>
</div> <!-- /.row -->
</div> <!-- /.container -->
<footer class="blog-footer">
<p dir="auto">
Blog template created by <a href="https://twitter.com/mdo">@mdo</a>, ported to Hugo by <a href='https://twitter.com/mralanorth'>@mralanorth</a>.
</p>
<p>
<a href="#">Back to top</a>
</p>
</footer>
</body>
</html>