diff --git a/content/posts/2022-05.md b/content/posts/2022-05.md index 590525286..9e486cac1 100644 --- a/content/posts/2022-05.md +++ b/content/posts/2022-05.md @@ -43,4 +43,41 @@ categories: ["Notes"] - Run all system updates on AReS server, update all Docker containers, and restart the server - Start a harvest on AReS +## 2022-05-05 + +- Update PostgreSQL JDBC driver to 42.3.5 in the Ansible infrastructure playbooks and deploy on DSpace Test +- Peter asked me how many items we add to CGSpace every year + - I wrote a SQL query to check the number of items grouped by their accession dates since 2009: + +```console +localhost/dspacetest= ☘ SELECT EXTRACT(year from text_value::date) AS YYYY, COUNT(*) FROM metadatavalue WHERE metadata_field_id=11 GROUP BY YYYY ORDER BY YYYY DESC LIMIT 14; + yyyy │ count +──────┼─────── + 2022 │ 2073 + 2021 │ 6471 + 2020 │ 4074 + 2019 │ 7330 + 2018 │ 8899 + 2017 │ 6860 + 2016 │ 8451 + 2015 │ 15692 + 2014 │ 16479 + 2013 │ 4388 + 2012 │ 6472 + 2011 │ 2694 + 2010 │ 2457 + 2009 │ 293 +``` + +- Note that I had an issue with casting `text_value` to date because one item had an accession date of `2016` instead of `2016-09-29T20:14:47Z` + - Once I fixed that PostgreSQL was able to [extract() the year](https://www.postgresql.org/docs/12/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT) + - There were some other methods I tried that worked also, for example `TO_DATE()`: + +```console +localhost/dspacetest= ☘ SELECT EXTRACT(year from TO_DATE(text_value, 'YYYY-MM-DD"T"HH24:MI:SS"Z"')) AS YYYY, COUNT(*) FROM metadatavalue WHERE metadata_field_id=11 GROUP BY YYYY ORDER BY YYYY DESC LIMIT 14; +``` + +- But it seems PostgreSQL is smart enough to recognize date formatting in strings automatically when we cast so we don't need to convert to date first +- Another thing I noticed is that a few hundred items have accession dates from decades ago, perhaps this is due to importing items from the CGIAR Library? + diff --git a/docs/2022-05/index.html b/docs/2022-05/index.html index f326f37a6..542d18a40 100644 --- a/docs/2022-05/index.html +++ b/docs/2022-05/index.html @@ -35,7 +35,7 @@ I purged 93,974 hits from these IPs using my check-spider-ip-hits.sh script - + @@ -76,9 +76,9 @@ I purged 93,974 hits from these IPs using my check-spider-ip-hits.sh script "@type": "BlogPosting", "headline": "May, 2022", "url": "https://alanorth.github.io/cgspace-notes/2022-05/", - "wordCount": "300", + "wordCount": "538", "datePublished": "2022-05-04T09:13:39+03:00", - "dateModified": "2022-05-04T11:09:45+03:00", + "dateModified": "2022-05-04T16:48:24+03:00", "author": { "@type": "Person", "name": "Alan Orth" @@ -204,6 +204,45 @@ I purged 93,974 hits from these IPs using my check-spider-ip-hits.sh script +

2022-05-05

+ +
localhost/dspacetest= ☘ SELECT EXTRACT(year from text_value::date) AS YYYY, COUNT(*) FROM metadatavalue WHERE metadata_field_id=11 GROUP BY YYYY ORDER BY YYYY DESC LIMIT 14;
+ yyyy │ count 
+──────┼───────
+ 2022 │  2073
+ 2021 │  6471
+ 2020 │  4074
+ 2019 │  7330
+ 2018 │  8899
+ 2017 │  6860
+ 2016 │  8451
+ 2015 │ 15692
+ 2014 │ 16479
+ 2013 │  4388
+ 2012 │  6472
+ 2011 │  2694
+ 2010 │  2457
+ 2009 │   293
+
+
localhost/dspacetest= ☘ SELECT EXTRACT(year from TO_DATE(text_value, 'YYYY-MM-DD"T"HH24:MI:SS"Z"')) AS YYYY, COUNT(*) FROM metadatavalue WHERE metadata_field_id=11 GROUP BY YYYY ORDER BY YYYY DESC LIMIT 14;
+
diff --git a/docs/categories/index.html b/docs/categories/index.html index f78d59c09..b4db900ca 100644 --- a/docs/categories/index.html +++ b/docs/categories/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/categories/notes/index.html b/docs/categories/notes/index.html index f71e8da8a..954273a28 100644 --- a/docs/categories/notes/index.html +++ b/docs/categories/notes/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/categories/notes/page/2/index.html b/docs/categories/notes/page/2/index.html index e4b765782..6421f960f 100644 --- a/docs/categories/notes/page/2/index.html +++ b/docs/categories/notes/page/2/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/categories/notes/page/3/index.html b/docs/categories/notes/page/3/index.html index b398cd7c8..56e0873b0 100644 --- a/docs/categories/notes/page/3/index.html +++ b/docs/categories/notes/page/3/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/categories/notes/page/4/index.html b/docs/categories/notes/page/4/index.html index 5529ff9c0..2cd99156e 100644 --- a/docs/categories/notes/page/4/index.html +++ b/docs/categories/notes/page/4/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/categories/notes/page/5/index.html b/docs/categories/notes/page/5/index.html index 39fc3460a..7e4443c02 100644 --- a/docs/categories/notes/page/5/index.html +++ b/docs/categories/notes/page/5/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/categories/notes/page/6/index.html b/docs/categories/notes/page/6/index.html index 25479bed7..df64aaa82 100644 --- a/docs/categories/notes/page/6/index.html +++ b/docs/categories/notes/page/6/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/index.html b/docs/index.html index 41f1ae272..b09690abc 100644 --- a/docs/index.html +++ b/docs/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/page/2/index.html b/docs/page/2/index.html index 8a9dd9d3b..65b74a02d 100644 --- a/docs/page/2/index.html +++ b/docs/page/2/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/page/3/index.html b/docs/page/3/index.html index 9e9bdd273..8ff8a7b86 100644 --- a/docs/page/3/index.html +++ b/docs/page/3/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/page/4/index.html b/docs/page/4/index.html index ebcb2a18d..176b6cf92 100644 --- a/docs/page/4/index.html +++ b/docs/page/4/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/page/5/index.html b/docs/page/5/index.html index 9321fe183..cc7361f7c 100644 --- a/docs/page/5/index.html +++ b/docs/page/5/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/page/6/index.html b/docs/page/6/index.html index 0349d176e..3cd562ac8 100644 --- a/docs/page/6/index.html +++ b/docs/page/6/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/page/7/index.html b/docs/page/7/index.html index 1144d98b2..5c7986ced 100644 --- a/docs/page/7/index.html +++ b/docs/page/7/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/page/8/index.html b/docs/page/8/index.html index bd8b3f8a0..c7cbecd94 100644 --- a/docs/page/8/index.html +++ b/docs/page/8/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/page/9/index.html b/docs/page/9/index.html index 2b475ff23..6bfdb2f55 100644 --- a/docs/page/9/index.html +++ b/docs/page/9/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/posts/index.html b/docs/posts/index.html index ce9c9b002..bcf465605 100644 --- a/docs/posts/index.html +++ b/docs/posts/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/posts/page/2/index.html b/docs/posts/page/2/index.html index 76cd8024e..40dce87d8 100644 --- a/docs/posts/page/2/index.html +++ b/docs/posts/page/2/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/posts/page/3/index.html b/docs/posts/page/3/index.html index 067f58b7b..bd550e8c4 100644 --- a/docs/posts/page/3/index.html +++ b/docs/posts/page/3/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/posts/page/4/index.html b/docs/posts/page/4/index.html index f543d089e..d2dca43d1 100644 --- a/docs/posts/page/4/index.html +++ b/docs/posts/page/4/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/posts/page/5/index.html b/docs/posts/page/5/index.html index 1a3fcf375..5aafb4955 100644 --- a/docs/posts/page/5/index.html +++ b/docs/posts/page/5/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/posts/page/6/index.html b/docs/posts/page/6/index.html index 05ac5b5c0..a40750a2f 100644 --- a/docs/posts/page/6/index.html +++ b/docs/posts/page/6/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/posts/page/7/index.html b/docs/posts/page/7/index.html index 28caedfcc..540e9258a 100644 --- a/docs/posts/page/7/index.html +++ b/docs/posts/page/7/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/posts/page/8/index.html b/docs/posts/page/8/index.html index 893d3ca1d..712aa7230 100644 --- a/docs/posts/page/8/index.html +++ b/docs/posts/page/8/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/posts/page/9/index.html b/docs/posts/page/9/index.html index d53068d2e..ecd84b0b7 100644 --- a/docs/posts/page/9/index.html +++ b/docs/posts/page/9/index.html @@ -10,7 +10,7 @@ - + diff --git a/docs/sitemap.xml b/docs/sitemap.xml index d0a16d057..57a84c1f6 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -3,19 +3,19 @@ xmlns:xhtml="http://www.w3.org/1999/xhtml"> https://alanorth.github.io/cgspace-notes/categories/ - 2022-05-04T11:09:45+03:00 + 2022-05-04T16:48:24+03:00 https://alanorth.github.io/cgspace-notes/ - 2022-05-04T11:09:45+03:00 + 2022-05-04T16:48:24+03:00 https://alanorth.github.io/cgspace-notes/2022-05/ - 2022-05-04T11:09:45+03:00 + 2022-05-04T16:48:24+03:00 https://alanorth.github.io/cgspace-notes/categories/notes/ - 2022-05-04T11:09:45+03:00 + 2022-05-04T16:48:24+03:00 https://alanorth.github.io/cgspace-notes/posts/ - 2022-05-04T11:09:45+03:00 + 2022-05-04T16:48:24+03:00 https://alanorth.github.io/cgspace-notes/2022-04/ 2022-05-04T11:09:45+03:00