eregs / regulations-parser

Parser for U.S. federal regulations and other regulatory information
Creative Commons Zero v1.0 Universal
37 stars 39 forks source link

XML Parsing Issue #320

Closed eadamsatx closed 7 years ago

eadamsatx commented 8 years ago

In attempting to import title 37 part 42, I ran into two errors.

The first was a missing effective date, which I can likely sort out myself manually. I was able to temporarily pass it in code by preventing it from raising an exception and continuing normally.

The second more bothersome issue is that 17904 raises a Missing Dependency issue for 17900 even though both docs seem to have downloaded normally. Here's the full error text:

Missing: Missing dependency. .eregs_index/tree/37/42/2012-17900 is needed for .eregs_index/tree/37/42/2012-17904

Does anyone know of a resolution for this type of failure?

cmc333333 commented 8 years ago

Hey @eadamsatx, thanks for giving this a shot! The initial import is always the hardest, but let's see if we can get you going as quickly as possible. To do that, we'll cut a few corners :)

First, we need to make a slight modification to the XML we'll be working with (at least until #321 is resolved). Make a directory called edits and within that, create a annual subdir. Within the subdir, place this file -- or download the original and replace the <E T="0714"> tags. You should now have a modified XML file at ./edits/annual/CFR-2015-title37-vol1-part42.xml.

Second, we need to tell the parser to look for modified files. Easy enough:

# in the root of the project
echo "LOCAL_XML_PATHS = ['./edits/']" >> local_settings.py

Finally, we rebuild, this time using only the latest annual edition:

eregs clear    # to remove existing versions
eregs pipeline 37 42 your-output-path-or-api --only-latest

That approach seems to be working; here's one of the sections with the ATF branding: screenshot from 2016-10-25 23-04-16

Let us know how it goes; we can also help you set up the UI.

eadamsatx commented 8 years ago

Thanks a bunch for creating the next issue & providing the screenshots, etc. It's very helpful, and I was able to get the latest version of the legislation up and running by following your instructions.

Do you know if anyone has published anything about resolving the missing dependency issue anywhere? That's the item I'm really stuck on at the moment, and while it seems like it must be a common problem, I'm having trouble finding much about it.

cmc333333 commented 8 years ago

@eadamsatx I think I've found your bug, but it's not one we've encountered before. To give you some context, the full version of a regulation is only published once a year; all edits to the reg are published (effectively) as diffs throughout the year. The way our parser works is to use those annual editions as milestones and apply the diffs to get intermediate versions of the regulation over time. Let's now look at how that's playing for 37 CFR 42.

Based on the Federal Register's API, there are 11 final rules (i.e. diffs), meaning our parser will try to produce 11 versions of the regulation:

version effective date present in annual edition
2012-17900 2012-09-16 2013
2012-17904 2012-09-16 2013
2012-17906 2012-09-16 2013
2012-17908 2013-03-16 2013
2012-22204 2013-03-16 2013
2013-00819 2013-03-19 2013
2013-06768 2013-03-25 2013
2014-24891 2014-10-22 2015
2015-12117 2014-10-22 2015
2016-07381 2014-10-22 2016
2016-09814 2014-10-22 2016

So, we can use the 2013 annual edition to parse the whole 2013-06768 version, and the 2015 edition to parse 2015-12117; the 2016 edition isn't published yet. We can build versions 2014-24891, 2016-07381, and 2016-09814 by looking at the diffs. We can't build 2012-17900 through 2013-00819, though; the diffs aren't descriptive enough to move backwards.

I think what we want to do in this novel, but probably predictable situation would be to skip the versions which come before the first annual edition. That might be as simple as modifying the code in regparser/commands/fill_with_rules.py to skip versions until the first annual edition. If you have some cycles to take a stab, we might be able to guide you; otherwise, we can keep this issue open to document the problem.

cmc333333 commented 8 years ago

How's it going @eadamsatx? Heads up that master includes a fix for #321

eadamsatx commented 8 years ago

[Edit] Hold off on this for a bit; I think I just had to write this out to figure out another method of attack [/Edit]

Thanks a bunch for creating #321 and following up. I do have some cycles and am attacking this problem right now.

The first thing I did was wrap fill_with_rules line deps.validate_for(tree_dir / version_id) in a try/catch for Missing only and had it log and continue. This got me all the way to the file upload, where it fails to serialize the xml because dependencies we want to skip (2013-00819 and prior) are still expected. I spent a good bit of time poking around the code trying to figure out where I need to remove these from without success. Can you point me in the right direction?

For what it's worth, I built a getter for the first annual edition, since there doesn't seem to be one kicking around yet, so I'm very close to comparing version dates as soon as I figure out where to remove them from.

cmc333333 commented 8 years ago

Hey @eadamsatx, before you go too far down a rabbit hole, I think the only logic you may need to change is around this line: https://github.com/eregs/regulations-parser/blob/master/regparser/commands/fill_with_rules.py#L20

It's currently dropping the first pair of versions because we're assuming the first version has been populated or "existing" (i.e. it's an annual edition). It's doubtful this line is needed at all due to lines 21-22. Instead, we might be able to look at that list of pairs and drop the first 0+ that are not populated (i.e. aren't present in existing_tree_ids).

Imagine we have 6 versions of a regulation, a through f, and annual editions associated with version c and e. We're given pairs of (a, None), (b, a), (c, b), (d, c), (e, d) and (f, e) representing dependencies between versions. We'd like to first trim the list to (c, b), (d, c), (e, d), and (f, e), the list of versions starting with the first annual edition. That's the new logic bit. We'll later trim that list further (line 21) to include only (d, c) and (f, e) (the versions to "fill in"). Does that make sense? Sorry to switch between the terms "populated" (that's probably most accurate), "existing" (that's in the relevant variable name), and "annual edition" (the most likely reason for one of the trees to be populated).

eadamsatx commented 8 years ago

I understand what you mean, but it seems like versions_with_parents is used precisely once: in calculating gaps, which only adds to deps after it is generated. Upon generation on line 24, it already contains plenty of references in its pred property to pre-first-annual-edition files.

In any case, I think that's not related to the actual crash I'm experiencing. The failure I was referring to is further down the pipeline: when building XML for the upload, prefer_shallow_depths is raising because solutions is empty for a pre-first-annual-edition file.

2016-11-06 21:29:51 regparser.tree.xml_parser.paragraph_processor Could not derive paragraph depths. Retrying with relaxed constraints.
2016-11-06 21:29:55 regparser.tree.xml_parser.paragraph_processor Could not determine paragraph depths (<SECTION /> 1-21):
STARS
?? a
Remaining markers: ['1', 'i', 'ii', 'A', 'B', '2', '3', '4', 'i', 'ii', '5', 'i', 'ii', '6', '7', 'i', 'ii', 'iii', 'iv', '8', '9', 'i', 'ii', '10', 'STARS', 'e', 'g', 'h', '1', '2', 'i', 'j', 'k', 'STARS', 'n']
Traceback (most recent call last):
  File "/home/eric/regulations-parser/manage.py", line 22, in <module>
    main(sys.argv)
  File "/home/eric/regulations-parser/manage.py", line 15, in main
    execute_from_command_line(argv)
  File "/home/eric/.virtualenvs/parser/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/home/eric/.virtualenvs/parser/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 345, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/eric/.virtualenvs/parser/local/lib/python2.7/site-packages/djclick/adapter.py", line 35, in run_from_argv
    return self.main(args=argv[2:], standalone_mode=False)
  File "/home/eric/.virtualenvs/parser/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/eric/.virtualenvs/parser/local/lib/python2.7/site-packages/djclick/adapter.py", line 23, in invoke
    return super(DjangoCommandMixin, self).invoke(ctx)
  File "/home/eric/regulations-parser/regparser/commands/retry.py", line 47, in invoke
    lambda: super(RetryingCommand, self).invoke(deepcopy(ctx)))
  File "/home/eric/regulations-parser/regparser/commands/retry.py", line 57, in run_or_resolve
    cmd()
  File "/home/eric/regulations-parser/regparser/commands/retry.py", line 47, in <lambda>
    lambda: super(RetryingCommand, self).invoke(deepcopy(ctx)))
  File "/home/eric/.virtualenvs/parser/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/eric/.virtualenvs/parser/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/eric/.virtualenvs/parser/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/eric/.virtualenvs/parser/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/eric/regulations-parser/regparser/commands/pipeline.py", line 39, in pipeline
    ctx.invoke(write_to, output=output, **params)
  File "/home/eric/.virtualenvs/parser/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/eric/regulations-parser/regparser/commands/write_to.py", line 115, in write_to
    write_notices(client, cfr_title, cfr_part)
  File "/home/eric/regulations-parser/regparser/commands/write_to.py", line 77, in write_notices
    transform_notice(notice_xml))
  File "/home/eric/regulations-parser/regparser/commands/write_to.py", line 45, in transform_notice
    as_dict = notice_xml.as_dict()
  File "/home/eric/regulations-parser/regparser/notice/xml.py", line 408, in as_dict
    notice = {'amendments': self.amendments,
  File "/home/eric/.virtualenvs/parser/local/lib/python2.7/site-packages/cached_property.py", line 26, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/home/eric/regulations-parser/regparser/notice/xml.py", line 354, in amendments
    return fetch_amendments(self.xml)
  File "/home/eric/regulations-parser/regparser/notice/amendments.py", line 224, in fetch_amendments
    content = cache.content_of_change(instruction_xml)
  File "/home/eric/regulations-parser/regparser/notice/amendments.py", line 65, in content_of_change
    return self.fetch(xml, parse_regtext, xml, cfr_part)
  File "/home/eric/regulations-parser/regparser/notice/amendments.py", line 32, in fetch
    self.by_xml[key] = Content(fn(*args), [])
  File "/home/eric/regulations-parser/regparser/notice/amendments.py", line 70, in parse_regtext
    sections = build_from_section(cfr_part, xml)
  File "/home/eric/regulations-parser/regparser/tree/xml_parser/reg_text.py", line 297, in build_from_section
    RegtextParagraphProcessor().process(section_xml, sect_node)
  File "/home/eric/regulations-parser/regparser/tree/xml_parser/paragraph_processor.py", line 154, in process
    depths = self.select_depth(depths)
  File "/home/eric/regulations-parser/regparser/tree/xml_parser/paragraph_processor.py", line 61, in select_depth
    depths = fn(depths, weight)
  File "/home/eric/regulations-parser/regparser/tree/depth/heuristics.py", line 46, in prefer_shallow_depths
    min_max_depth = min(max(p.depth for p in s.assignment) for s in solutions)
ValueError: min() arg is an empty sequence
eadamsatx commented 8 years ago

P.S. - I'm investigating where in that huge stack trace the offending data is coming from right now; hoping to make a similar change to the one you suggested wherever I find it.

cmc333333 commented 8 years ago

Ah, yep that's a completely unrelated error :) It looks like one of the final rules you're working with uses a construct like:

<STARS/>
<P>(a) ...</P>
<P>(1) ...</P>
...

This is throwing off depth parsing (which determines what paragraphs are children of what other paragraphs) because the STARS are supposed to take up "space". You can probably figure out which rule is causing the problem by looking at the output, but if not, you can try dropping into a debugger:

eregs --debug pipeline ....

You can hop up a few levels (using the up command) and look for the version id (probably in a doc_number variable). You can then search for this document on the Federal Register to look at the original XML and see if it makes more sense to change the document or the parser.

That's a lot of hoops, though! I'll try to take a crack today or tomorrow to see if this is a simple fix.

cmc333333 commented 8 years ago

@eadamsatx Bad news/good news situation. The bad news is that this wasn't a great introduction to the code base; these bugs required some intimate knowledge of what's going on behind the scenes to figure out. Sorry about that.

The good news, though, is that I've got a working patch: #330! Please try it out and feel free to share comments.

eadamsatx commented 7 years ago

Thanks a bunch! Indeed, #330 did the trick for the since-first-annual-edition versions. My work on this project is somewhat sporadic, but I'm definitely driving toward a solution.

Do you know what can be done for the before-first-annual-edition diffs? Even pointing me toward relevant documentation would be very helpful.

cmc333333 commented 7 years ago

Sure thing. One of the first questions we'll need to answer is how far back do we need to go. If we just want 2012-17900 onward (i.e. all of the digital rules), we're in luck. In that scenario, we'd just need to create a version associated with the 2012 annual edition and then let the parser fill in the details afterwards. The best way to get started here would be to copy-paste the regparser/commands/current_version.py command to a new command and allow it to take a year argument (to fetch a particular annual edition and build a version of the regulation based on that annual edition). Once that was working, you could:

  1. Run that command to get the 2012 version of 37 CFR 42
  2. Run eregs pipeline to build everything that followed If that worked out, we'd probably want to replace the current_version command with that more flexible version.

If we need to go back before 2012-17900 but after roughly 2000, we could use that same command to build one version for each annual edition. We wouldn't get all of the nuances throughout the year, but we'd have at least one version per year. If we absolutely needed that finer-grained history, we'd need to write a PDF-based parser (and perhaps incorporate OCR). I'm not positive, but I'm betting there are at least scans of the relevant rules going back to 2000.

If we need to go back further than 2000, we're running into infeasible territory. We'd need to track down annual editions of the regulation, which are most likely not digitized (we'd need to scan and OCR them, with heavy manual intervention). Hypothetically, we could do the same for the Federal Register's rules, but that seems even less doable.

eadamsatx commented 7 years ago

Good news, then: I’m trying to go back to 2012.

Making a derivative command from current_version.py with another int param for year is quite simple. I did that, and immediately started getting MissingDependency errors when we hit deps.validate_for(tree_entry) in that same file. Specifically regparser.index.dependency.Missing: Missing dependency. .eregs_index/annual/37/42/2012 is needed for .eregs_index/tree/37/42/2012-annual-42. I tried a previously-successful trick of “not raising on Missing” but we attempt to query the DB for a 2012 annual edition as one of our immediate next tasks.

I eventually found the regparser/web/db.sqlite3 db and did this:

sqlite> select * from index_entry where label_id = '.eregs_index/version/37/42/2012-annual-42';
.eregs_index/version/37/42/2012-annual-42|2016-11-27 05:11:27.646182|{"published": "2012-07-01", "identifier": "2012-annual-42", "effective": "2012-07-01"}

I started working backward to figure out how the dependency graph is made. dependency.Graph._graph is a networkx.DiGraph, it’s made from the full list of items in DependencyNode (for nodes) and Dependency (for edges) .. and it seems like I'm starting to go down a rabbit hole without understand a lot of the surrounding inner workings.

So that first paragraph above details the actual problem, and I tried to lay out more info I thought might be helpful, but I don't quite know how to proceed.

cmc333333 commented 7 years ago

@eadamsatx sorry for the delay -- would you mind creating a work-in-progress PR and we can take a look there?

eadamsatx commented 7 years ago

Sure, no problem. This is based on your 37-42-fixes branch. https://github.com/navigo/regulations-parser/tree/37-42-command-wip

cmc333333 commented 7 years ago

As noted in #335, the problem with the approach mentioned above (using an annual edition) is that no such annual edition exists for 2012. Instead, we'll need to import from the final rule which created 37 CFR 42.

I think we'd want a command with this interface:

eregs import_gpo_cfr 37 42 2012-17900 /path/to/file.xml

The Federal Register's xml is close enough to the annual editions that we should be able to proceed without messing around much with the actual parsing logic. Looking at the import_notice command would be a good place to start -- you'll probably want to read in the xml (as a NoticeXML will do for now), preprocess() and use that in place of annual_entry.read() here.

That's shouldn't be too hard, but may take a few tries to communicate correctly :) Let us know if we need to explain anything further.

eadamsatx commented 7 years ago

Same branch, one step closer with another commit.

eregs import_gpo_cfr 37 42 2012-17900 /home/eric/regulations-parser/edits/annual/2012-17900.xml
2016-12-04 22:19:12 regparser.history.annual                 No <PARTS> in https://www.gpo.gov/fdsys/bulkdata/CFR/2012/title-37/CFR-2012-title37-vol1.xml. Assuming this volume contains all of the regs
2016-12-04 22:19:12 regparser.commands.import_gpo_cfr        Getting current version - 37 CFR 42, Year: 2012
2016-12-04 22:19:13 regparser.tree.xml_parser.reg_text       Build tree <Element RULE at 0x7f5b1550cd08>
2016-12-04 22:19:13 regparser.tree.xml_parser.reg_text       Preprocessing XML <Element RULE at 0x7f5b1550cd08>
2016-12-04 22:19:13 regparser.content                        Could not load macros from regcontent.macros
2016-12-04 22:19:13 regparser.index.entry                    Wrote .eregs_index/tree/37/42/2012-annual-42
2016-12-04 22:19:13 regparser.index.entry                    Wrote .eregs_index/notice_xml/2012-annual-42

The subsequent pipeline command, however, failed with regparser.web.index.models.DoesNotExist: Entry matching query does not exist. on line 53 of annual_editions.py. Does that seem familiar to you?

cmc333333 commented 7 years ago

Made progress (see above PR), but ran into a bit of a wall.

When the parser's trying to process the second version, 2012-17904, it hits an instruction to add a section to subpart D. Unfortunately, there is no subpart D yet (2012-17900 only mentions subpart A). It looks like 2012-17906 adds those subparts, but is sorted after 2012-17904. The page numbers are in the proper order, however, so it looks like the way forward is to order version by (effective_date, publication_date, page number) (or perhaps (effective_date, FR volume, FR page))rather than (effective_date, publication_date, doc_number).

That's annoying, but shouldn't be terrible. Basically, we'd need to modify the Version class to also carry around FR volume/page, to serialize/deserialize those values, sort with them (__lt__), and to modify every creation of a Version to set those fields. Generally that data'd be available from a NoticeXML. Good news is that we don't create many versions -- I see four instances: one each in the full_issuance, current_version, versions, and proposal_versions commands.

Let us know if we can help there. I think we'll pull in the full_issuance command (with tests) sooner as it resolves #26.

meriouma commented 7 years ago

Hi!

I tried adding the volume and page in this commit.

I end up with this error :

 File "regulations-parser/regparser/index/entry.py", line 54, in read
return self.deserialize(bytes(buffered_contents))
  File "regulations-parser/regparser/index/entry.py", line 107, in deserialize
    return VersionStruct.from_json(content.decode('utf-8'))
  File "regulations-parser/regparser/history/versions.py", line 34, in from_json
    return Version(**json_dict)
TypeError: __new__() missing 2 required positional arguments: 'volume' and 'page'

For some reason it goes through the from_json method without going through the json method before. I tried to find how the write process works, but I'm kinda lost at this point. Do you have any insight that could get me in the right direction?

Thanks!

cmc333333 commented 7 years ago

Hey @meriouma, thanks for giving it a go. The build process is incremental, meaning that computations are cached between steps in case something fails later. Try clearing the build cache first:

eregs clear
meriouma commented 7 years ago

Ah, makes sense. Thanks!

I believe it worked and the versions are sorted in the correct order, I'm now getting this in the logs :

regparser.commands.fill_with_rules       No previous annual edition to version 2012-17900; ignoring
regparser.commands.fill_with_rules       No previous annual edition to version 2012-17906; ignoring
regparser.commands.fill_with_rules       No previous annual edition to version 2012-17904; ignoring
regparser.commands.fill_with_rules       No previous annual edition to version 2012-17908; ignoring
regparser.commands.fill_with_rules       No previous annual edition to version 2012-22204; ignoring
regparser.commands.fill_with_rules       No previous annual edition to version 2013-00819; ignoring

I'm not sure what should be the next steps though... as it's still ignoring those versions

cmc333333 commented 7 years ago

Nice work, @meriouma. We've got a few different branches going -- try to rebase off https://github.com/navigo/regulations-parser/pull/1 (that also includes some commands to run). I'll try to PR that to upstream with some tests this weekend to detangle.

meriouma commented 7 years ago

Alright thanks. I'm working off this branch, which includes https://github.com/navigo/regulations-parser/pull/1, but also https://github.com/cmc333333/regulations-parser/tree/37-42-fixes

cmc333333 commented 7 years ago

Awesome! Sorry, I should have looked more closely. You should just need to run full_issuance first, then pipeline should do it's thing. If you run into problems, try clearing. Let us know how it goes!

meriouma commented 7 years ago

No worries, I only mentionned a commit. Running clear, then full_issuance, then pipeline yields this traceback :

Traceback (most recent call last):
  File "regulations-parser/regparser/commands/retry.py", line 57, i                                                                                                       n run_or_resolve
    cmd()
  File "regulations-parser/regparser/commands/retry.py", line 47, i                                                                                                       n <lambda>
    lambda: super(RetryingCommand, self).invoke(deepcopy(ctx)))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/decorators.py"                                                                                                       , line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "regulations-parser/regparser/commands/pipeline.py", line 34                                                                                                       , in pipeline
    ctx.invoke(versions, **params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "regulations-parser/regparser/commands/versions.py", line 10                                                                                                       5, in versions
    write_if_needed(cfr_title, cfr_part, version_ids, xmls, delays_by_version)
  File "regulations-parser/regparser/commands/versions.py", line 81                                                                                                       , in write_if_needed
    deps.validate_for(version_entry)
  File "regulations-parser/regparser/index/dependency.py", line 113                                                                                                       , in validate_for
    raise Missing(key, self.node(dependency)['stale'])
regparser.index.dependency.Missing: Missing dependency. .eregs_index/notice_xml/                                                                                                       2012-17908 is needed for .eregs_index/version/37/42/2012-17908

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "regulations-parser/regparser/commands/retry.py", line 57, i                                                                                                       n run_or_resolve
    cmd()
  File "regulations-parser/regparser/commands/retry.py", line 47, i                                                                                                       n <lambda>
    lambda: super(RetryingCommand, self).invoke(deepcopy(ctx)))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/decorators.py"                                                                                                       , line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "regulations-parser/regparser/commands/pipeline.py", line 34                                                                                                       , in pipeline
    ctx.invoke(versions, **params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "regulations-parser/regparser/commands/versions.py", line 10                                                                                                       5, in versions
    write_if_needed(cfr_title, cfr_part, version_ids, xmls, delays_by_version)
  File "regulations-parser/regparser/commands/versions.py", line 81                                                                                                       , in write_if_needed
    deps.validate_for(version_entry)
  File "regulations-parser/regparser/index/dependency.py", line 113                                                                                                       , in validate_for
    raise Missing(key, self.node(dependency)['stale'])
regparser.index.dependency.Missing: Missing dependency. .eregs_index/notice_xml/                                                                                                       2012-17904 is needed for .eregs_index/version/37/42/2012-17904

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "regulations-parser/regparser/commands/retry.py", line 57, i                                                                                                       n run_or_resolve
    cmd()
  File "regulations-parser/regparser/commands/retry.py", line 47, i                                                                                                       n <lambda>
    lambda: super(RetryingCommand, self).invoke(deepcopy(ctx)))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/decorators.py"                                                                                                       , line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "regulations-parser/regparser/commands/pipeline.py", line 34                                                                                                       , in pipeline
    ctx.invoke(versions, **params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "regulations-parser/regparser/commands/versions.py", line 10                                                                                                       5, in versions
    write_if_needed(cfr_title, cfr_part, version_ids, xmls, delays_by_version)
  File "regulations-parser/regparser/commands/versions.py", line 81                                                                                                       , in write_if_needed
    deps.validate_for(version_entry)
  File "regulations-parser/regparser/index/dependency.py", line 113                                                                                                       , in validate_for
    raise Missing(key, self.node(dependency)['stale'])
regparser.index.dependency.Missing: Missing dependency. .eregs_index/notice_xml/                                                                                                       2012-17906 is needed for .eregs_index/version/37/42/2012-17906

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "regulations-parser/regparser/commands/retry.py", line 57, i                                                                                                       n run_or_resolve
    cmd()
  File "regulations-parser/regparser/commands/retry.py", line 47, i                                                                                                       n <lambda>
    lambda: super(RetryingCommand, self).invoke(deepcopy(ctx)))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/decorators.py"                                                                                                       , line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "regulations-parser/regparser/commands/pipeline.py", line 34                                                                                                       , in pipeline
    ctx.invoke(versions, **params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "regulations-parser/regparser/commands/versions.py", line 10                                                                                                       5, in versions
    write_if_needed(cfr_title, cfr_part, version_ids, xmls, delays_by_version)
  File "regulations-parser/regparser/commands/versions.py", line 81                                                                                                       , in write_if_needed
    deps.validate_for(version_entry)
  File "regulations-parser/regparser/index/dependency.py", line 113                                                                                                       , in validate_for
    raise Missing(key, self.node(dependency)['stale'])
regparser.index.dependency.Missing: Missing dependency. .eregs_index/notice_xml/                                                                                                       2012-22204 is needed for .eregs_index/version/37/42/2012-22204

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "regulations-parser/regparser/commands/retry.py", line 57, i                                                                                                       n run_or_resolve
    cmd()
  File "regulations-parser/regparser/commands/retry.py", line 47, i                                                                                                       n <lambda>
    lambda: super(RetryingCommand, self).invoke(deepcopy(ctx)))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/decorators.py"                                                                                                       , line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "regulations-parser/regparser/commands/pipeline.py", line 34                                                                                                       , in pipeline
    ctx.invoke(versions, **params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "regulations-parser/regparser/commands/versions.py", line 10                                                                                                       5, in versions
    write_if_needed(cfr_title, cfr_part, version_ids, xmls, delays_by_version)
  File "regulations-parser/regparser/commands/versions.py", line 81                                                                                                       , in write_if_needed
    deps.validate_for(version_entry)
  File "regulations-parser/regparser/index/dependency.py", line 113                                                                                                       , in validate_for
    raise Missing(key, self.node(dependency)['stale'])
regparser.index.dependency.Missing: Missing dependency. .eregs_index/notice_xml/                                                                                                       2013-00819 is needed for .eregs_index/version/37/42/2013-00819

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "regulations-parser/regparser/commands/retry.py", line 57, i                                                                                                       n run_or_resolve
    cmd()
  File "regulations-parser/regparser/commands/retry.py", line 47, i                                                                                                       n <lambda>
    lambda: super(RetryingCommand, self).invoke(deepcopy(ctx)))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/decorators.py"                                                                                                       , line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "regulations-parser/regparser/commands/pipeline.py", line 34                                                                                                       , in pipeline
    ctx.invoke(versions, **params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "regulations-parser/regparser/commands/versions.py", line 10                                                                                                       5, in versions
    write_if_needed(cfr_title, cfr_part, version_ids, xmls, delays_by_version)
  File "regulations-parser/regparser/commands/versions.py", line 81                                                                                                       , in write_if_needed
    deps.validate_for(version_entry)
  File "regulations-parser/regparser/index/dependency.py", line 113                                                                                                       , in validate_for
    raise Missing(key, self.node(dependency)['stale'])
regparser.index.dependency.Missing: Missing dependency. .eregs_index/notice_xml/                                                                                                       2013-06768 is needed for .eregs_index/version/37/42/2013-06768

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "regulations-parser/regparser/commands/retry.py", line 57, i                                                                                                       n run_or_resolve
    cmd()
  File "regulations-parser/regparser/commands/retry.py", line 47, i                                                                                                       n <lambda>
    lambda: super(RetryingCommand, self).invoke(deepcopy(ctx)))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/decorators.py"                                                                                                       , line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "regulations-parser/regparser/commands/pipeline.py", line 34                                                                                                       , in pipeline
    ctx.invoke(versions, **params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "regulations-parser/regparser/commands/versions.py", line 10                                                                                                       5, in versions
    write_if_needed(cfr_title, cfr_part, version_ids, xmls, delays_by_version)
  File "regulations-parser/regparser/commands/versions.py", line 81                                                                                                       , in write_if_needed
    deps.validate_for(version_entry)
  File "regulations-parser/regparser/index/dependency.py", line 113                                                                                                       , in validate_for
    raise Missing(key, self.node(dependency)['stale'])
regparser.index.dependency.Missing: Missing dependency. .eregs_index/notice_xml/                                                                                                       2014-24891 is needed for .eregs_index/version/37/42/2014-24891

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "regulations-parser/regparser/commands/retry.py", line 57, i                                                                                                       n run_or_resolve
    cmd()
  File "regulations-parser/regparser/commands/retry.py", line 47, i                                                                                                       n <lambda>
    lambda: super(RetryingCommand, self).invoke(deepcopy(ctx)))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/decorators.py"                                                                                                       , line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "regulations-parser/regparser/commands/pipeline.py", line 34                                                                                                       , in pipeline
    ctx.invoke(versions, **params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "regulations-parser/regparser/commands/versions.py", line 10                                                                                                       5, in versions
    write_if_needed(cfr_title, cfr_part, version_ids, xmls, delays_by_version)
  File "regulations-parser/regparser/commands/versions.py", line 81                                                                                                       , in write_if_needed
    deps.validate_for(version_entry)
  File "regulations-parser/regparser/index/dependency.py", line 113                                                                                                       , in validate_for
    raise Missing(key, self.node(dependency)['stale'])
regparser.index.dependency.Missing: Missing dependency. .eregs_index/notice_xml/                                                                                                       2015-12117 is needed for .eregs_index/version/37/42/2015-12117

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "regulations-parser/regparser/commands/retry.py", line 57, i                                                                                                       n run_or_resolve
    cmd()
  File "regulations-parser/regparser/commands/retry.py", line 47, i                                                                                                       n <lambda>
    lambda: super(RetryingCommand, self).invoke(deepcopy(ctx)))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/decorators.py"                                                                                                       , line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "regulations-parser/regparser/commands/pipeline.py", line 34                                                                                                       , in pipeline
    ctx.invoke(versions, **params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "regulations-parser/regparser/commands/versions.py", line 10                                                                                                       5, in versions
    write_if_needed(cfr_title, cfr_part, version_ids, xmls, delays_by_version)
  File "regulations-parser/regparser/commands/versions.py", line 81                                                                                                       , in write_if_needed
    deps.validate_for(version_entry)
  File "regulations-parser/regparser/index/dependency.py", line 113                                                                                                       , in validate_for
    raise Missing(key, self.node(dependency)['stale'])
regparser.index.dependency.Missing: Missing dependency. .eregs_index/notice_xml/                                                                                                       C1-2015-12117 is needed for .eregs_index/version/37/42/C1-2015-12117

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "regulations-parser/regparser/commands/retry.py", line 57, i                                                                                                       n run_or_resolve
    cmd()
  File "regulations-parser/regparser/commands/retry.py", line 47, i                                                                                                       n <lambda>
    lambda: super(RetryingCommand, self).invoke(deepcopy(ctx)))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/decorators.py"                                                                                                       , line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "regulations-parser/regparser/commands/pipeline.py", line 34                                                                                                       , in pipeline
    ctx.invoke(versions, **params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "regulations-parser/regparser/commands/versions.py", line 10                                                                                                       5, in versions
    write_if_needed(cfr_title, cfr_part, version_ids, xmls, delays_by_version)
  File "regulations-parser/regparser/commands/versions.py", line 81                                                                                                       , in write_if_needed
    deps.validate_for(version_entry)
  File "regulations-parser/regparser/index/dependency.py", line 113                                                                                                       , in validate_for
    raise Missing(key, self.node(dependency)['stale'])
regparser.index.dependency.Missing: Missing dependency. .eregs_index/notice_xml/                                                                                                       2016-07381 is needed for .eregs_index/version/37/42/2016-07381

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "regulations-parser/regparser/commands/retry.py", line 57, i                                                                                                       n run_or_resolve
    cmd()
  File "regulations-parser/regparser/commands/retry.py", line 47, i                                                                                                       n <lambda>
    lambda: super(RetryingCommand, self).invoke(deepcopy(ctx)))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/decorators.py"                                                                                                       , line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "regulations-parser/regparser/commands/pipeline.py", line 34                                                                                                       , in pipeline
    ctx.invoke(versions, **params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "regulations-parser/regparser/commands/versions.py", line 10                                                                                                       5, in versions
    write_if_needed(cfr_title, cfr_part, version_ids, xmls, delays_by_version)
  File "regulations-parser/regparser/commands/versions.py", line 81                                                                                                       , in write_if_needed
    deps.validate_for(version_entry)
  File "regulations-parser/regparser/index/dependency.py", line 113                                                                                                       , in validate_for
    raise Missing(key, self.node(dependency)['stale'])
regparser.index.dependency.Missing: Missing dependency. .eregs_index/notice_xml/                                                                                                       2016-09814 is needed for .eregs_index/version/37/42/2016-09814

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "regulations-parser/regparser/commands/retry.py", line 57, i                                                                                                       n run_or_resolve
    cmd()
  File "regulations-parser/regparser/commands/retry.py", line 47, i                                                                                                       n <lambda>
    lambda: super(RetryingCommand, self).invoke(deepcopy(ctx)))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/decorators.py"                                                                                                       , line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "regulations-parser/regparser/commands/pipeline.py", line 35                                                                                                       , in pipeline
    ctx.invoke(annual_editions, **params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "regulations-parser/regparser/commands/annual_editions.py",                                                                                                        line 65, in annual_editions
    process_if_needed(cfr_title, cfr_part, versions)
  File "regulations-parser/regparser/commands/annual_editions.py",                                                                                                        line 50, in process_if_needed
    deps.validate_for(tree_entry)
  File "regulations-parser/regparser/index/dependency.py", line 113                                                                                                       , in validate_for
    raise Missing(key, self.node(dependency)['stale'])
regparser.index.dependency.Missing: Missing dependency. .eregs_index/annual/37/4                                                                                                       2/2013 is needed for .eregs_index/tree/37/42/2013-06768

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "regulations-parser/regparser/commands/retry.py", line 57, i                                                                                                       n run_or_resolve
    cmd()
  File "regulations-parser/regparser/commands/retry.py", line 47, i                                                                                                       n <lambda>
    lambda: super(RetryingCommand, self).invoke(deepcopy(ctx)))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/decorators.py"                                                                                                       , line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "regulations-parser/regparser/commands/pipeline.py", line 35                                                                                                       , in pipeline
    ctx.invoke(annual_editions, **params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "regulations-parser/regparser/commands/annual_editions.py",                                                                                                        line 65, in annual_editions
    process_if_needed(cfr_title, cfr_part, versions)
  File "regulations-parser/regparser/commands/annual_editions.py",                                                                                                        line 50, in process_if_needed
    deps.validate_for(tree_entry)
  File "regulations-parser/regparser/index/dependency.py", line 113                                                                                                       , in validate_for
    raise Missing(key, self.node(dependency)['stale'])
regparser.index.dependency.Missing: Missing dependency. .eregs_index/annual/37/4                                                                                                       2/2015 is needed for .eregs_index/tree/37/42/2015-12117

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/virtual_env/parser/bin/eregs", line 9, in <module>
    load_entry_point('regparser', 'console_scripts', 'eregs')()
  File "regulations-parser/eregs.py", line 9, in main
    manage.main(args)
  File "regulations-parser/manage.py", line 15, in main
    execute_from_command_line(argv)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/django/core/manageme                                                                                                       nt/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/django/core/manageme                                                                                                       nt/__init__.py", line 345, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/djclick/adapter.py",                                                                                                        line 35, in run_from_argv
    return self.main(args=argv[2:], standalone_mode=False)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        696, in main
    rv = self.invoke(ctx)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/djclick/adapter.py",                                                                                                        line 23, in invoke
    return super(DjangoCommandMixin, self).invoke(ctx)
  File "regulations-parser/regparser/commands/retry.py", line 47, i                                                                                                       n invoke
    lambda: super(RetryingCommand, self).invoke(deepcopy(ctx)))
  File "regulations-parser/regparser/commands/retry.py", line 68, i                                                                                                       n run_or_resolve
    run_or_resolve(cmd, e.dependency)
  File "regulations-parser/regparser/commands/retry.py", line 68, i                                                                                                       n run_or_resolve
    run_or_resolve(cmd, e.dependency)
  File "regulations-parser/regparser/commands/retry.py", line 68, i                                                                                                       n run_or_resolve
    run_or_resolve(cmd, e.dependency)
  File "regulations-parser/regparser/commands/retry.py", line 68, i                                                                                                       n run_or_resolve
    run_or_resolve(cmd, e.dependency)
  File "regulations-parser/regparser/commands/retry.py", line 68, i                                                                                                       n run_or_resolve
    run_or_resolve(cmd, e.dependency)
  File "regulations-parser/regparser/commands/retry.py", line 68, i                                                                                                       n run_or_resolve
    run_or_resolve(cmd, e.dependency)
  File "regulations-parser/regparser/commands/retry.py", line 68, i                                                                                                       n run_or_resolve
    run_or_resolve(cmd, e.dependency)
  File "regulations-parser/regparser/commands/retry.py", line 68, i                                                                                                       n run_or_resolve
    run_or_resolve(cmd, e.dependency)
  File "regulations-parser/regparser/commands/retry.py", line 68, i                                                                                                       n run_or_resolve
    run_or_resolve(cmd, e.dependency)
  File "regulations-parser/regparser/commands/retry.py", line 68, i                                                                                                       n run_or_resolve
    run_or_resolve(cmd, e.dependency)
  File "regulations-parser/regparser/commands/retry.py", line 68, i                                                                                                       n run_or_resolve
    run_or_resolve(cmd, e.dependency)
  File "regulations-parser/regparser/commands/retry.py", line 68, i                                                                                                       n run_or_resolve
    run_or_resolve(cmd, e.dependency)
  File "regulations-parser/regparser/commands/retry.py", line 68, i                                                                                                       n run_or_resolve
    run_or_resolve(cmd, e.dependency)
  File "regulations-parser/regparser/commands/retry.py", line 57, i                                                                                                       n run_or_resolve
    cmd()
  File "regulations-parser/regparser/commands/retry.py", line 47, i                                                                                                       n <lambda>
    lambda: super(RetryingCommand, self).invoke(deepcopy(ctx)))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/decorators.py"                                                                                                       , line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "regulations-parser/regparser/commands/pipeline.py", line 36                                                                                                       , in pipeline
    ctx.invoke(fill_with_rules, **params)
  File "/opt/virtual_env/parser/lib/python3.5/site-packages/click/core.py", line                                                                                                        534, in invoke
    return callback(*args, **kwargs)
  File "regulations-parser/regparser/commands/fill_with_rules.py",                                                                                                        line 89, in fill_with_rules
    process(tree_dir, parent_id, version_id)
  File "regulations-parser/regparser/commands/fill_with_rules.py",                                                                                                        line 64, in process
    new_tree = compile_regulation(prev_tree, notice_changes)
  File "regulations-parser/regparser/notice/compiler.py", line 515,                                                                                                        in compile_regulation
    one_change(reg, label, change)
  File "regulations-parser/regparser/notice/compiler.py", line 458,                                                                                                        in one_change
    reg.add_node(node, change.get('parent_label'))
  File "regulations-parser/regparser/notice/compiler.py", line 337,                                                                                                        in add_node
    getattr(parent, 'child_labels', []))
  File "regulations-parser/regparser/notice/compiler.py", line 201,                                                                                                        in add_child
    insert_idx = bisect(sort_order, new_el_sort)
TypeError: unorderable types: str() < int()
cmc333333 commented 7 years ago

@meriouma now we're getting somewhere. Try running

eregs --debug pipeline [other args]

This will drop you into an ipdb session, where you can poke at variables and move up or down the callstack. It looks like we're trying to add in a node (i.e. a section, paragraph, etc.) in a way that's not sortable with its neighbors. Try inspecting the change (two levels up) and take a look at the version_id (5 levels up). You can search for that id at http://federalregister.gov/ to read the respective final rule.

I'll be able to help out with more concrete findings a bit later, but hopefully that's enough to get you started!

meriouma commented 7 years ago

Seems that TypeError: unorderable types: str() < int() happens with python3. I setup a new environment with python2.7 and it goes through, although we still can't produce a diff for any of the 2012 versions. Do you have any insight on what could be the next steps?

cmc333333 commented 7 years ago

@meriouma the changes in navigo/regulations-parser#2 are leading to a full parse for 37 CFR 42 for me, but I haven't checked out the UI. I suspect that the Python version was a red herring. Let us know if this works!

meriouma commented 7 years ago

Thanks for that new patch! Maybe my last comment was misleading. The parser seems to do a full parse, but it's not showing in the UI. Is it the parser that is not creating the 2012 version in the site? I'm not sure where I should start debugging. I'm running eregs pipeline 37 42 http://localhost:8080 Thanks!

cmc333333 commented 7 years ago

You'll need to run the full_issuance command to get that first tree, otherwise pipeline will skip versions until the first annual edition it can find. Something that might help you debug:

eregs pipeline 37 42 some-dir
ls some-dir/regulation

This should list out all of the regulation versions the parser knows about and let you poke at them a bit.

Another common problem occurs when the same node label appears multiple times within a single version -- you'd see 500s when writing to localhost in this case. Have you checked the API's logs?

meriouma commented 7 years ago

I tried with

eregs clear
eregs full_issuance 37 42 2012-17900
eregs pipeline 37 42 http://localhost:8080

but still nothing in the UI. As far as I can tell, I couldn't see any 500. I'll try to output to a directory to poke around and try to find what could be missing

cmc333333 commented 7 years ago

@meriouma I'm definitely seeing 500s:

WARNING:root:Repeat label: (u'42', u'Subpart', u'A')
Internal Server Error: /api/regulation/42/2012-17900

Looks like 2012-17900 does indeed have two Subpart A's. I'm betting we're accidentally including the Subpart A from the table of contents when parsing. Quicker reproduction:

eregs clear
eregs full_issuance 37 42 2012-17900
eregs write_to some-dir
grep "Subpart" some-dir/regulation/42/2012-17900    # Should be 1 entry, but has 2

Will need to spelunk around a bit to see where the TOC is removed/ignored in other documents.

meriouma commented 7 years ago

Wow, thanks. Not sure why I didn't see those errors..

cmc333333 commented 7 years ago

@meriouma I think navigo/regulations-parser#3 will get you all the way through. Note that UI combines versions which become final on the same day together. You can still look at the diffs by swapping version ids in the URLs, though.

cmc333333 commented 7 years ago

Hey there @meriouma -- did that work? If all's good, We'll get the code into master and add an regression test for 37 CFR 42.

meriouma commented 7 years ago

Yes, it worked on the navigo:version_vol_page branch (which is behind this repo), thanks a lot! I forgot to post back after I debugged a few things. I tried updating from the master in this repo but it stopped working. I tried to find what change could've caused that, but I didn't find anything yet.

There error was at this line if fetch_amendments for change in changes.create_subpart_amendment(content.struct): It seems content is None but I'm not sure why.

cmc333333 commented 7 years ago

:+1: roger. There were some big refactors recently; adding regression tests will prevent that sort of inconsistency.

davidandrewryan commented 7 years ago

Closed