From a05799a70ec848515f1c89b87b7a68c70b40afca Mon Sep 17 00:00:00 2001 From: Andrzej Stepien Date: Mon, 17 Jul 2023 19:33:35 +0200 Subject: [PATCH] backup on import automated --- src/data/samples/atheism.json | 34 ++++++++++++++++ src/data/samples/chocolate-1689614793.json | 46 ++++++++++++++++++++++ src/data/scripts/import.sh | 5 +++ src/data/scripts/pipeline-import.sh | 3 -- src/data/scripts/pipeline.sh | 4 ++ 5 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 src/data/samples/atheism.json create mode 100644 src/data/samples/chocolate-1689614793.json create mode 100755 src/data/scripts/import.sh delete mode 100755 src/data/scripts/pipeline-import.sh diff --git a/src/data/samples/atheism.json b/src/data/samples/atheism.json new file mode 100644 index 0000000..65a1439 --- /dev/null +++ b/src/data/samples/atheism.json @@ -0,0 +1,34 @@ +{ + "word": "atheism", + "pronunciation": "/ˈeɪθiɪzəm/", + "meanings": [ + { + "type": "noun", + "definition": "A lack of belief in deities, or a belief that there is insufficient evidence to believe in a god." + }, + { + "type": "noun", + "definition": "A non-belief in deities." + }, + { + "type": "noun", + "definition": "A rejection of all religions, even non-theistic ones." + }, + { + "type": "noun", + "definition": "Absence of belief in a particular deity, pantheon, or religious doctrine (notwithstanding belief in other deities)." + }, + { + "type": "noun", + "definition": "Absence of belief in the One True God, defined by Moore as personal, immaterial and trinitarian (thus Islam, Judaism and unitarian Christianity), as opposed to monotheism." + }, + { + "type": "noun", + "definition": "Absence of belief that any deities exist (including absence of the concept of deities)." + }, + { + "type": "noun", + "definition": "Belief that no deities exist (sometimes including rejection of other religious beliefs)." + } + ] +} diff --git a/src/data/samples/chocolate-1689614793.json b/src/data/samples/chocolate-1689614793.json new file mode 100644 index 0000000..a77a8d1 --- /dev/null +++ b/src/data/samples/chocolate-1689614793.json @@ -0,0 +1,46 @@ +{ + "word": "chocolate", + "pronunciation": "/ˈt͡ʃɒk(ə)lɪt/", + "meanings": [ + { + "type": "noun", + "definition": "A black person; (uncountable) blackness." + }, + { + "type": "noun", + "definition": "A dark, reddish-brown colour/color, like that of chocolate (also called chocolate brown)." + }, + { + "type": "noun", + "definition": "A drink made by dissolving this food in boiling milk or water." + }, + { + "type": "noun", + "definition": "A food made from ground roasted cocoa beans." + }, + { + "type": "noun", + "definition": "A single, small piece of confectionery made from chocolate." + }, + { + "type": "adj", + "definition": "Black (relating to any of various ethnic groups having dark pigmentation of the skin)." + }, + { + "type": "adj", + "definition": "Having a dark reddish-brown colour/color." + }, + { + "type": "adj", + "definition": "Made of or containing chocolate." + }, + { + "type": "verb", + "definition": "To add chocolate to; to cover (food) in chocolate." + }, + { + "type": "verb", + "definition": "To treat blood agar by heating in order to lyse the red blood cells in the medium." + } + ] +} diff --git a/src/data/scripts/import.sh b/src/data/scripts/import.sh new file mode 100755 index 0000000..00795f9 --- /dev/null +++ b/src/data/scripts/import.sh @@ -0,0 +1,5 @@ +#!/bin/bash +cd .. +timestamp=$(date +%s) +sqlite3 database ".backup db-backups/backup"$timestamp".db" +node importJSON.js \ No newline at end of file diff --git a/src/data/scripts/pipeline-import.sh b/src/data/scripts/pipeline-import.sh deleted file mode 100755 index 608000a..0000000 --- a/src/data/scripts/pipeline-import.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -pipeline.sh -node importJSON.cjs \ No newline at end of file diff --git a/src/data/scripts/pipeline.sh b/src/data/scripts/pipeline.sh index 5287212..d515aa6 100755 --- a/src/data/scripts/pipeline.sh +++ b/src/data/scripts/pipeline.sh @@ -11,3 +11,7 @@ wiktionary-processed-array.json > wiktionary-grouped-objects.json jq --slurp '.' wiktionary-grouped-objects.json > wiktionary-grouped-objects-array.json +#extract samples +timestamp=$(date +%s) + jq '. | select(.word=="chocolate")' wiktionary-grouped-objects.json > ../samples/chocolate-$timestamp.json +