cgspace-notes/docs/2024-08/index.html
2024-12-04 16:27:49 +03:00

244 lines
9.1 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="August, 2024" />
<meta property="og:description" content="2024-08-08
While working on the CGIAR Climate Change Synthesis I learned some new tricks with OpenRefine
" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://alanorth.github.io/cgspace-notes/2024-08/" />
<meta property="article:published_time" content="2024-08-08T23:07:00-07:00" />
<meta property="article:modified_time" content="2024-08-28T11:35:05+03:00" />
<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="August, 2024"/>
<meta name="twitter:description" content="2024-08-08
While working on the CGIAR Climate Change Synthesis I learned some new tricks with OpenRefine
"/>
<meta name="generator" content="Hugo 0.133.1">
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BlogPosting",
"headline": "August, 2024",
"url": "https://alanorth.github.io/cgspace-notes/2024-08/",
"wordCount": "301",
"datePublished": "2024-08-08T23:07:00-07:00",
"dateModified": "2024-08-28T11:35:05+03:00",
"author": {
"@type": "Person",
"name": "Alan Orth"
},
"keywords": "Notes"
}
</script>
<link rel="canonical" href="https://alanorth.github.io/cgspace-notes/2024-08/">
<title>August, 2024 | 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/2024-08/">August, 2024</a></h2>
<p class="blog-post-meta">
<time datetime="2024-08-08T23:07:00-07:00">Thu Aug 08, 2024</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="2024-08-08">2024-08-08</h2>
<ul>
<li>While working on the CGIAR Climate Change Synthesis I learned some new tricks with OpenRefine</li>
</ul>
<ul>
<li>The first was to retrieve affiliations from OpenAlex and extract them from JSON with this GREL:</li>
</ul>
<pre tabindex="0"><code>forEach(
value.parseJson()[&#39;authorships&#39;],
a,
forEach(
a.parseJson()[&#39;institutions&#39;],
i,
i[&#39;display_name&#39;]
).join(&#34;||&#34;)
).join(&#34;||&#34;)
</code></pre><ul>
<li>It is a nested <code>forEach</code> to extract all institutions for all authors</li>
<li>Second was a better way to deduplicate lists in Jython while preserving list order:</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-python" data-lang="python"><span style="display:flex;"><span><span style="color:#75715e"># better dedupe preserves order</span>
</span></span><span style="display:flex;"><span>seen <span style="color:#f92672">=</span> set()
</span></span><span style="display:flex;"><span>deduped_list <span style="color:#f92672">=</span> [x <span style="color:#66d9ef">for</span> x <span style="color:#f92672">in</span> value<span style="color:#f92672">.</span>split(<span style="color:#e6db74">&#34;||&#34;</span>) <span style="color:#66d9ef">if</span> x <span style="color:#f92672">not</span> <span style="color:#f92672">in</span> seen <span style="color:#f92672">and</span> <span style="color:#f92672">not</span> seen<span style="color:#f92672">.</span>add(x)]
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">return</span> <span style="color:#e6db74">&#34;||&#34;</span><span style="color:#f92672">.</span>join(deduped_list)
</span></span></code></pre></div><h2 id="2024-08-20">2024-08-20</h2>
<ul>
<li>Delete duplicate metadata values using the method I described in this GitHub issue: <a href="https://github.com/DSpace/DSpace/issues/8253#issuecomment-1331756418">https://github.com/DSpace/DSpace/issues/8253#issuecomment-1331756418</a></li>
</ul>
<h2 id="2024-08-22">2024-08-22</h2>
<ul>
<li>
<p>Help IWMI with some OpenSearch RSS/Atom feeds for search results:</p>
<ul>
<li><a href="https://cgspace.cgiar.org/server/opensearch/search?query=affiliation:%22International">https://cgspace.cgiar.org/server/opensearch/search?query=affiliation:&quot;International</a> Water Management Institute&quot; AND initiative:&ldquo;Climate Resilience&rdquo; AND subject:flooding</li>
<li><a href="https://cgspace.cgiar.org/server/opensearch/search?query=affiliation:%22International">https://cgspace.cgiar.org/server/opensearch/search?query=affiliation:&quot;International</a> Water Management Institute&quot; AND initiative:&ldquo;Climate Resilience&rdquo; AND subject:drought</li>
<li><a href="https://cgspace.cgiar.org/server/opensearch/search?query=affiliation:%22International">https://cgspace.cgiar.org/server/opensearch/search?query=affiliation:&quot;International</a> Water Management Institute&quot; AND initiative:&ldquo;Climate Resilience&rdquo; AND subject:landslides</li>
</ul>
</li>
<li>
<p>Export list of withdrawn handle redirects:</p>
</li>
</ul>
<pre tabindex="0"><code>dspace=# \COPY (SELECT m.text_value AS handle_from, h.handle AS handle_to FROM metadatavalue m JOIN handle h on m.dspace_object_id = h.resource_id WHERE m.metadata_field_id=181 AND h.resource_type_id=2 AND h.resource_id IN (SELECT uuid FROM item WHERE in_archive AND NOT withdrawn)) to /tmp/handle-redirects.csv CSV HEADER;
COPY 400
</code></pre><ul>
<li>Export list of IFPRI CONTENTdm redirects:</li>
</ul>
<pre tabindex="0"><code>dspace-# \COPY (SELECT m.text_value, h.handle FROM metadatavalue m JOIN handle h on m.dspace_object_id = h.resource_id WHERE m.metadata_field_id=28 AND m.text_value LIKE &#39;%URL from IFPRI CONTENTdm%&#39; AND h.resource_type_id=2 AND m.dspace_object_id IN (SELECT uuid FROM item WHERE in_archive AND NOT withdrawn)) to /tmp/ifpri.csv CSV HEADER;
COPY 10794
</code></pre><ul>
<li>I filed <a href="https://github.com/DSpace/dspace-angular/issues/3258">an issue</a> on DSpace Angular for anonymous users to be able to export search results to CSV</li>
</ul>
<h2 id="2024-08-26">2024-08-26</h2>
<ul>
<li>Spent some time trying to rebase our DSpace Angular themes on top of the massive header/navbar rework from <a href="https://github.com/DSpace/dspace-angular/pull/2858">DSpace 7.6.2</a></li>
<li>Spent some time getting missing bibliographic metadata (issue dates, licenses, pages, volume, issue, publisher, etc) from Crossref for CGSpace</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/2024-12/">December, 2024</a></li>
<li><a href="/cgspace-notes/2024-11/">November, 2024</a></li>
<li><a href="/cgspace-notes/2024-10/">October, 2024</a></li>
<li><a href="/cgspace-notes/2024-09/">September, 2024</a></li>
<li><a href="/cgspace-notes/2024-08/">August, 2024</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>