cgspace-notes/docs/2022-08/index.html

577 lines
37 KiB
HTML
Raw Normal View History

2023-07-04 07:03:36 +02:00
<!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, 2022" />
<meta property="og:description" content="2022-08-01
Our request to add CC-BY-3.0-IGO to SPDX was approved a few weeks ago
" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://alanorth.github.io/cgspace-notes/2022-08/" />
<meta property="article:published_time" content="2022-08-01T10:22:36+03:00" />
<meta property="article:modified_time" content="2023-02-22T11:59:48+03:00" />
<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="August, 2022"/>
<meta name="twitter:description" content="2022-08-01
Our request to add CC-BY-3.0-IGO to SPDX was approved a few weeks ago
"/>
2024-03-25 16:53:18 +01:00
<meta name="generator" content="Hugo 0.124.1">
2023-07-04 07:03:36 +02:00
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BlogPosting",
"headline": "August, 2022",
"url": "https://alanorth.github.io/cgspace-notes/2022-08/",
"wordCount": "2704",
"datePublished": "2022-08-01T10:22:36+03:00",
"dateModified": "2023-02-22T11:59:48+03:00",
"author": {
"@type": "Person",
"name": "Alan Orth"
},
"keywords": "Notes"
}
</script>
<link rel="canonical" href="https://alanorth.github.io/cgspace-notes/2022-08/">
<title>August, 2022 | 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/2022-08/">August, 2022</a></h2>
<p class="blog-post-meta">
<time datetime="2022-08-01T10:22:36+03:00">Mon Aug 01, 2022</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="2022-08-01">2022-08-01</h2>
<ul>
<li>Our request to add <a href="https://github.com/spdx/license-list-XML/issues/1525">CC-BY-3.0-IGO to SPDX</a> was approved a few weeks ago</li>
</ul>
<h2 id="2022-08-02">2022-08-02</h2>
<ul>
<li>Resume working on the MARLO Innovations
<ul>
<li>Last week Jose had sent me an updated CSV with UTF-8 formatting, which was missing the filename column</li>
<li>I joined it with the older file (stripped down to just the <code>cg.number</code> and <code>filename</code> columns and then did the same cleanups I had done last week</li>
<li>I noticed there are six PDFs unused, so I asked Jose</li>
</ul>
</li>
<li>Spent some time trying to understand the REST API submission issues that Rafael from CIAT is having with tip-approve and tip-submit
<ul>
<li>First, according to my notes in 2020-10, a user must be a <em>collection admin</em> in order to submit via the REST API</li>
<li>Second, a collection must have a &ldquo;Accept/Reject/Edit Metadata&rdquo; step defined in the workflow</li>
<li>Also, I referenced my notes from this gist I had made for exactly this purpose! <a href="https://gist.github.com/alanorth/40fc3092aefd78f978cca00e8abeeb7a">https://gist.github.com/alanorth/40fc3092aefd78f978cca00e8abeeb7a</a></li>
</ul>
</li>
</ul>
<h2 id="2022-08-03">2022-08-03</h2>
<ul>
<li>I came up with an interesting idea to add missing countries and AGROVOC terms to the MARLO Innovation metadata
<ul>
<li>I copied the abstract column to two new fields: <code>countrytest</code> and <code>agrovoctest</code> and then used this Jython code as a transform to drop terms that don&rsquo;t match (using CGSpace&rsquo;s country list and list of 1,400 AGROVOC terms):</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-python" data-lang="python"><span style="display:flex;"><span><span style="color:#66d9ef">with</span> open(<span style="color:#e6db74">r</span><span style="color:#e6db74">&#34;/tmp/cgspace-countries.txt&#34;</span>,<span style="color:#e6db74">&#39;r&#39;</span>) <span style="color:#66d9ef">as</span> f :
</span></span><span style="display:flex;"><span> countries <span style="color:#f92672">=</span> [name<span style="color:#f92672">.</span>rstrip()<span style="color:#f92672">.</span>lower() <span style="color:#66d9ef">for</span> name <span style="color:#f92672">in</span> f]
</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([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">&#39; &#39;</span>) <span style="color:#66d9ef">if</span> x<span style="color:#f92672">.</span>lower() <span style="color:#f92672">in</span> countries])
</span></span></code></pre></div><ul>
<li>Then I joined them with the other country and AGROVOC columns
<ul>
<li>I had originally tried to use csv-metadata-quality to look up and drop invalid AGROVOC terms but it was timing out ever dozen or so requests</li>
<li>Then I briefly tried to use lightrdf to export a text file of labels from AGROVOC&rsquo;s RDF, but I couldn&rsquo;t figure it out</li>
<li>I just realized this will not match countries with spaces in our cell value, ugh&hellip; and Jython has weird syntax and errors and I can&rsquo;t get normal Python code to work here, I&rsquo;m missing something</li>
</ul>
</li>
<li>Then I extracted the titles, dates, and types and added IDs, then ran them through <code>check-duplicates.py</code> to find the existing items on CGSpace so I can add them as <code>dcterm.relation</code> links</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 -l -c dc.title,dcterms.issued,dcterms.type ~/Downloads/2022-08-03-Innovations-Cleaned.csv | sed <span style="color:#e6db74">&#39;1s/line_number/id/&#39;</span> &gt; /tmp/innovations-temp.csv
</span></span><span style="display:flex;"><span>$ ./ilri/check-duplicates.py -i /tmp/innovations-temp.csv -u dspacetest -db dspacetest -p <span style="color:#e6db74">&#39;dom@in34sniper&#39;</span> -o /tmp/ccafs-duplicates.csv
</span></span></code></pre></div><ul>
<li>There were about 115 with existing items on CGSpace</li>
<li>Then I did some minor processing and checking of the duplicates file (for example, some titles appear more than once in both files), and joined with the other file (left join):</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>$ csvjoin --left -c dc.title ~/Downloads/2022-08-03-Innovations-Cleaned.csv ~/Downloads/2022-08-03-Innovations-relations.csv &gt; /tmp/innovations-with-relations.csv
</span></span></code></pre></div><ul>
<li>Then I used SAFBuilder to create a SimpleItemArchive and import to DSpace Test:</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>$ export JAVA_OPTS<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;-Dfile.encoding=UTF-8 -Xmx2048m&#34;</span>
</span></span><span style="display:flex;"><span>$ dspace import --add --eperson<span style="color:#f92672">=</span>fuuu@fuuu.com --source /tmp/SimpleArchiveFormat --mapfile<span style="color:#f92672">=</span>./2022-08-03-innovations.map
</span></span></code></pre></div><ul>
<li>Meeting with Mohammed Salem about harmonizing MEL and CGSpace metadata fields
<ul>
<li>I still need to share our results and recommendations with Peter, Enrico, Sara, Svetlana, et al</li>
</ul>
</li>
<li>I made some minor fixes to csv-metadata-quality while working on the MARLO CRP Innovations</li>
</ul>
<h2 id="2022-08-05">2022-08-05</h2>
<ul>
<li>I discussed issues with the DSpace 7 submission forms on Slack and Mark Wood found that the migration tool creates a non-working submission form
<ul>
<li>After updating the class name of the collection step and removing the &ldquo;complete&rdquo; and &ldquo;sample&rdquo; steps the submission form was working</li>
<li>Now the issue is that the controlled vocabularies show up like this:</li>
</ul>
</li>
</ul>
<p><img src="/cgspace-notes/2022/08/dspace7-submission.png" alt="Controlled vocabulary bug in DSpace 7"></p>
<ul>
<li>I think we need to add IDs, I will have to check what the implications of that are
<ul>
<li>Note (2022-09-27): see this related change from DSpace 7.3: <a href="https://github.com/DSpace/DSpace/pull/8174">https://github.com/DSpace/DSpace/pull/8174</a></li>
</ul>
</li>
<li>Emilio contacted me last week to say they have re-worked their harvester on Hetzner to use a new user agent: <code>AICCRA website harvester</code>
<ul>
<li>I verified that I see it in the REST API logs, but I don&rsquo;t see any new stats hits for it</li>
<li>I do see 11,000 hits from that IP last month when I had the incorrect nginx configuration that was sending a literal <code>$http_user_agent</code> so I purged those</li>
<li>It is lucky that we have <code>harvest</code> in the DSpace spider agent example file so Solr doesn&rsquo;t log these hits, nothing needed to be done in nginx</li>
</ul>
</li>
</ul>
<h2 id="2022-08-13">2022-08-13</h2>
<ul>
<li>I noticed there was high load on CGSpace, around 9 or 10
<ul>
<li>Looking at the Munin graphs it seems to just be the last two hours or so, with a slight increase in PostgreSQL connections, firewall traffic, and a more noticeable increase in CPU</li>
<li>DSpace sessions are normal</li>
<li>The number of unique hosts making requests to nginx is pretty low, though it&rsquo;s only 6AM in the server&rsquo;s time</li>
</ul>
</li>
<li>I see one IP in Sweden making a lot of requests with a normal user agent: 80.248.237.167
<ul>
<li>This host is on Internet Vikings (INTERNETBOLAGET), and I see 140,000 requests from them in Solr</li>
<li>I see reports of excessive scraping on AbuseIPDB.com</li>
<li>I&rsquo;m gonna add their 80.248.224.0/20 to the bot-networks.conf in nginx</li>
<li>I will also purge all the hits from this IP in Solr statistics</li>
</ul>
</li>
<li>I also see the core.ac.uk bot making tens of thousands of requests today, but we are already tagging that as a bot in Tomcat&rsquo;s Crawler Session Manager valve, so they should be sharing a Tomcat session with other bots and not creating too many sessions</li>
</ul>
<h2 id="2022-08-15">2022-08-15</h2>
<ul>
<li>Start indexing on AReS</li>
<li>Add CONSERVATION to ILRI subjects on CGSpace
<ul>
<li>I see that AGROVOC has <code>conservation agriculture</code> and I suggested that we use that instead</li>
</ul>
</li>
</ul>
<h2 id="2022-08-17">2022-08-17</h2>
<ul>
<li>Peter and Jose sent more feedback about the CRP Innovation records from MARLO
<ul>
<li>We expanded the CRP names in the citation and removed the <code>cg.identifier.url</code> URLs because they are ugly and will stop working eventually</li>
<li>The mappings of MARLO links will be done internally with the <code>cg.number</code> IDs like &ldquo;IN-1119&rdquo; and the Handle URIs</li>
</ul>
</li>
</ul>
<h2 id="2022-08-18">2022-08-18</h2>
<ul>
<li>I talked to Jose about the CCAFS MARLO records
<ul>
<li>He still hasn&rsquo;t finished re-processing the PDFs to update the internal MARLO links</li>
<li>I started looking at the other records (MELIAs, OICRs, Policies) and found some minor issues in the MELIAs so I sent feedback to Jose</li>
<li>On second thought, I opened the MELIAs file in OpenRefine and it looks OK, so this must have been a parsing issue in LibreOffice when I was checking the file (or perhaps I didn&rsquo;t use the correct quoting when importing)</li>
</ul>
</li>
<li>Import the original MELIA v2 CSV file into OpenRefine to fix encoding before processing with csvcut/csvjoin
<ul>
<li>Then extract the IDs and filenames from the original V2 file and join with the UTF-8 file:</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>$ csvcut -c <span style="color:#e6db74">&#39;cg.number (series/report No.)&#39;</span>,File ~/Downloads/MELIA-Metadata-v2-csv.csv &gt; MELIA-v2-IDs-Files.csv
</span></span><span style="display:flex;"><span>$ csvjoin -c <span style="color:#e6db74">&#39;cg.number (series/report No.)&#39;</span> MELIAs<span style="color:#ae81ff">\ </span>metadata<span style="color:#ae81ff">\ </span>utf8<span style="color:#ae81ff">\ </span>20220816_JM.csv MELIA-v2-IDs-Files.csv &gt; MELIAs-UTF-8-with-files.csv
</span></span></code></pre></div><ul>
<li>Then I imported them into OpenRefine to start metadata cleaning and enrichment</li>
<li>Make some minor changes to <a href="https://github.com/ilri/cgspace-submission-guidelines">cgspace-submission-guidelines</a>
<ul>
<li>Upgrade to Bootstrap v5.2.0</li>
<li>Dedupe value pairs and controlled vocabularies before writing them</li>
<li>Sort the controlled vocabularies before writing them (we don&rsquo;t do this for value pairs because some are added in specific order, like CRPs)</li>
</ul>
</li>
</ul>
<h2 id="2022-08-19">2022-08-19</h2>
<ul>
<li>Peter Ballantyne sent me metadata for 311 Gender items that need to be duplicate checked on CGSpace before uploading
<ul>
<li>I spent a half an hour in OpenRefine to fix the dates because they only had YYYY, but most abstracts and titles had more specific information about the date</li>
<li>Then I checked for duplicates:</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>$ ./ilri/check-duplicates.py -i ~/Downloads/gender-ppts-xlsx.csv -u dspace -db dspace -p <span style="color:#e6db74">&#39;fuuu&#39;</span> -o /tmp/gender-duplicates.csv
</span></span></code></pre></div><ul>
<li>I sent the list of ~130 possible duplicates to Peter to check</li>
<li>Jose sent new versions of the MARLO Innovation/MELIA/OICR/Policy PDFs
<ul>
<li>The idea was to replace tinyurl links pointing to MARLO, but I still see many tinyurl links, some of which point to CGIAR Sharepoint and require a login</li>
<li>I asked them why they don&rsquo;t just use the original links in the first place in case tinyurl.com disappears</li>
</ul>
</li>
<li>I continued working on the MARLO MELIA v2 UTF-8 metadata
<ul>
<li>I did the same metadata enrichment exercise to extract countries and AGROVOC subjects from the abstract field that I did earlier this month, using a Jython expression to match terms in copies of the abstract field</li>
<li>It helps to replace some characters with spaces first with this GREL: <code>value.replace(/[.\/;(),]/, &quot; &quot;)</code></li>
<li>This caught some extra AGROVOC terms, but unfortunately we only check for single-word terms</li>
<li>Then I checked for existing items on CGSpace matching these MELIA using my duplicate checker:</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>$ ./ilri/check-duplicates.py -i ~/Downloads/2022-08-18-MELIAs-UTF-8-With-Files.csv -u dspace -db dspace -p <span style="color:#e6db74">&#39;fuuu&#39;</span> -o /tmp/melia-matches.csv
</span></span></code></pre></div><ul>
<li>Then I did some minor processing and checking of the duplicates file (for example, some titles appear more than once in both files), and joined with the other file (left join):</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>$ xsv join --left id ~/Downloads/2022-08-18-MELIAs-UTF-8-With-Files.csv id ~/Downloads/melia-matches-csv.csv &gt; /tmp/melias-with-relations.csv
</span></span></code></pre></div><ul>
<li>I had to use <code>xsv</code> because <code>csvcut</code> was throwing an error detecting the dialect of the input CSVs (?)</li>
<li>I created a SAF bundle and imported the 749 MELIAs to DSpace Test</li>
<li>I found thirteen items on CGSpace with dates in format &ldquo;DD/MM/YYYY&rdquo; so I fixed those</li>
</ul>
<h2 id="2022-08-20">2022-08-20</h2>
<ul>
<li>Peter sent me back the results of the duplicate checking on the Gender presentations
<ul>
<li>There were only a handful of duplicates, so I used the IDs in the spreadsheet to flag and delete them in OpenRefine</li>
</ul>
</li>
<li>I had a new idea about matching AGROVOC subjects and countries in OpenRefine
<ul>
<li>I was previously splitting up the text value field (title/abstract/etc) by spaces and searching for each word in the list of terms/countries like this:</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>with open(r&#34;/tmp/cgspace-countries.txt&#34;,&#39;r&#39;) as f:
</span></span><span style="display:flex;"><span> countries = [name.rstrip().lower() for name in f]
</span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span>return &#34;||&#34;.join([x for x in value.split(&#39; &#39;) if x.lower() in countries])
</span></span></code></pre></div><ul>
<li>But that misses multi-word terms/countries with spaces, so we can search the other way around by using a regex for each term/country and checking if it appears in the text value field:</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>import re
</span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span>with open(r&#34;/tmp/agrovoc-subjects.txt&#34;,&#39;r&#39;) as f:
</span></span><span style="display:flex;"><span> terms = [name.rstrip().lower() for name in f]
</span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span>return &#34;||&#34;.join([term for term in terms if re.match(r&#34;.*\b&#34; + term + r&#34;\b.*&#34;, value.lower())])
</span></span></code></pre></div><ul>
<li>Now we are only limited by our small (~1,400) list of AGROVOC subjects, so I did an export from PostgreSQL of all <code>dcterms.subjects</code> values and am looking them up against AGROVOC&rsquo;s API right now:</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>localhost/dspacetest= ☘ \COPY (SELECT DISTINCT text_value AS &#34;dcterms.subject&#34;, count(*) FROM metadatavalue WHERE dspace_object_id in (SELECT dspace_object_id FROM item) AND metadata_field_id = 187 GROUP BY &#34;dcterms.subject&#34; ORDER BY count DESC) to /tmp/2022-08-20-agrovoc.csv WITH CSV HEADER;
</span></span><span style="display:flex;"><span>COPY 21685
</span></span><span style="display:flex;"><span>$ csvcut -c <span style="color:#ae81ff">1</span> /tmp/2022-08-20-agrovoc.csv | sed 1d &gt; /tmp/all-subjects.txt
</span></span><span style="display:flex;"><span>$ ./ilri/agrovoc-lookup.py -i /tmp/all-subjects.txt -o 2022-08-20-all-subjects-results.csv
</span></span><span style="display:flex;"><span>$ csvgrep -c <span style="color:#e6db74">&#39;number of matches&#39;</span> -m <span style="color:#ae81ff">0</span> -i /tmp/2022-08-20-all-subjects-results.csv.bak | csvcut -c <span style="color:#ae81ff">1</span> | sed 1d &gt; /tmp/agrovoc-subjects.txt
</span></span><span style="display:flex;"><span>$ wc -l /tmp/agrovoc-subjects.txt
</span></span><span style="display:flex;"><span>11834 /tmp/agrovoc-subjects.txt
</span></span></code></pre></div><ul>
<li>Then I created a new column joining the title and abstract, and ran the Jython expression above against this new file with 11,000 AGROVOC terms
<ul>
<li>Then I joined that column with Peter&rsquo;s <code>dcterms.subject</code> column and then deduplicated it with this Jython:</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>res = []
</span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span>[res.append(x) for x in value.split(&#34;||&#34;) if x not in res]
</span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010">
</span></span></span><span style="display:flex;"><span><span style="color:#960050;background-color:#1e0010"></span>return &#34;||&#34;.join(res)
</span></span></code></pre></div><ul>
<li>This is way better, but you end up getting a bunch of countries, regions, and short words like &ldquo;gates&rdquo; matching in AGROVOC that are inappropriate (we typically don&rsquo;t tag these in AGROVOC) or incorrect (gates, as in windows or doors, not the funding agency)
<ul>
<li>I did a text facet in OpenRefine and removed a bunch of these by eye</li>
</ul>
</li>
<li>Then I finished adding the <code>dcterms.relation</code> and CRP metadata flagged by Peter on the Gender presentations
<ul>
<li>I&rsquo;m waiting for him to send me the PDFs and then I will upload them to DSpace Test</li>
</ul>
</li>
</ul>
<h2 id="2022-08-21">2022-08-21</h2>
<ul>
<li>Start indexing on AReS</li>
<li>The load on CGSpace was around 5.0 today, and now that I started the harvesting it&rsquo;s over 10 for an hour now, sigh&hellip;
<ul>
<li>I&rsquo;m going to try an experiment to block Googlebot, bingbot, and Yandex for a week to see if the load goes down</li>
</ul>
</li>
</ul>
<h2 id="2022-08-22">2022-08-22</h2>
<ul>
<li>I tried to re-generate the SAF bundle for the MARLO Innovations after improving the AGROVOC subjects and the v3 PDFs, but six are missing from the v3 zip that are present in the original zip:
<ul>
<li>ProjectInnovationSummary-WLE-P500-I78.pdf</li>
<li>ProjectInnovationSummary-WLE-P452-I699.pdf</li>
<li>ProjectInnovationSummary-WLE-P518-I696.pdf</li>
<li>ProjectInnovationSummary-WLE-P442-I740.pdf</li>
<li>ProjectInnovationSummary-WLE-P516-I647.pdf</li>
<li>ProjectInnovationSummary-WLE-P438-I585.pdf</li>
</ul>
</li>
<li>I downloaded them manually using the URLs in the original CSV</li>
<li>I also uploaded a new version of the MELIAs to DSpace Test</li>
</ul>
<h2 id="2022-08-23">2022-08-23</h2>
<ul>
<li>Checking the number of items on CGSpace so we can keep an eye on the 100,000 number:</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>dspace=# SELECT COUNT(uuid) FROM item WHERE in_archive=&#39;t&#39;;
</span></span><span style="display:flex;"><span> count
</span></span><span style="display:flex;"><span>-------
</span></span><span style="display:flex;"><span> 95716
</span></span><span style="display:flex;"><span>(1 row)
</span></span></code></pre></div><ul>
<li>If I check OAI I see more, but perhaps that counts mapped items multiple times</li>
<li>Peter said the 303 Gender PPTs were good to go, so I updated the collection mappings and IDs in OpenRefine and then uploaded them to 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>$ dspace import --add --eperson<span style="color:#f92672">=</span>fuu@fuu.com --source /tmp/SimpleArchiveFormat --mapfile<span style="color:#f92672">=</span>./2022-08-23-gender-ppts.map
</span></span></code></pre></div><ul>
<li>I created a <a href="https://github.com/ilri/OpenRXV/issues/133">GitHub issue for OpenRXV compatibility issues with DSpace 7</a></li>
</ul>
<h2 id="2022-08-24">2022-08-24</h2>
<ul>
<li>Start working on the MARLO OICRs
<ul>
<li>First I extracted the filenames and IDs from the v2 metadata file, then joined it with the UTF-8 version:</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>$ xsv <span style="color:#66d9ef">select</span> <span style="color:#e6db74">&#39;cg.number (series/report No.),File&#39;</span> OICRS<span style="color:#ae81ff">\ </span>Metadata<span style="color:#ae81ff">\ </span>v2.csv &gt; /tmp/OICR-files.csv
</span></span><span style="display:flex;"><span>$ xsv join --left <span style="color:#e6db74">&#39;cg.number (series/report No.)&#39;</span> OICRS<span style="color:#ae81ff">\ </span>metadata<span style="color:#ae81ff">\ </span>utf8<span style="color:#ae81ff">\ </span>20220816_JM.csv <span style="color:#e6db74">&#39;cg.number (series/report No.)&#39;</span> /tmp/OICR-files.csv &gt; OICRs-UTF-8-with-files.csv
</span></span></code></pre></div><ul>
<li>After that I imported it into OpenRefine for data cleaning
<ul>
<li>To enrich the metadata I combined the title and abstract into a new field and then checked my list of 11,000 AGROVOC terms against it</li>
<li>First, create a new column with this GREL:</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[&#34;dc.title&#34;].value + &#34; &#34; + cells[&#34;dcterms.abstract&#34;].value
</span></span></code></pre></div><ul>
<li>Then use this Jython:</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:#f92672">import</span> re
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">with</span> open(<span style="color:#e6db74">r</span><span style="color:#e6db74">&#34;/tmp/agrovoc-subjects.txt&#34;</span>,<span style="color:#e6db74">&#39;r&#39;</span>) <span style="color:#66d9ef">as</span> f :
</span></span><span style="display:flex;"><span> terms <span style="color:#f92672">=</span> [name<span style="color:#f92672">.</span>rstrip()<span style="color:#f92672">.</span>lower() <span style="color:#66d9ef">for</span> name <span style="color:#f92672">in</span> f]
</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([term <span style="color:#66d9ef">for</span> term <span style="color:#f92672">in</span> terms <span style="color:#66d9ef">if</span> re<span style="color:#f92672">.</span><span style="color:#66d9ef">match</span>(<span style="color:#e6db74">r</span><span style="color:#e6db74">&#34;.*\b&#34;</span> <span style="color:#f92672">+</span> term <span style="color:#f92672">+</span> <span style="color:#e6db74">r</span><span style="color:#e6db74">&#34;\b.*&#34;</span>, value<span style="color:#f92672">.</span>lower())])
</span></span></code></pre></div><ul>
<li>After that I de-duplicated the terms using this Jython:</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>res <span style="color:#f92672">=</span> []
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>[res<span style="color:#f92672">.</span>append(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> res]
</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(res)
</span></span></code></pre></div><ul>
<li>Then I split the multi-values on &ldquo;||&rdquo; and used a text facet to remove some countries and other nonsense terms that matched, like &ldquo;gates&rdquo; and &ldquo;al&rdquo; and &ldquo;s&rdquo;
<ul>
<li>Then I did the same for countries</li>
</ul>
</li>
<li>Then I exported the CSV and started searching for duplicates so that I can add them as relations:</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>$ ./ilri/check-duplicates.py -i ~/Downloads/2022-08-24-OICRs.csv -u dspace -db dspace -p <span style="color:#e6db74">&#39;omg&#39;</span> -o /tmp/oicrs-matches.csv
</span></span></code></pre></div><ul>
<li>Oh wow, I actually found one OICR already uploaded to CGSpace&hellip; I have to ask Jose about that</li>
</ul>
<h2 id="2022-08-25">2022-08-25</h2>
<ul>
<li>I started processing the MARLO Policies in OpenRefine, similar to the Innovations, MELIAs, and OICRs above
<ul>
<li>I also re-ran the AGROVOC matching on Innovations because my technique has improved since I ran it a few weeks ago</li>
</ul>
</li>
</ul>
<h2 id="2022-08-29">2022-08-29</h2>
<ul>
<li>Start a harvest on AReS</li>
<li>Meeting with Peter and Abenet about CGSpace issues</li>
<li>I mapped the one MARLO OICR duplicate from the CCAFS Reports collection and deleted it from the OICRs CSV</li>
</ul>
<h2 id="2022-08-30">2022-08-30</h2>
<ul>
<li>Manuel from the &ldquo;Alianza SIDALC&rdquo; in South America contacted me asking for permission to harvest CGSpace and include our content in their system
<ul>
<li>I responded that we would be glad if they harvested us, and that they should use a useful user agent so we can contact them incase of any issues or changes on the server</li>
</ul>
</li>
<li>I emailed ILRI ICT to ask how Abenet and I can use the CGSpace Support email address in our email applications because we haven&rsquo;t checked that account in years
<ul>
<li>I tried to log in on office365.com but it gave an error</li>
<li>I got access to the account and cleaned up the inbox, unsubscribed from a bunch of Microsoft and Yammer feeds, etc</li>
</ul>
</li>
<li>Remind Dani, Tariku, and Andrea about the legacy links that we want to update on ILRI&rsquo;s website:
<ul>
<li><a href="http://mahider.ilri.org">http://mahider.ilri.org</a><a href="https://cgspace.cgiar.org">https://cgspace.cgiar.org</a></li>
<li><a href="http://mahider.ilri.org/handle/10568/xxxxx">http://mahider.ilri.org/handle/10568/xxxxx</a><a href="https://hdl.handle.net/10568/xxxxx">https://hdl.handle.net/10568/xxxxx</a></li>
<li><a href="http://www.ilri.org/ilrinews/index.php/archives/xxxx">http://www.ilri.org/ilrinews/index.php/archives/xxxx</a><a href="https://newsarchive.ilri.org/archives/xxxx">https://newsarchive.ilri.org/archives/xxxx</a></li>
</ul>
</li>
<li>Join the MARLO OICRs with their relations that I processed a few days ago (minus the second id column and some others):</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>$ xsv join --left id ~/Downloads/2022-08-24-OICRs.csv id ~/Downloads/oicrs-matches-csv.csv | xsv <span style="color:#66d9ef">select</span> <span style="color:#e6db74">&#39;!id[1],Your Title,Their Title,Similarity,Your Date,Their Date,datediff&#39;</span> &gt; /tmp/oicrs-with-relations.csv
</span></span></code></pre></div><ul>
<li>Then I cleaned them with csv-metadata-quality to catch some duplicates, add regions, etc and re-imported to OpenRefine
<ul>
<li>I flagged a few duplicates for Jose and he&rsquo;ll let me know what to do with them</li>
</ul>
</li>
<li>I imported the OICRs to DSpace Test:</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>$ export JAVA_OPTS<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;-Dfile.encoding=UTF-8 -Xmx2048m&#34;</span>
</span></span><span style="display:flex;"><span>$ dspace import --add --eperson<span style="color:#f92672">=</span>fuuuu@fuuu.com --source /tmp/SimpleArchiveFormat-oicrs --mapfile<span style="color:#f92672">=</span>./2022-08-30-OICRs.map
</span></span></code></pre></div><ul>
<li>Meeting with Marie-Angelique, Abenet, Valentina, Sara, and Margarita about Types</li>
<li>I am testing the <code>org.apache.cocoon.uploads.autosave=false</code> setting for XMLUI so that files posted via multi-part forms get memory mapped instead of written to disk</li>
<li>Check the MARLO Policies for relations and join them with the main CSV 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>$ ./ilri/check-duplicates.py -i ~/Downloads/2022-08-25-Policies-UTF-8-With-Files.csv -u dspace -db dspace -p <span style="color:#e6db74">&#39;fuui&#39;</span> -o /tmp/policies-matches.csv
</span></span><span style="display:flex;"><span>$ xsv join --left id ~/Downloads/2022-08-25-Policies-UTF-8-With-Files.csv id /tmp/policies-matches.csv | xsv <span style="color:#66d9ef">select</span> <span style="color:#e6db74">&#39;!id[1],Your Title,Their Title,Similarity,Your Date,Their Date&#39;</span> &gt; /tmp/policies-with-relations.csv
</span></span></code></pre></div><!-- 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">
2024-04-04 09:23:49 +02:00
<li><a href="/cgspace-notes/2024-04/">April, 2024</a></li>
2024-03-04 08:02:14 +01:00
<li><a href="/cgspace-notes/2024-03/">March, 2024</a></li>
<li><a href="/cgspace-notes/2024-02/">February, 2024</a></li>
2024-02-06 09:45:02 +01:00
2024-01-05 13:45:46 +01:00
<li><a href="/cgspace-notes/2024-01/">January, 2024</a></li>
2023-12-02 08:38:09 +01:00
<li><a href="/cgspace-notes/2023-12/">December, 2023</a></li>
2023-07-04 07:03:36 +02:00
</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>