Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Andrew Buddenberg
gcis-py-client
Commits
03a91b8a
Commit
03a91b8a
authored
Jan 10, 2017
by
Andrew Buddenberg
Committed by
abuddenberg
Jan 13, 2017
Browse files
Fix state identifiers and ordinals through Texas
parent
b90d72bf
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
states.py
View file @
03a91b8a
This diff is collapsed.
Click to expand it.
sync_states.py
View file @
03a91b8a
...
...
@@ -16,7 +16,6 @@ import re
import
traceback
# gcis = GcisClient('https://data-stage.globalchange.gov', *gcis_stage_auth)
gcis
=
GcisClient
(
'https://data-stage.globalchange.gov'
,
*
gcis_stage_auth
)
surveys
=
SurveyClient
(
'https://state-resources.cicsnc.org'
,
survey_token
)
...
...
@@ -24,38 +23,35 @@ surveys = SurveyClient('https://state-resources.cicsnc.org', survey_token)
def
main
():
print
(
gcis
.
test_login
())
total
=
0
for
report_id
in
sync_metadata_tree
:
for
chapter_id
in
sync_metadata_tree
[
report_id
]:
for
survey_url
,
figure_id
,
figure_num
in
sync_metadata_tree
[
report_id
][
chapter_id
]:
total
+=
1
# figure, datasets = surveys.get_survey(survey_url, do_download=True)
# #Fix misspelling
# figure.identifier = figure_id
# figure.title = figure.title.replace('precipitaton', 'precipitation')
# figure.ordinal = figure_num
#
# print(survey_url)
# print(figure, datasets)
#
# realize_parents(gcis, figure.parents)
# realize_contributors(gcis, figure.contributors)
#
# print('Contributors: ', figure.contributors)
# print('Parents: ', figure.parents)
# # gcis_fig = gcis.get_figure(report_id, figure_id, chapter_id=chapter_id)
#
# for ds in [p for p in figure.parents if p.publication_type_identifier == 'dataset']:
# # Assign synthetic activity identifier to for datasets associated with figure
# if ds.activity and ds.activity.identifier is None:
# ds.activity.identifier = generate_activity_id(figure, ds.publication)
# print 'Dataset: ', ds.activity
#
# print 'Creating figure... ', gcis.create_figure(report_id, chapter_id, figure, skip_images=True, skip_upload=False)
# # print 'Updating figure... ', gcis.update_figure(report_id, chapter_id, figure, skip_images=True)
print
(
total
)
figure
,
datasets
=
surveys
.
get_survey
(
survey_url
,
do_download
=
True
)
#Fix misspelling
figure
.
identifier
=
figure_id
figure
.
title
=
figure
.
title
.
replace
(
'precipitaton'
,
'precipitation'
)
figure
.
ordinal
=
figure_num
print
(
survey_url
)
print
(
figure
,
datasets
)
realize_parents
(
gcis
,
figure
.
parents
)
realize_contributors
(
gcis
,
figure
.
contributors
)
print
(
'Contributors: '
,
figure
.
contributors
)
print
(
'Parents: '
,
figure
.
parents
)
# gcis_fig = gcis.get_figure(report_id, figure_id, chapter_id=chapter_id)
for
ds
in
[
p
for
p
in
figure
.
parents
if
p
.
publication_type_identifier
==
'dataset'
]:
# Assign synthetic activity identifier to for datasets associated with figure
if
ds
.
activity
and
ds
.
activity
.
identifier
is
None
:
ds
.
activity
.
identifier
=
generate_activity_id
(
figure
,
ds
.
publication
)
print
(
'Dataset: '
,
ds
.
activity
)
print
(
'Creating figure... '
,
gcis
.
create_figure
(
report_id
,
chapter_id
,
figure
,
skip_images
=
True
,
skip_upload
=
False
))
# print('Updating figure... ', gcis.update_figure(report_id, chapter_id, figure, skip_images=True))
def
generate_activity_id
(
image
,
dataset
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment