Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
irma2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gerhard Gonter
irma2
Commits
090fbf43
Commit
090fbf43
authored
2 years ago
by
Gerhard Gonter
Browse files
Options
Downloads
Patches
Plain Diff
more filtering and field transcribing
parent
1c2665fa
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/Univie/EoD/CrossReference.pm
+29
-10
29 additions, 10 deletions
lib/Univie/EoD/CrossReference.pm
with
29 additions
and
10 deletions
lib/Univie/EoD/CrossReference.pm
+
29
−
10
View file @
090fbf43
...
...
@@ -4,6 +4,7 @@ use strict;
use
Data::
Dumper
;
use
JSON
;
use
IRMA::
db
;
use
Util::
ts
;
...
...
@@ -100,15 +101,24 @@ sub find_books
{
my
$self
=
shift
;
my
$search
=
shift
;
print
__LINE__
,
"
search:
",
join
('
,
',
%$search
),
"
\n
";
# print __LINE__, " search: ", join(', ', %$search), "\n"; ... can contain {$in:[...]} clauses!
# print __LINE__, " search: ", Dumper ($search);
print
__LINE__
,
"
search:
",
JSON::
encode_json
(
$search
),
"
\n
";
my
$foxml_col
=
$self
->
get_db_col
('
inventory_database
',
'
foxml.data
');
my
$cur
=
$foxml_col
->
find
(
$search
);
# print __LINE__, ' cur: ', Dumper($cur);
while
(
my
$foxml_rec
=
$cur
->
next
())
FOXML_REC:
while
(
my
$foxml_rec
=
$cur
->
next
())
{
# print __LINE__, " foxml_rec=[$foxml_rec]\n";
# print __LINE__, " foxml_rec: foxml_rec=[$foxml_rec] found:", Dumper($foxml_rec);
if
(
exists
(
$self
->
{
agent_cnf
}
->
{
prefiltered_pids
}
->
{
$foxml_rec
->
{
pid
}}))
{
print
__LINE__
,
"
NOTE: prefiltered pid; foxml_rec:
",
Dumper
(
$foxml_rec
);
next
FOXML_REC
;
}
# print __LINE__, " foxml_rec=[$foxml_rec] added: ", Dumper($foxml_rec);
$self
->
add_book
(
$foxml_rec
);
}
}
...
...
@@ -176,10 +186,10 @@ sub check_book
return
'
filtered_pids
'
if
(
exists
(
$self
->
{
agent_cnf
}
->
{
filtered_pids
}
->
{
$pid
}));
# check tickets
my
$ticket_col
=
$self
->
get_db_col
('
irma
_database
',
'
eod.tickets
');
my
$ticket_col
=
$self
->
get_db_col
('
stage
_database
',
'
eod.tickets
');
my
@tickets
=
$ticket_col
->
find
({
ac_number
=>
$ac_number
})
->
all
();
print
__LINE__
,
"
ac_number=[
$ac_number
] tickets:
",
scalar
@tickets
,
"
\n
";
# print __LINE__, Dumper(\@tickets);
# print __LINE__,
' ',
Dumper(\@tickets);
if
(
@tickets
>
1
)
{
$book
->
{
ticket
}
=
join
('
,
',
map
{
$_
->
{
ticket
}
}
@tickets
);
...
...
@@ -190,11 +200,13 @@ sub check_book
my
$t0
=
@tickets
[
0
];
$book
->
{
ticket
}
=
$t0
->
{
ticket
};
$book
->
{
ticket_status
}
=
$t0
->
{
status
};
$book
->
{
vt
}
=
$t0
->
{
custom_fields
}
->
{
vt
}
->
[
1
];
$book
->
{
ticket_pid
}
=
$t0
->
{
custom_fields
}
->
{
ph_pid
}
->
[
1
];
$book
->
{
ticket_url
}
=
$t0
->
{
custom_fields
}
->
{
ph_url
}
->
[
1
];
$book
->
{
vt
}
=
$t0
->
{
custom_fields
}
->
{
vt
}
->
[
1
];
}
# check IRMA for registered identifiers
my
$irma_col
=
$self
->
get_db_col
('
irma
_database
',
'
irma.map
');
my
$irma_col
=
$self
->
get_db_col
('
stage
_database
',
'
irma.map
');
my
@irma_records
=
$irma_col
->
find
({
ac_number
=>
$ac_number
})
->
all
();
# my @irma_records= $irma_col->find({ pid => $pid })->all(); # NOTE: there is no field named "pid" in the irma record!
print
__LINE__
,
"
ac_number=[
$ac_number
] irma_records:
",
scalar
@irma_records
,
"
\n
";
...
...
@@ -214,7 +226,7 @@ sub check_book
$self
->
{
counters
}
->
{
missing_irma_record
}
++
;
}
my
$marc_col
=
$self
->
get_db_col
('
marc
_database
',
'
alma.marc
');
my
$marc_col
=
$self
->
get_db_col
('
stage
_database
',
'
alma.marc
');
my
$marc
=
$marc_col
->
find_one
({
ac_number
=>
$ac_number
});
# print __LINE__, " marc: ", Dumper($marc);
return
'
missing_marc_record
'
unless
(
defined
(
$marc
));
...
...
@@ -229,7 +241,7 @@ sub check_book
if
(
exists
(
$book
->
{
mex
}))
{
my
$mex
=
$book
->
{
mex
};
print
__LINE__
,
"
ac_number=[
$ac_number
] mex:
",
Dumper
(
$mex
);
#
print __LINE__, " ac_number=[$ac_number] mex: ", Dumper($mex);
foreach
my
$mf
(
keys
%$mex
)
{
my
$mfa
=
$mex
->
{
$mf
};
...
...
@@ -264,7 +276,7 @@ sub check_book
if
(
$val
=~
m#^11353/10\.(\d+)$#
)
{
$copy
=
1
;
# only transcribe those URLs that really look like some
if
(
$val
ne
$book
->
{
hdl
})
if
(
$book
->
{
hdl
}
&&
$val
ne
$book
->
{
hdl
})
{
# TODO:
$book
->
{
update_hdl
}
=
$book
->
{
hdl
};
$self
->
{
counters
}
->
{
update_hdl
}
++
;
...
...
@@ -337,6 +349,13 @@ sub check_book
push
(
@alma_notes
,
'
set_urn
');
}
if
(
!
exists
(
$book
->
{
val_hdl
})
&&
exists
(
$book
->
{
hdl
}))
{
$book
->
{
update_hdl
}
=
$book
->
{
hdl
};
$self
->
{
counters
}
->
{
set_hdl
}
++
;
push
(
@alma_notes
,
'
set_hdl
');
}
unless
(
exists
(
$book
->
{
df_phaidra
}))
{
# TODO: if there is no phaidra_url at all, set it...
$self
->
{
counters
}
->
{
set_phaidra_url
}
++
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment