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

XLS data transfer to Kobo #19

Open
wants to merge 143 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
80b419b
methods added to xml.py, and run2.py can be used to transfer google f…
yaqubdiyaa Nov 26, 2023
42c04d3
can run run2.py form command line (--excel_file 'pathname')
yaqubdiyaa Nov 27, 2023
0e017a9
fixed error so it can run from command line
yaqubdiyaa Nov 28, 2023
10d10c4
working from command line (need to clean)
yaqubdiyaa Dec 2, 2023
c833de7
cleaned (and compatible with original kobo-transfer code)
yaqubdiyaa Dec 2, 2023
105dec7
Update README.md
yaqubdiyaa Dec 2, 2023
433c0aa
Update README.md
yaqubdiyaa Dec 2, 2023
396695b
Merge pull request #1 from yaqubdiyaa/xls-xml
yaqubdiyaa Dec 2, 2023
75043c1
Update README.md
yaqubdiyaa Dec 2, 2023
981a8b1
Update README.md
yaqubdiyaa Dec 2, 2023
4b254c1
Update README.md
yaqubdiyaa Dec 2, 2023
862f06a
Update README.md
yaqubdiyaa Dec 2, 2023
4333769
default xlsx added
yaqubdiyaa Dec 2, 2023
3947c22
Merge pull request #2 from yaqubdiyaa/xls-xml
yaqubdiyaa Dec 2, 2023
0117f6e
Delete Filename(google).xlsx
yaqubdiyaa Dec 2, 2023
4b6343f
Update README.md
yaqubdiyaa Dec 2, 2023
01aaf5f
downloads media from google drive (connected to config file), but err…
yaqubdiyaa Dec 29, 2023
edcde7a
cleaned + refactored (methods extracted to new file)
yaqubdiyaa Dec 29, 2023
28cf4f8
Update README.md
yaqubdiyaa Dec 30, 2023
5e5bb4b
accounted for ranking questions + group questions upload from xlsx to…
yaqubdiyaa Jan 5, 2024
f247a58
Delete ~$Kobo_Platform_Test_-_rank-groups.xlsx
yaqubdiyaa Jan 5, 2024
37b4be0
Delete Filename(google).xlsx
yaqubdiyaa Jan 5, 2024
d3708d0
Update README.md
yaqubdiyaa Jan 5, 2024
758f043
Update README.md
yaqubdiyaa Jan 5, 2024
9f55873
Merge branch 'general-xlsx-kobo'
yaqubdiyaa Jan 5, 2024
6557dcd
hardcoded data.xlsx
yaqubdiyaa Jan 5, 2024
a6fbf05
removed google drive media methods
yaqubdiyaa Jan 5, 2024
b40eee4
Merge pull request #4 from yaqubdiyaa/general-xlsx-kobo
yaqubdiyaa Jan 5, 2024
43ee73b
grouping works with data.xlsx
yaqubdiyaa Jan 5, 2024
a830336
works from command line with python3 run2.py -xt -ef ./data.xlsx
yaqubdiyaa Jan 5, 2024
5739e88
commented out a line for testing so output file not saved in directory
yaqubdiyaa Jan 5, 2024
6ee80a6
Merge pull request #5 from yaqubdiyaa/main
yaqubdiyaa Jan 5, 2024
0b4cc7b
repeating groups works correctly
yaqubdiyaa Jan 6, 2024
59b9af4
Merge pull request #6 from yaqubdiyaa/general-xlsx-kobo
yaqubdiyaa Jan 6, 2024
3483c0b
importing media
yaqubdiyaa Jan 7, 2024
921781f
Update README.md
yaqubdiyaa Jan 7, 2024
e62fe0f
Update README.md
yaqubdiyaa Jan 8, 2024
0182ce2
Update README.md
yaqubdiyaa Jan 8, 2024
41c9436
Update README.md
yaqubdiyaa Jan 8, 2024
08d40e6
Update README.md
yaqubdiyaa Jan 8, 2024
ad30482
combined google+general xml methods, match_kobo method for warning me…
yaqubdiyaa Jan 8, 2024
6c187ba
deleted specific google data-->xml method
yaqubdiyaa Jan 8, 2024
886ecd0
Update README.md
yaqubdiyaa Jan 8, 2024
7ac185d
all none shows up as "" now, repeat groups not working anymore
yaqubdiyaa Jan 8, 2024
79778c3
fixed editing repeat group responses
yaqubdiyaa Jan 9, 2024
56d3dc3
initial submission of repeat group (with no uuid)
yaqubdiyaa Jan 9, 2024
09d4b90
Update README.md
yaqubdiyaa Jan 10, 2024
abb12dd
Update README.md
yaqubdiyaa Jan 11, 2024
34bab1b
Update README.md
yaqubdiyaa Jan 11, 2024
98ab5f0
Update README.md
yaqubdiyaa Jan 11, 2024
3c78db8
Merge pull request #7 from yaqubdiyaa/general-xlsx-kobo
yaqubdiyaa Jan 12, 2024
bc5f01b
changes to speed up transfer
yaqubdiyaa Jan 17, 2024
9acd406
Update README.md
yaqubdiyaa Jan 17, 2024
765cf0a
Update README.md
yaqubdiyaa Jan 17, 2024
48bd5e2
refactored for shorter/cleaner functions
yaqubdiyaa Jan 21, 2024
8942a5d
commented out get_media, del_media, and created single_submission_xml…
yaqubdiyaa Jan 21, 2024
47329e0
added comments
yaqubdiyaa Jan 21, 2024
b20342d
removed unnecessary imports
yaqubdiyaa Jan 21, 2024
0ab6cfd
Update README.md
yaqubdiyaa Jan 21, 2024
b50f254
removed imports in media.py
yaqubdiyaa Jan 27, 2024
10398da
test xlsx (import and downloaded)
yaqubdiyaa Jan 27, 2024
26f17f2
fixed -gt multiple select
yaqubdiyaa Jan 28, 2024
26fdf2b
Merge branch 'main' of https://github.com/yaqubdiyaa/kobo-transfer
yaqubdiyaa Jan 28, 2024
aeb56ae
fixed -gt multiple select
yaqubdiyaa Jan 28, 2024
20be0a6
Update README.md
yaqubdiyaa Jan 28, 2024
498876d
Merge branch 'main' of https://github.com/yaqubdiyaa/kobo-transfer
yaqubdiyaa Jan 29, 2024
db8d558
Merge pull request #11 from yaqubdiyaa/main
yaqubdiyaa Jan 29, 2024
fc5a9cd
deleted demodownloaded xlsx
yaqubdiyaa Jan 29, 2024
9c318c8
edited run.py
yaqubdiyaa Jan 29, 2024
8b05753
Delete DemoDownloaded.xlsx
yaqubdiyaa Jan 29, 2024
70a360c
Delete Kobo_Platform_Test_-_rank-groups.xlsx
yaqubdiyaa Jan 29, 2024
348d13f
Delete run2.py
yaqubdiyaa Jan 29, 2024
34fef1b
Delete DemoProjectDownloadedData.xlsx
yaqubdiyaa Jan 29, 2024
ce9a24d
Delete repeatgroupproject.xlsx
yaqubdiyaa Jan 29, 2024
4293f6d
Merge pull request #12 from yaqubdiyaa/run.py
yaqubdiyaa Jan 29, 2024
e655f6a
Update README.md
yaqubdiyaa Jan 29, 2024
e41830a
Update README.md
yaqubdiyaa Jan 29, 2024
e19a466
Update README.md
yaqubdiyaa Jan 29, 2024
d92aab0
Update README.md
yaqubdiyaa Jan 29, 2024
23ca144
Update README.md
yaqubdiyaa Jan 29, 2024
6b0f8f3
added warning method
yaqubdiyaa Feb 5, 2024
d77c453
Update README.md
yaqubdiyaa Feb 5, 2024
bb1e6c2
Update README.md
yaqubdiyaa Feb 5, 2024
a8e360f
ds
yaqubdiyaa Feb 5, 2024
fad0cda
Merge branch 'run.py'
yaqubdiyaa Feb 5, 2024
e9d3da9
Delete .DS_Store
yaqubdiyaa Feb 5, 2024
64fb19f
Update README.md
yaqubdiyaa Feb 18, 2024
d942c6b
removed google code
yaqubdiyaa Feb 18, 2024
b297beb
reformatted using black
yaqubdiyaa Feb 18, 2024
64fddf5
supports nested groups (not tested w multiple sheets/repeat)
yaqubdiyaa Feb 19, 2024
23d57c2
supports multiple repeat groups (more than 2 sheets)
yaqubdiyaa Feb 19, 2024
2ef083f
nested repeat partially working (check note)
yaqubdiyaa Feb 21, 2024
5aa8c44
nested repeat working
yaqubdiyaa Feb 22, 2024
dbd237f
changed all ==None to is None
yaqubdiyaa Feb 22, 2024
4836e10
- changed == 'end' or == 'start to in['end','start']
yaqubdiyaa Feb 22, 2024
6fe0984
both nested repeat and multiple repeats working
yaqubdiyaa Feb 22, 2024
49c02fa
removed initial_repeat logic
yaqubdiyaa Feb 22, 2024
cc46afe
changed all cell_value == "" to not cell_value
yaqubdiyaa Feb 22, 2024
321e52d
removed all gtransfer logic
yaqubdiyaa Feb 22, 2024
48ed103
made test/new.py repeat function consistent with original
yaqubdiyaa Feb 22, 2024
88a3c39
nested repeat still working, case 2 working (havent checked case 1 bu…
yaqubdiyaa Mar 2, 2024
3a190d8
not using _ in general_, fixed geopoint, passing index in for media
yaqubdiyaa Mar 4, 2024
bae6756
fixed format for uuid:eo923048 (still need to test with missing uuids)
yaqubdiyaa Mar 4, 2024
e90658c
fixed uuid: format, tested project w repeat groups and no uuids (repe…
yaqubdiyaa Mar 4, 2024
3f7019f
media upload and uuid: format working
yaqubdiyaa Mar 4, 2024
d8923da
added readme comments about export formatting (single column, no medi…
yaqubdiyaa Mar 4, 2024
992c6fe
more code blocks
yaqubdiyaa Mar 5, 2024
5e21a8e
all general tests working! all new.py copied onto xlsx_kobo; only che…
yaqubdiyaa Mar 5, 2024
cda17c9
new.py and xlsx_kobo are consistent, added some comments to function …
yaqubdiyaa Mar 5, 2024
3b889d4
deleted unnecessary comments from xlsx_kobo new_repeat(), but kept al…
yaqubdiyaa Mar 5, 2024
7243fd8
changed deprecated+submissionID logic and it worked!!
yaqubdiyaa Mar 8, 2024
1aba66e
changed nsmap_element naming to nsmap_dict
yaqubdiyaa Mar 8, 2024
d1a2d41
fixed all_empty warning message
yaqubdiyaa Mar 8, 2024
d5822ef
changed create_group so that check_for_group isn't needed anymore. no…
yaqubdiyaa Mar 8, 2024
4cc7087
removed the warnings method (clunky, unnecessary, need to ask josh if…
yaqubdiyaa Mar 8, 2024
124e3bb
works for everything (haven't tested transfer) except case 3
yaqubdiyaa Mar 10, 2024
a13ecc0
tested repeat() function with different cases, but not sure if I'm mi…
yaqubdiyaa Mar 10, 2024
d3ff827
unsure about repeat method
yaqubdiyaa Mar 10, 2024
b31cd1a
cleaned methods
yaqubdiyaa Mar 10, 2024
0c0cfa2
replaced "" --> ' '
yaqubdiyaa Mar 13, 2024
01c0ed4
refactored new repeat method
yaqubdiyaa Mar 13, 2024
e4a4d6e
added comments, changed variable name _uid --> submission_xml
yaqubdiyaa Mar 13, 2024
be9b4b2
reformatted
yaqubdiyaa Mar 13, 2024
7798d16
reordered functions
yaqubdiyaa Mar 13, 2024
8acbbd1
Merge pull request #14 from yaqubdiyaa/review
yaqubdiyaa Mar 13, 2024
034c7b3
Rename README.md to xls-transfer/README.md
yaqubdiyaa Mar 13, 2024
8142513
Delete testrun.py
yaqubdiyaa Mar 13, 2024
ae80d2d
Delete GoogleDemoForm (Responses).xlsx
yaqubdiyaa Mar 13, 2024
009c4db
Delete nested_project.xlsx
yaqubdiyaa Mar 13, 2024
296ca92
Delete DemoProjectInitialUpload.xlsx
yaqubdiyaa Mar 13, 2024
f92a7be
Delete normal_group.xlsx
yaqubdiyaa Mar 13, 2024
7153545
Delete transfer/new.py
yaqubdiyaa Mar 13, 2024
40195e2
Create xls-import-requirements.txt
yaqubdiyaa Mar 13, 2024
96027c2
added req files + edited readme
yaqubdiyaa Mar 13, 2024
4d0a8a1
deleted imports
yaqubdiyaa Mar 13, 2024
c7449a0
edited readme
yaqubdiyaa Mar 13, 2024
cbdb81b
readme edit
yaqubdiyaa Mar 17, 2024
f08792f
added tests
yaqubdiyaa Mar 17, 2024
543f092
new tests (group geo)
yaqubdiyaa Mar 17, 2024
b106f5d
group geo edit ++ parent_table outside loop edit
yaqubdiyaa Mar 17, 2024
1e407b4
Update test_description.txt
yaqubdiyaa Mar 17, 2024
20c172b
initial upload example + test
yaqubdiyaa Mar 19, 2024
4502ebb
Merge branch 'main' of https://github.com/yaqubdiyaa/kobo-transfer
yaqubdiyaa Mar 19, 2024
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
87 changes: 0 additions & 87 deletions README.md

This file was deleted.

72 changes: 60 additions & 12 deletions run.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python3

import argparse
import json
import sys
Expand All @@ -12,9 +10,12 @@
print_stats,
transfer_submissions,
)

from xls_transfer.xlsx_kobo import general_xls_to_xml

def main(
warnings,
xtransfer,
excel_file,
limit,
last_failed=False,
keep_media=False,
Expand All @@ -23,40 +24,50 @@ def main(
validate=True,
config_file=None,
):

config = Config(config_file=config_file, validate=validate)
config_src = config.src

print('📸 Getting all submission media', end=' ', flush=True)
get_media()
if not xtransfer:
print('📸 Getting all submission media', end=' ', flush=True)
get_media()

xml_url_src = config_src['xml_url'] + f'?limit={limit}'

if last_failed and config.last_failed_uuids:
xml_url_src += f'&query={json.dumps(config.data_query)}'

all_results = []

submission_edit_data = get_submission_edit_data()

print('📨 Transferring submission data')

def transfer(all_results, url=None):
parsed_xml = get_src_submissions_xml(xml_url=url)
if (xtransfer):
parsed_xml = general_xls_to_xml(excel_file, submission_edit_data, warnings)
else:
parsed_xml = get_src_submissions_xml(xml_url=url)

submissions = parsed_xml.findall(f'results/{config_src["asset_uid"]}')
next_ = parsed_xml.find('next').text
results = transfer_submissions(

"""results = transfer_submissions(
submissions,
submission_edit_data,
quiet=quiet,
regenerate=regenerate,
)
all_results += results
all_results += results"""

if next_ != 'None' and next_ is not None:
transfer(all_results, next_)

transfer(all_results, xml_url_src)

if not keep_media:
del_media()

if not xtransfer:
if not keep_media:
del_media()

print('✨ Done')
print_stats(all_results)
Expand All @@ -66,6 +77,34 @@ def transfer(all_results, url=None):
parser = argparse.ArgumentParser(
description='A CLI tool to transfer submissions between projects with identical XLSForms.'
)

parser.add_argument(
'--print-warnings',
'-w',
default = False,
action = 'store_true',
help='Print warnings if questions in Kobo form do not match XLS form.',
)

parser.add_argument(
'--google-transfer',
'-gt',
default = False,
action = 'store_true',
help='Complete transfer from Google Form data to Kobo project.',
)
parser.add_argument(
'--excel-transfer',
'-xt',
default = False,
action = 'store_true',
help='Complete transfer from any xlsx form to Kobo project.',
)
parser.add_argument(
'--excel-file',
'-ef',
help='Excel file path for data to upload',
)
parser.add_argument(
'--limit',
'-l',
Expand Down Expand Up @@ -117,8 +156,14 @@ def transfer(all_results, url=None):
)
args = parser.parse_args()

if (args.excel_transfer and not args.excel_file) or (args.google_transfer and not args.excel_file):
parser.error("If --excel-transfer (-xt) or --google-transfer (-gt) is passed, --excel-file (-xt) is required.")

try:
main(
warnings = args.print_warnings,
xtransfer = args.excel_transfer,
excel_file=args.excel_file,
limit=args.limit,
last_failed=args.last_failed,
regenerate=args.regenerate_uuids,
Expand All @@ -127,7 +172,10 @@ def transfer(all_results, url=None):
validate=not args.no_validate,
config_file=args.config_file,
)

except KeyboardInterrupt:
print('🛑 Stopping run')
# Do something here so we can pick up again where this leaves off
sys.exit()


1 change: 1 addition & 0 deletions submission.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<root><next /><previous /><results><aRxMkyoPa6dj5wqMnT4vnz id="aRxMkyoPa6dj5wqMnT4vnz" version="1 (2024-03-14 10:48:27)"><formhub><uuid>8f5f9a0801cb4c0c85bc340dde5c3dc4</uuid></formhub><start>2024-03-19T18:03:42.398000</start><end>2024-03-19T18:07:04.622000</end><Quest_name>Quest for Crystal</Quest_name><Quest_starting_date>2024-03-05 00:00:00</Quest_starting_date><character_selection><Character_name>Percy</Character_name><character_objective><Objective_title>Retrieval of Crystal</Objective_title><Objective_description>locate the cave and get it from the guardian</Objective_description></character_objective><character_tasks><group_yj2jm99><Task_difficulty>3</Task_difficulty><Task_description>navigate through forest, and avoid traps</Task_description></group_yj2jm99><Task_title>forest navigation</Task_title></character_tasks></character_selection><__version__>v5NMWz6Pcy8Wq9XzTHLViC</__version__><meta><instanceID>uuid:77de2884-b34e-48ed-84bf-e172680fb2e2</instanceID><deprecatedID>uuid:63047222-c474-4e5f-bd16-f37b6eab7891</deprecatedID></meta></aRxMkyoPa6dj5wqMnT4vnz><aRxMkyoPa6dj5wqMnT4vnz id="aRxMkyoPa6dj5wqMnT4vnz" version="1 (2024-03-14 10:48:27)"><formhub><uuid>8f5f9a0801cb4c0c85bc340dde5c3dc4</uuid></formhub><start>2024-03-19T18:07:31.300000</start><end>2024-03-19T18:15:06.317000</end><Quest_name>Mountain expedition</Quest_name><Quest_starting_date>2024-03-03 00:00:00</Quest_starting_date><character_selection><Character_name>aria</Character_name><character_objective><Objective_title>reach the summit</Objective_title><Objective_description>go through extreme weather and terrain to reach highest peak</Objective_description></character_objective><character_tasks><group_yj2jm99><Task_difficulty>1</Task_difficulty><Task_description>visit base camp to get essential gear</Task_description></group_yj2jm99><Task_title>climbing gear</Task_title></character_tasks><character_tasks><group_yj2jm99><Task_difficulty>3</Task_difficulty><Task_description>icefall</Task_description></group_yj2jm99><Task_title>navigate the icefall</Task_title></character_tasks><character_tasks><group_yj2jm99><Task_difficulty>4</Task_difficulty><Task_description>summit attempt</Task_description></group_yj2jm99><Task_title>final push to the summit!</Task_title></character_tasks></character_selection><character_selection><Character_name>Horace</Character_name><character_objective><Objective_title>guidance</Objective_title><Objective_description>guide the team safely</Objective_description></character_objective><character_tasks><group_yj2jm99><Task_difficulty>3</Task_difficulty><Task_description>assess conditions to plan the safest and most efficient route</Task_description></group_yj2jm99><Task_title>planning</Task_title></character_tasks><character_tasks><group_yj2jm99><Task_difficulty>3</Task_difficulty><Task_description>establish emergency response protocols</Task_description></group_yj2jm99><Task_title>emergency planning</Task_title></character_tasks><character_tasks><group_yj2jm99><Task_difficulty /><Task_description>provide constant support and encouragement to team, and help with physical and mental well-being</Task_description></group_yj2jm99><Task_title>support</Task_title></character_tasks></character_selection><__version__>v5NMWz6Pcy8Wq9XzTHLViC</__version__><meta><instanceID>uuid:61c7dc7e-7a25-4af2-abfa-136f8d0941eb</instanceID><deprecatedID>uuid:a148ed1a-64d4-44e2-90de-80b80d715227</deprecatedID></meta></aRxMkyoPa6dj5wqMnT4vnz><aRxMkyoPa6dj5wqMnT4vnz id="aRxMkyoPa6dj5wqMnT4vnz" version="1 (2024-03-14 10:48:27)"><formhub><uuid>8f5f9a0801cb4c0c85bc340dde5c3dc4</uuid></formhub><start>2024-03-19T18:15:06.346000</start><end>2024-03-19T18:16:26.712000</end><Quest_name>The Lost City</Quest_name><Quest_starting_date>2024-03-03 00:00:00</Quest_starting_date><character_selection><Character_name>Elara</Character_name><character_objective><Objective_title>find the entrance</Objective_title><Objective_description>uncover hidden entrance</Objective_description></character_objective><character_tasks><group_yj2jm99><Task_difficulty>3</Task_difficulty><Task_description>use knowledge of ancient languages to decipher inscriptions</Task_description></group_yj2jm99><Task_title>decode inscriptions</Task_title></character_tasks></character_selection><__version__>v5NMWz6Pcy8Wq9XzTHLViC</__version__><meta><instanceID>uuid:c74ddab2-40e7-4a08-b1e6-e859f5629637</instanceID><deprecatedID>uuid:2faf5ce3-49d7-4109-9819-18d4bc9d8292</deprecatedID></meta></aRxMkyoPa6dj5wqMnT4vnz><aRxMkyoPa6dj5wqMnT4vnz id="aRxMkyoPa6dj5wqMnT4vnz" version="1 (2024-03-14 10:48:27)"><formhub><uuid>8f5f9a0801cb4c0c85bc340dde5c3dc4</uuid></formhub><start>2024-03-19T18:16:26.736000</start><end>2024-03-19T18:19:58.767000</end><Quest_name>The forbidden ruins</Quest_name><Quest_starting_date /><character_selection><Character_name>Thalia</Character_name><character_objective><Objective_title>Uncover lost civilization</Objective_title><Objective_description>piece together clues to unravel mysteries of forgotten civilization</Objective_description></character_objective></character_selection><__version__>v5NMWz6Pcy8Wq9XzTHLViC</__version__><meta><instanceID>uuid:dff86a4f-2b46-4a06-b0ad-a0fe08d1ce49</instanceID><deprecatedID>uuid:cbd2b4d0-f98d-48d0-8988-52cd94ed5861</deprecatedID></meta></aRxMkyoPa6dj5wqMnT4vnz></results></root>
Binary file added transfer/.DS_Store
Binary file not shown.
20 changes: 17 additions & 3 deletions transfer/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@

from helpers.config import Config

def rename_media_folder(submission_data, uuid, row_num):
current_attachments_path = os.path.join(
Config.ATTACHMENTS_DIR, submission_data['asset_uid'], str(row_num)
)
if os.path.exists(current_attachments_path):
new_attachments_path = os.path.join(
Config.ATTACHMENTS_DIR, submission_data['asset_uid'], str(uuid)
)
try:
# Move the folder to the new path
shutil.move(current_attachments_path, new_attachments_path)

except Exception as e: #TODO
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO?

print(f"Error: {e}")

def del_media():
config = Config().src
Expand All @@ -18,7 +32,6 @@ def del_media():
print('🧹 Cleaning up media (pass `--keep-media` to prevent cleanup).')
shutil.rmtree(media_path)


def get_media(verbosity=0, chunk_size=1024, throttle=0.1, limit=1000, query=''):
config = Config().src
config.update(
Expand All @@ -29,9 +42,10 @@ def get_media(verbosity=0, chunk_size=1024, throttle=0.1, limit=1000, query=''):
'throttle': throttle,
}
)

stats = download_all_media(
data_url=config['data_url'],
stats=get_clean_stats(),
data_url=config['data_url'],
stats=get_clean_stats(),
)


Expand Down
2 changes: 1 addition & 1 deletion transfer/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from utils.text import get_valid_filename
from helpers.config import Config


def get_submission_edit_data():
config = Config().dest
_v_, v = get_info_from_deployed_versions()
Expand Down Expand Up @@ -116,6 +115,7 @@ def generate_new_instance_id() -> (str, str):
def transfer_submissions(all_submissions_xml, asset_data, quiet, regenerate):
results = []
for submission_xml in all_submissions_xml:

# Use the same UUID so that duplicates are rejected
original_uuid = submission_xml.find('meta/instanceID').text.replace(
'uuid:', ''
Expand Down
Loading