Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

viaf.py 999 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  1. import logging
  2. from invoke import task
  3. import support as s
  4. _log = logging.getLogger(__name__)
  5. dft_date = '20181104'
  6. @task(s.init, s.build, name='import')
  7. def import_viaf(c, date=dft_date, force=False):
  8. "Import VIAF data"
  9. s.start('viaf-import', force=force)
  10. _log.info('initializing VIAF schema')
  11. s.psql(c, 'viaf-schema.sql', True)
  12. infile = s.data_dir / f'viaf-{date}-clusters-marc21.xml.gz'
  13. _log.info('importing VIAF data from %s', infile)
  14. s.pipeline([
  15. [s.bdtool, 'parse-marc', '--db-schema', 'viaf', '-t', 'marc_field', '--line-mode', infile]
  16. ])
  17. s.finish('viaf-import')
  18. @task(s.init)
  19. def index(c, force=False):
  20. "Index VIAF data"
  21. s.check_prereq('viaf-import')
  22. s.start('viaf-index', force=force)
  23. _log.info('building VIAF indexes')
  24. s.psql(c, 'viaf-index.sql', True)
  25. s.finish('viaf-index')
  26. @task(s.init, s.build)
  27. def record_files(c, date=dft_date):
  28. s.booktool(c, 'hash', s.data_dir / f'viaf-{date}-clusters-marc21.xml.gz')
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...