eregs / regulations-parser

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

37 CFR 1 - problem adding § 1.109 from FR 05-461 #383

Open gregoryfoster opened 7 years ago

gregoryfoster commented 7 years ago

(Identified by @cmc333333 in #379)

Dev environment: current master [ 8366bcf ].

The 37 CFR 1 parse currently fails on FR 05-461 when attempting to add § 1.109.

To reproduce:

eregs clear
rm -rf .eregs_index   # bug, see #382
eregs --debug pipeline 37 1 output

You'll be dropped into the debugger at regparser/notice/compiler.py:195 in add_child(). The error is reported as:

TypeError: '<' not supported between instances of 'int' and 'str'

The new_el_sort variable contains the new section number as an integer, whereas the sort_order list contains tuples composed of strings:

ipdb> p new_el_sort
(109,)
ipdb> type(new_el_sort)
<class 'tuple'>
ipdb> type(new_el_sort[0])
<class 'int'>
ipdb> type(sort_order)
<class 'list'>
ipdb> type(sort_order[0])
<class 'tuple'>
ipdb> type(sort_order[0][0])
<class 'str'>

I'm definitely not sure, but it looks like the wrong parent node(s) are given to this function (Subpart A?).