Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
metadata-and-data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
web-et-numerique
web-et-numerique-internet
data.grandlyon.com
web-portal
components
indexers
metadata-and-data
Commits
a1ce5aa9
Commit
a1ce5aa9
authored
6 years ago
by
Alessandro Cerioni
Browse files
Options
Downloads
Patches
Plain Diff
Changing way to generate the license attribute
parent
41ceed41
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
2-metadata-processor.py
+7
-12
7 additions, 12 deletions
2-metadata-processor.py
with
7 additions
and
12 deletions
2-metadata-processor.py
+
7
−
12
View file @
a1ce5aa9
...
@@ -170,17 +170,12 @@ def process_records( in_records, geonetwork_root_url, working_directory, credent
...
@@ -170,17 +170,12 @@ def process_records( in_records, geonetwork_root_url, working_directory, credent
del
out_record
[
'
metadata-fr
'
][
'
legalConstraints
'
]
del
out_record
[
'
metadata-fr
'
][
'
legalConstraints
'
]
out_record
[
'
metadata-fr
'
][
'
legalConstraints
'
]
=
[
in_record
[
'
legalConstraints
'
]]
out_record
[
'
metadata-fr
'
][
'
legalConstraints
'
]
=
[
in_record
[
'
legalConstraints
'
]]
# adding a 'license' field
out_record
[
'
metadata-fr
'
][
'
license
'
]
=
'
unknown
'
if
'
legalConstraints
'
in
out_record
[
'
metadata-fr
'
].
keys
():
if
'
legalConstraints
'
in
out_record
[
'
metadata-fr
'
].
keys
():
tmp
=
out_record
[
'
metadata-fr
'
][
'
legalConstraints
'
]
for
el
in
out_record
[
'
metadata-fr
'
][
'
legalConstraints
'
]:
if
"
licence
"
in
el
.
lower
():
if
len
(
tmp
)
==
2
:
out_record
[
'
metadata-fr
'
][
'
license
'
]
=
el
out_record
[
'
metadata-fr
'
][
'
legalConstraints
'
]
=
tmp
[
0
]
out_record
[
'
metadata-fr
'
][
'
license
'
]
=
tmp
[
1
]
elif
len
(
tmp
)
==
1
:
out_record
[
'
metadata-fr
'
][
'
license
'
]
=
tmp
[
0
]
else
:
logging
.
err
(
"
This case is new!
"
)
exit
(
1
)
if
'
resourceConstraints
'
in
out_record
[
'
metadata-fr
'
].
keys
()
and
type
(
out_record
[
'
metadata-fr
'
][
'
resourceConstraints
'
])
is
str
:
if
'
resourceConstraints
'
in
out_record
[
'
metadata-fr
'
].
keys
()
and
type
(
out_record
[
'
metadata-fr
'
][
'
resourceConstraints
'
])
is
str
:
del
out_record
[
'
metadata-fr
'
][
'
resourceConstraints
'
]
del
out_record
[
'
metadata-fr
'
][
'
resourceConstraints
'
]
...
@@ -234,9 +229,9 @@ def process_records( in_records, geonetwork_root_url, working_directory, credent
...
@@ -234,9 +229,9 @@ def process_records( in_records, geonetwork_root_url, working_directory, credent
if
'
idxMsg
'
in
in_record
.
keys
():
if
'
idxMsg
'
in
in_record
.
keys
():
del
out_record
[
'
metadata-fr
'
][
'
idxMsg
'
]
del
out_record
[
'
metadata-fr
'
][
'
idxMsg
'
]
# let's
delete duplicates
in the
'
updateFrequency
' attribute
# let's
take just one value among those that are
in the updateFrequency
(hoping that it is representative...)
if
'
updateFrequency
'
in
in_record
.
keys
()
and
type
(
in_record
[
'
updateFrequency
'
])
is
list
:
if
'
updateFrequency
'
in
in_record
.
keys
()
and
type
(
in_record
[
'
updateFrequency
'
])
is
list
:
out_record
[
'
metadata-fr
'
][
'
updateFrequency
'
]
=
list
(
set
(
in_record
[
'
updateFrequency
'
]
))
out_record
[
'
metadata-fr
'
][
'
updateFrequency
'
]
=
in_record
[
'
updateFrequency
'
]
[
0
]
# let's generate the href of this document
# let's generate the href of this document
local_params
=
OrderedDict
()
local_params
=
OrderedDict
()
...
...
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