Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next #207

Merged
merged 2 commits into from
Aug 7, 2024
Merged

Next #207

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/melinda-node-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ jobs:
njsscan:
name: Njsscan check
runs-on: ubuntu-latest

container: docker://node:18

steps:
- name: Checkout the code
uses: actions/checkout@v4
Expand Down
1,638 changes: 858 additions & 780 deletions package-lock.json

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,31 @@
"watch:test": "cross-env DEBUG=1 NODE_ENV=test nodemon -w src -w test-fixtures --exec 'npm run test:dev'"
},
"dependencies": {
"@natlibfi/marc-record": "^8.1.3",
"@natlibfi/marc-record": "^9.0.0",
"@natlibfi/marc-record-merge": "^7.0.3",
"@natlibfi/marc-record-validate": "^8.0.8",
"@natlibfi/marc-record-validators-melinda": "^11.2.1",
"@natlibfi/melinda-commons": "^13.0.13",
"debug": "^4.3.4",
"isbn3": "^1.1.48"
"@natlibfi/marc-record-validators-melinda": "^11.3.1",
"@natlibfi/melinda-commons": "^13.0.15",
"debug": "^4.3.6",
"isbn3": "^1.1.51"
},
"devDependencies": {
"@babel/cli": "^7.24.5",
"@babel/core": "^7.24.5",
"@babel/node": "^7.23.9",
"@babel/preset-env": "^7.24.5",
"@babel/register": "^7.23.7",
"@babel/cli": "^7.24.8",
"@babel/core": "^7.25.2",
"@babel/node": "^7.25.0",
"@babel/preset-env": "^7.25.3",
"@babel/register": "^7.24.6",
"@natlibfi/eslint-config-melinda-backend": "^3.0.5",
"@natlibfi/fixugen": "^2.0.6",
"@natlibfi/fixura": "^3.0.5",
"@natlibfi/fixugen": "^2.0.8",
"@natlibfi/fixura": "^3.0.7",
"babel-plugin-istanbul": "^6.1.1",
"babel-plugin-rewire": "^1.2.0",
"chai": "^4.4.1",
"chai": "^4.5.0",
"cross-env": "^7.0.3",
"eslint": "^8.57.0",
"mocha": "^10.4.0",
"nodemon": "^3.1.0",
"nyc": "^15.1.0"
"mocha": "^10.7.0",
"nodemon": "^3.1.4",
"nyc": "^17.0.0"
},
"eslintConfig": {
"extends": "@natlibfi/melinda-backend"
Expand Down
29 changes: 25 additions & 4 deletions src/reducers/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{
"operation": "removeField",
"recordType": "source",
"comment": "MRA-763: remove many fields from a source prepublication if base record is good enough",
"comment": "MRA-763: remove various fields from a source prepublication if base record is good enough (ENNAKKOTIETO)",
"fieldSpecification": {
"tagPattern": "^((?!CAT|LOW|SID|00[135678]|035|040|042|500|506|540|594|776|856|884|946|974).)*$",
"encodingLevel": ["8"]
Expand All @@ -32,7 +32,28 @@
{
"operation": "removeField",
"recordType": "source",
"comment": "MRA-763: remove many fields from a source prepublication if base record is good enough (Koneellisesti tuotettu tietue)",
"comment": "MET-571: remove 594 $a EI VASTAANOTETTU from a source prepublication if base record is good enough",
"fieldSpecification": {
"tagPattern": "^594$",
"encodingLevel": ["8"],
"subfieldFilters": [
{"code": "a", "value": "EI VASTAANOTETTU"},
{"code": "5", "value": "FENNI"}
]
},
"requireBaseField": {
"tag": "LOW",
"subfieldFilters": [
{"code": "a", "valuePattern": "^(?:FENNI|FIKKA)$"}
],
"encodingLevel": [" ", "1", "2", "3", "4", "5", "7"]
}
},

{
"operation": "removeField",
"recordType": "source",
"comment": "MRA-763: remove various fields from a source prepublication if base record is good enough (Koneellisesti tuotettu tietue)",
"fieldSpecification": {
"tagPattern": "^((?!CAT|LOW|SID|00[135678]|035|040|042|500|506|540|594|776|856|884|946|974).)*$",
"encodingLevel": ["2", "8"]
Expand Down Expand Up @@ -254,13 +275,13 @@

{
"operation": "removeField",
"comment": "Remove 041 so that a repeatable field won't be copied from source if base already has one",
"comment": "Remove source 041 so that a repeatable field won't be copied from source if base already has one",
"recordType": "source",
"fieldSpecification": {
"tag": "041"
},
"requireBaseField": {
"tagPattern": "^(041)$"
"tag": "041"
}
},

Expand Down
12 changes: 12 additions & 0 deletions test-fixtures/reducers/index/594_MET571_01/base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"leader": "01331cam a22003498i 4500",
"fields": [
{ "tag": "001", "value": "123456" },
{ "tag": "500", "ind1": " ", "ind2": " ", "subfields": [
{ "code": "a", "value": "Whatever." }
]},
{ "tag": "LOW", "ind1": " ", "ind2": " ", "subfields": [
{ "code": "a", "value": "FENNI" }
]}
]
}
16 changes: 16 additions & 0 deletions test-fixtures/reducers/index/594_MET571_01/merged.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"leader": "01331cam a22003498i 4500",
"fields": [
{ "tag": "001", "value": "123456" },
{ "tag": "500", "ind1": " ", "ind2": " ", "subfields": [
{ "code": "a", "value": "Whatever." }
]},
{ "tag": "594", "ind1": " ", "ind2": " ", "subfields": [
{ "code": "a", "value": "EI VASTAANOTETTU" },
{ "code": "5", "value": "FENNI" }
]},
{ "tag": "LOW", "ind1": " ", "ind2": " ", "subfields": [
{ "code": "a", "value": "FENNI" }
]}
]
}
4 changes: 4 additions & 0 deletions test-fixtures/reducers/index/594_MET571_01/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"description":"MET-571/01: move 594 $a EI VASTAANOTETTU as base LDR/17=8",
"only": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"leader": "01331cam a22003498i 4500",
"fields": [
{ "tag": "001", "value": "123456" }
]
}
10 changes: 10 additions & 0 deletions test-fixtures/reducers/index/594_MET571_01/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"leader": "01331cam a22003498i 4500",
"fields": [
{ "tag": "001", "value": "123456" },
{ "tag": "594", "ind1": " ", "ind2": " ", "subfields": [
{ "code": "a", "value": "EI VASTAANOTETTU" },
{ "code": "5", "value": "FENNI" }
]}
]
}
12 changes: 12 additions & 0 deletions test-fixtures/reducers/index/594_MET571_02/base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"leader": "01331cam a22003494i 4500",
"fields": [
{ "tag": "001", "value": "123456" },
{ "tag": "500", "ind1": " ", "ind2": " ", "subfields": [
{ "code": "a", "value": "Whatever." }
]},
{ "tag": "LOW", "ind1": " ", "ind2": " ", "subfields": [
{ "code": "a", "value": "FENNI" }
]}
]
}
12 changes: 12 additions & 0 deletions test-fixtures/reducers/index/594_MET571_02/merged.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"leader": "01331cam a22003494i 4500",
"fields": [
{ "tag": "001", "value": "123456" },
{ "tag": "500", "ind1": " ", "ind2": " ", "subfields": [
{ "code": "a", "value": "Whatever." }
]},
{ "tag": "LOW", "ind1": " ", "ind2": " ", "subfields": [
{ "code": "a", "value": "FENNI" }
]}
]
}
4 changes: 4 additions & 0 deletions test-fixtures/reducers/index/594_MET571_02/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"description":"MET-571/02: remove source 594 $a EI VASTAANOTETTU as base LDR/17!=8 and has FENNI LOW",
"only": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"leader": "01331cam a22003498i 4500",
"fields": [
{ "tag": "001", "value": "123456" }
]
}
10 changes: 10 additions & 0 deletions test-fixtures/reducers/index/594_MET571_02/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"leader": "01331cam a22003498i 4500",
"fields": [
{ "tag": "001", "value": "123456" },
{ "tag": "594", "ind1": " ", "ind2": " ", "subfields": [
{ "code": "a", "value": "EI VASTAANOTETTU" },
{ "code": "5", "value": "FENNI" }
]}
]
}
9 changes: 9 additions & 0 deletions test-fixtures/reducers/index/594_MET571_03/base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"leader": "01331cam a22003498i 4500",
"fields": [
{ "tag": "001", "value": "123456" },
{ "tag": "500", "ind1": " ", "ind2": " ", "subfields": [
{ "code": "a", "value": "Whatever." }
]}
]
}
13 changes: 13 additions & 0 deletions test-fixtures/reducers/index/594_MET571_03/merged.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"leader": "01331cam a22003498i 4500",
"fields": [
{ "tag": "001", "value": "123456" },
{ "tag": "500", "ind1": " ", "ind2": " ", "subfields": [
{ "code": "a", "value": "Whatever." }
]},
{ "tag": "594", "ind1": " ", "ind2": " ", "subfields": [
{ "code": "a", "value": "EI VASTAANOTETTU" },
{ "code": "5", "value": "FENNI" }
]}
]
}
4 changes: 4 additions & 0 deletions test-fixtures/reducers/index/594_MET571_03/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"description":"MET-571/03: don't remove source 594 $a EI VASTAANOTETTU as base LDR/17=8. Normal transfer is applied.",
"only": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"leader": "01331cam a22003498i 4500",
"fields": [
{ "tag": "001", "value": "123456" }
]
}
10 changes: 10 additions & 0 deletions test-fixtures/reducers/index/594_MET571_03/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"leader": "01331cam a22003498i 4500",
"fields": [
{ "tag": "001", "value": "123456" },
{ "tag": "594", "ind1": " ", "ind2": " ", "subfields": [
{ "code": "a", "value": "EI VASTAANOTETTU" },
{ "code": "5", "value": "FENNI" }
]}
]
}
9 changes: 9 additions & 0 deletions test-fixtures/reducers/index/594_MET571_04/base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"leader": "01331cam a22003494i 4500",
"fields": [
{ "tag": "001", "value": "123456" },
{ "tag": "500", "ind1": " ", "ind2": " ", "subfields": [
{ "code": "a", "value": "Whatever." }
]}
]
}
13 changes: 13 additions & 0 deletions test-fixtures/reducers/index/594_MET571_04/merged.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"leader": "01331cam a22003494i 4500",
"fields": [
{ "tag": "001", "value": "123456" },
{ "tag": "500", "ind1": " ", "ind2": " ", "subfields": [
{ "code": "a", "value": "Whatever." }
]},
{ "tag": "594", "ind1": " ", "ind2": " ", "subfields": [
{ "code": "a", "value": "EI VASTAANOTETTU" },
{ "code": "5", "value": "FENNI" }
]}
]
}
4 changes: 4 additions & 0 deletions test-fixtures/reducers/index/594_MET571_04/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"description":"MET-571/04: don't remove source 594 $a EI VASTAANOTETTU as base is non-FENNI (thus base LDR/17!=8 does not matter). Normal source->base transfer applies.",
"only": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"leader": "01331cam a22003498i 4500",
"fields": [
{ "tag": "001", "value": "123456" }
]
}
10 changes: 10 additions & 0 deletions test-fixtures/reducers/index/594_MET571_04/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"leader": "01331cam a22003498i 4500",
"fields": [
{ "tag": "001", "value": "123456" },
{ "tag": "594", "ind1": " ", "ind2": " ", "subfields": [
{ "code": "a", "value": "EI VASTAANOTETTU" },
{ "code": "5", "value": "FENNI" }
]}
]
}
Loading