schema.py 703 B

12345678910111213141516171819202122232425262728293031
  1. """
  2. Data schema information for the book data tools.
  3. """
  4. import pandas as pd
  5. class NS:
  6. def __init__(self, name, num):
  7. self.name = name
  8. self.code = num
  9. self.offset = num * 100000000
  10. ns_work = NS('OL-W', 1)
  11. ns_edition = NS('OL-E', 2)
  12. ns_loc_rec = NS('LOC', 3)
  13. ns_gr_work = NS('GR-W', 4)
  14. ns_gr_book = NS('GR-B', 5)
  15. ns_loc_work = NS('LOC-W', 6)
  16. ns_loc_instance = NS('LOC-I', 7)
  17. ns_isbn = NS('ISBN', 9)
  18. numspaces = [
  19. ns_work, ns_edition,
  20. ns_loc_rec,
  21. ns_gr_work, ns_gr_book,
  22. ns_loc_work, ns_loc_instance,
  23. ns_isbn
  24. ]
  25. src_labels = pd.Series(dict((_ns.name, _ns.code) for _ns in numspaces))
  26. src_label_rev = pd.Series(src_labels.index, index=src_labels.values)
Tip!

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