From d48e6d064f195a32f4f47bab02fb0a333b537275 Mon Sep 17 00:00:00 2001 From: benb116 Date: Tue, 2 Feb 2021 18:40:12 -0500 Subject: [PATCH 1/4] Notes --- Notes.txt | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ cleanup.py | 2 ++ 2 files changed, 53 insertions(+) create mode 100644 Notes.txt diff --git a/Notes.txt b/Notes.txt new file mode 100644 index 0000000..cffd260 --- /dev/null +++ b/Notes.txt @@ -0,0 +1,51 @@ +https://uscode.house.gov/download/download.shtml +^ Starting point + +Use cleanup.py to strip and clean + +"master" branch of the repo is USCode + all laws that have been signed + +Some parts of some laws add brand new material (i.e. not in an specific section) + Maybe have a "Statutes at Large" folder for material that hasn't been classified + As classification tables come out, move material from SAL to USC + +Much of a law is CRUD operations on existing law + Often CRUD is specified in reference to public laws (as amended), not to USC + e.g. if "section 3 of PL 116-259" is classified in 52 USC 1234, the law/amendments may say "change section 2 of the law", and section 2 will have to be translated to a USC location (maybe 52 USC 1233) + Classification table lookup could help to map one to the other. + If it says "section 123 of Short Title (23 USC 4321)", 4321 may not be the exact section + Need to consult classification table to be exact + +Will have to do language parsing + Improved if use XML of bill text + Bill and USC xml are slightly different + Patterns to find: + "
# \of
# of\ the 'Short Title' (52 U.S.C. 21081(b) \et seq.\) \, as amended by section 1031(a),\ is amended": + '-': Go into next line + '\in
#, \by redesignating # # # as # # #' + Remember to update any links/references + 'by inserting after
#': + 'the following new
': Include the node + 'by striking # # # and inserting the following' + quoted block + 'by adding at the end the following new :' + quoted block + 'by inserting at the end the following new :' + quoted block + + "
# \of
# of such Act is amended": + 'by striking at the end of
#' + 'by striking and inserting ' + 'by striking and inserting the following:' + 'by striking the period at the end of
# and inserting ' + 'by adding at the end the following new
': + Determine correct numbering and add IDs + "The table of contents\sections] of such Act" - prob ignore + +Maintain USC in XML form + Export a plaintext version? + +Each bill is a branch off of master + Any bill amendments are further commits to that bill + A merge occurs when the president signs the bill into law + diff --git a/cleanup.py b/cleanup.py index b10c2c8..4d92a4f 100644 --- a/cleanup.py +++ b/cleanup.py @@ -33,6 +33,7 @@ def cleanTitle(name): for t in removeTags: tagnodes = xmldoc.getElementsByTagName(t) if t == 'ref': + # Remove only ref tags with the idref attributes tagnodes = [x for x in tagnodes if ('idref' in x.attributes.keys())] nodes = nodes + tagnodes @@ -46,6 +47,7 @@ def cleanTitle(name): # Also remove any sections with a bad status stripAttr(xmldoc) + # Pretty print out = os.linesep.join([s for s in xmldoc.toprettyxml().strip().splitlines(True) if s.strip()]) out2 = os.linesep.join([s for s in out.splitlines() if s]) From dbdad4bdb494434f9b3b52d9c7290431745c6010 Mon Sep 17 00:00:00 2001 From: benb116 Date: Tue, 2 Feb 2021 19:11:06 -0500 Subject: [PATCH 2/4] Introduced --- Code/usc08.xml | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/Code/usc08.xml b/Code/usc08.xml index b30aa1d..1893d71 100644 --- a/Code/usc08.xml +++ b/Code/usc08.xml @@ -1859,11 +1859,18 @@ SUBCHAPTER V—ALIEN TERRORIST REMOVAL PROCEDURES (C) - - an alien in immediate and continuous transit through the United States, or an alien who qualifies as a person entitled to pass in transit to and from the United Nations Headquarters District and foreign countries, under the provisions of paragraphs (3), (4), and (5) of section 11 of the Headquarters Agreement with the United Nations ( - 61 Stat. 758 - ); - + + (i) + an alien in immediate and continuous transit through the United States not to exceed 29 days; + + + (ii) + an alien who qualifies as a person entitled to pass in transit to and from the United Nations Headquarters District and foreign countries, under the provisions of paragraphs (3), (4), and (5) of section 11 of the Headquarters Agreement with the United Nations 61 Stat. 758; or + + + (iii) + an alien passing in transit through the United States to board a vessel on which the alien will perform ship-to-ship liquid cargo transfer operations to or from another vessel engaged in foreign trade for a period not to exceed 180 days. + (D) @@ -23206,11 +23213,14 @@ SUBCHAPTER V—ALIEN TERRORIST REMOVAL PROCEDURES (1) - the period of time (not exceeding twenty-nine days) during which the vessel or aircraft on which he arrived remains in port, if the immigration officer is satisfied that the crewman intends to depart on the vessel or aircraft on which he arrived; or + the period of time (not exceeding twenty-nine days) during which the vessel or aircraft on which he arrived remains in port, if the immigration officer is satisfied that the crewman intends to depart on the vessel or aircraft on which he arrived; (2) - twenty-nine days, if the immigration officer is satisfied that the crewman intends to depart, within the period for which he is permitted to land, on a vessel or aircraft other than the one on which he arrived. + twenty-nine days, if the immigration officer is satisfied that the crewman intends to depart, within the period for which he is permitted to land, on a vessel or aircraft other than the one on which he arrived; or + + + (3)180 days, if the immigration officer is satisfied that the crewman intends to depart, within the period for which the crewman is permitted to land, on either the same vessel or on a vessel other than the vessel on which the crewman arrived and that the crewman will perform ship-to-ship liquid cargo transfer operations to or from any other vessel engaged in foreign trade during such period. From 4ebc5ae9dbbb721dc2a9b435720d263fcd3a2d1f Mon Sep 17 00:00:00 2001 From: benb116 Date: Tue, 2 Feb 2021 19:15:19 -0500 Subject: [PATCH 3/4] Test new authors Co-authored-by: Sylvia R. Garcia --- Code/usc08.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/usc08.xml b/Code/usc08.xml index 1893d71..938428a 100644 --- a/Code/usc08.xml +++ b/Code/usc08.xml @@ -23209,7 +23209,7 @@ SUBCHAPTER V—ALIEN TERRORIST REMOVAL PROCEDURES No alien crewman shall be permitted to land temporarily in the United States except as provided in this section and sections 1182(d)(3), (5) and 1283 of this title. If an immigration officer finds upon examination that an alien crewman is a nonimmigrant under paragraph (15)(D) of section 1101(a) of this title - and is otherwise admissible and has agreed to accept such permit, he may, in his discretion, grant the crewman a conditional permit to land temporarily pursuant to regulations prescribed by the Attorney General, subject to revocation in subsequent proceedings as provided in subsection (b), and for a period of time, in any event, not to exceed— + and is otherwise admissible and has agreed to accept such permit, he may, in his discretion, grant the crewman a conditional permit to land temporarily pursuant to regulations prescribed by the Attorney General, subject to revocation in subsequent proceedings as provided in subsection (b), and for a period of time, in any event, not to exceed— (1) From d56eeba275b8d827854b4bcf2d83f05bb97d875e Mon Sep 17 00:00:00 2001 From: benb116 Date: Tue, 2 Feb 2021 19:16:29 -0500 Subject: [PATCH 4/4] Test authors Co-authored-by: Cedric L. Richmond --- Code/usc08.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/usc08.xml b/Code/usc08.xml index 938428a..1893d71 100644 --- a/Code/usc08.xml +++ b/Code/usc08.xml @@ -23209,7 +23209,7 @@ SUBCHAPTER V—ALIEN TERRORIST REMOVAL PROCEDURES No alien crewman shall be permitted to land temporarily in the United States except as provided in this section and sections 1182(d)(3), (5) and 1283 of this title. If an immigration officer finds upon examination that an alien crewman is a nonimmigrant under paragraph (15)(D) of section 1101(a) of this title - and is otherwise admissible and has agreed to accept such permit, he may, in his discretion, grant the crewman a conditional permit to land temporarily pursuant to regulations prescribed by the Attorney General, subject to revocation in subsequent proceedings as provided in subsection (b), and for a period of time, in any event, not to exceed— + and is otherwise admissible and has agreed to accept such permit, he may, in his discretion, grant the crewman a conditional permit to land temporarily pursuant to regulations prescribed by the Attorney General, subject to revocation in subsequent proceedings as provided in subsection (b), and for a period of time, in any event, not to exceed— (1)