From c0b294c5f10bf8f6f21b294c2d0d7dd031d82990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Rosenstr=C3=B6m?= Date: Mon, 23 Oct 2023 15:04:13 +0200 Subject: [PATCH] Add script for fixing encodingLevels broken by previous changehistory bug --- .../10/lxl-4290-broken-encoding-level.groovy | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 whelktool/scripts/cleanups/2023/10/lxl-4290-broken-encoding-level.groovy diff --git a/whelktool/scripts/cleanups/2023/10/lxl-4290-broken-encoding-level.groovy b/whelktool/scripts/cleanups/2023/10/lxl-4290-broken-encoding-level.groovy new file mode 100644 index 0000000000..fda0a7479e --- /dev/null +++ b/whelktool/scripts/cleanups/2023/10/lxl-4290-broken-encoding-level.groovy @@ -0,0 +1,59 @@ + +// Taken from +// def where = """ +// data#>>'{@graph,0,encodingLevel}' like '%→%' +// """ + +Collection ids = [ + "hzvlk0p2f983jpk0", + "r680tg92p9g7fpm4", + "fwnxlb7vc4pv56tj", + "2f6vnqrp0bz8fnwc", + "dt10j33mb9wpl9wz", + "4ldczhpl2w3gphnq", + "wcz9751gtjnd8vd3", + "dvgxml1sb73nsx1t", + "wczjhxckt4mcm2bb", + "5ks0vkhc3wl2x99c", + "1h68pk6kzkflh2wx", + "8qb4mmk2606cqh0n", + "t82p5421r00hxgkf", + "6np3wlv0459519v4", + "1h5q7xbszd3bmmtw", + "9p5kf83r71xs6zrs", + "p2x3hc7tm7flwskj", + "7pf4t8cb5tck67k3", + "fvp77tkrc5qfgj92", + "1fqs7p2szmttr675", + "s6h99w7vqzjjj66q", + "m15j8437kvdp52xv", + "hwdg5rzhftvdddh6", + "2h3dsqfz0mzgxp3m", + "kvjvjc54hcb00drl", + "2hgnfhsg0z5g5s6p", + "q57xbt24nwn17k67", + "1g9lqbfsz70d7th5", + "bsbtlcm988b7xxt7", + "cm37v47r9qwrk563", + "3jnscqfb10fcnmzx", + "n0gppz5nl7399vkv", + "s820nfwqq08j1kg3" +] + +def replaceMap = [ + 'Biblioteksnivå → Nationalbibliografisk nivå' : 'marc:FullLevel', + 'Biblioteksnivå → Miniminivå' : 'marc:AbbreviatedLevel', + 'Förhandsinformation → Miniminivå' : 'marc:AbbreviatedLevel', + 'Förhandsinformation → Biblioteksnivå' : 'marc:MinimalLevel', + 'Preliminär → Biblioteksnivå' : 'marc:MinimalLevel', + 'Miniminivå → Biblioteksnivå' : 'marc:MinimalLevel', + 'Miniminivå → Preliminär' : 'marc:PartialPreliminaryLevel' +] +selectByIds(ids) { + def record = it.graph[0] + def encodingLevel = record['encodingLevel'] + if (replaceMap.keySet().contains(encodingLevel)) { + record['encodingLevel'] = replaceMap[encodingLevel] + it.scheduleSave() + } +} \ No newline at end of file