Skip to content

Commit

Permalink
Pass file locations and Strapi host to authority data Flux scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
fsteeg committed Oct 6, 2023
1 parent 146a163 commit b69b879
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 28 deletions.
8 changes: 4 additions & 4 deletions conf/rpb-sw-import.flux
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//API_URL = "http://test-metadaten-nrw.hbz-nrw.de:1339/api/rpb-authorities";
API_URL = "http://localhost:1339/api/rpb-authorities";
default IN_FILE = "test-output-sw.json"; // pass e.g. IN_FILE=output-sw-strapi.ndjson
default HOST = "localhost"; // pass e.g. HOST=test-metadaten-nrw.hbz-nrw.de
API_URL = "http://" + HOST + ":1339/api/rpb-authorities";

// FLUX_DIR + "output/output-sw-strapi.ndjson"
FLUX_DIR + "output/test-output-sw.json"
FLUX_DIR + "output/" + IN_FILE
| open-file
| as-lines
| regex-decode("(?<data>.+)")
Expand Down
11 changes: 5 additions & 6 deletions conf/rpb-sw-to-strapi.flux
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// default outfile = "conf/output/output-sw-strapi.ndjson";
default outfile = "conf/output/test-output-sw.json";
default OUT_FILE = "test-output-sw.json"; // pass e.g. OUT_FILE=output-sw-strapi.ndjson
default IN_FILE = "RPB-Export_HBZ_SW_Test.txt"; // pass e.g. IN_FILE=RPB-Export_HBZ_SW.txt
// (wget http://lobid.org/download/rpb-gesamtexport/2023-06-01/RPB-Export_HBZ_SW.txt)

// wget http://lobid.org/download/rpb-gesamtexport/2023-06-01/RPB-Export_HBZ_SW.txt
// FLUX_DIR + "RPB-Export_HBZ_SW.txt"
FLUX_DIR + "RPB-Export_HBZ_SW_Test.txt"
FLUX_DIR + IN_FILE
| open-file(encoding="IBM437")
| as-lines
| rpb.Decode
| fix(FLUX_DIR + "rpb-sw-to-strapi.fix")
| encode-json(prettyPrinting="false", booleanMarker="~")
| write(outfile)
| write(FLUX_DIR + "output/" + OUT_FILE)
;
4 changes: 2 additions & 2 deletions conf/rpb-systematik-import.flux
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// API_URL = "http://test-metadaten-nrw.hbz-nrw.de:1339/api/" + PATH;
API_URL = "http://localhost:1339/api/" + PATH;
default HOST = "localhost"; // pass e.g. HOST=test-metadaten-nrw.hbz-nrw.de
API_URL = "http://" + HOST + ":1339/api/" + PATH;

"https://raw.githubusercontent.com/acka47/scripts/master/skos2json/" + INPUT
| open-http
Expand Down
8 changes: 4 additions & 4 deletions conf/rppd-import.flux
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//API_URL = "http://test-metadaten-nrw.hbz-nrw.de:1339/api/rppds";
API_URL = "http://localhost:1339/api/rppds";
default HOST = "localhost"; // pass e.g. HOST=test-metadaten-nrw.hbz-nrw.de
default IN_FILE = "test-output-rppd.json"; // pass e.g. IN_FILE=output-rppd-strapi.ndjson
API_URL = "http://" + HOST + ":1339/api/rppds";

// FLUX_DIR + "output/output-rppd-strapi.ndjson"
FLUX_DIR + "output/test-output-rppd.json"
FLUX_DIR + "output/" + IN_FILE
| open-file
| as-lines
| regex-decode("(?<data>.+)")
Expand Down
11 changes: 5 additions & 6 deletions conf/rppd-to-strapi.flux
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// default outfile = "conf/output/output-rppd-strapi.ndjson";
default outfile = "conf/output/test-output-rppd.json";
default OUT_FILE = "test-output-rppd.json"; // pass e.g. OUT_FILE=output-rppd-strapi.ndjson
default IN_FILE = "RPB-Export_HBZ_Bio_Test.txt"; // pass e.g. IN_FILE=RPB-Export_HBZ_Bio.txt
// (wget http://lobid.org/download/rpb-gesamtexport/2023-06-01/RPB-Export_HBZ_Bio.txt)

// wget http://lobid.org/download/rpb-gesamtexport/2023-06-01/RPB-Export_HBZ_Bio.txt
// FLUX_DIR + "RPB-Export_HBZ_Bio.txt"
FLUX_DIR + "RPB-Export_HBZ_Bio_Test.txt"
FLUX_DIR + IN_FILE
| open-file(encoding="IBM437")
| as-lines
| rpb.Decode
| fix(FLUX_DIR + "rppd-to-strapi.fix")
| encode-json(prettyPrinting="false", booleanMarker="~")
| write(outfile)
| write(FLUX_DIR + "output/" + OUT_FILE)
;
12 changes: 6 additions & 6 deletions transformAndImport.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ set -eu
IFS=$'\n\t'

# Notationen
sbt "runMain rpb.ETL conf/rpb-systematik-import.flux INPUT=rpb.ndjson PATH=rpb-notations"
sbt "runMain rpb.ETL conf/rpb-systematik-import.flux INPUT=rpb-spatial.ndjson PATH=rpb-spatials"
sbt "runMain rpb.ETL conf/rpb-systematik-import.flux INPUT=rpb.ndjson PATH=rpb-notations HOST=localhost"
sbt "runMain rpb.ETL conf/rpb-systematik-import.flux INPUT=rpb-spatial.ndjson PATH=rpb-spatials HOST=localhost"

# Personen
sbt "runMain rpb.ETL conf/rppd-to-strapi.flux"
sbt "runMain rpb.ETL conf/rppd-import.flux"
sbt "runMain rpb.ETL conf/rppd-to-strapi.flux IN_FILE=RPB-Export_HBZ_Bio_Test.txt OUT_FILE=test-output-rppd.json"
sbt "runMain rpb.ETL conf/rppd-import.flux IN_FILE=test-output-rppd.json HOST=localhost"

# Normdaten
sbt "runMain rpb.ETL conf/rpb-sw-to-strapi.flux"
sbt "runMain rpb.ETL conf/rpb-sw-import.flux"
sbt "runMain rpb.ETL conf/rpb-sw-to-strapi.flux IN_FILE=RPB-Export_HBZ_SW_Test.txt OUT_FILE=test-output-sw.json"
sbt "runMain rpb.ETL conf/rpb-sw-import.flux IN_FILE=test-output-sw.json HOST=localhost"

# Titeldaten
sbt "runMain rpb.ETL conf/rpb-test-titel-to-strapi.flux"
Expand Down

0 comments on commit b69b879

Please sign in to comment.