Policy: US trade documents
Overview › Data acquisition › Policy
- Included: the collection script, the selection rule, the link-extraction code, the frozen input with the full text of the 601 documents of the first collection and the output links (in cascade_link_extraction.zip).
- The link step (level A) was re-run from the frozen input and gives the delivered links. The collection (level C) depends on the live Federal Register API and, at another time, gives a different result: documents are added and corrected.
- The data were collected in October 2026 (to 18 Oct 2026).
- 1 Source
- 2 Selecting the events
- 3 Extracting the links
- 4 Dates and windows
- 5 Package and parameters
- 6 Parameters of this domain
- 7 Limits
1. Source
Documents of the US government are published in the Federal Register. Its public API gives, for each document, the metadata (type, agency, signing and publication date, executive order or proclamation number, citation volume and pages) and a link to the raw text.
The Federal Register API (https://www.federalregister.gov/api/v1/documents.json) provides the metadata and a link to the raw text of each document. We collect (1) all presidential documents (type PRESDOCU) signed from 20 January 2017 to 18 October 2026, (2) all documents of the Office of the United States Trade Representative, and (3) the documents of the Bureau of Industry and Security whose title matches a trade keyword pattern. Then we download the raw text of every document. The three terms are the first Trump term (to 19 January 2021), the Biden term and the second Trump term.
collect_federal_register.pydownload
import requests, json, time, re
from concurrent.futures import ThreadPoolExecutor
U="https://www.federalregister.gov/api/v1/documents.json"
F=["title","document_number","signing_date","publication_date","executive_order_number","proclamation_number","raw_text_url","html_url","citation","volume","start_page","end_page","type"]
def pull(params):
out=[];url=U;p=dict(params);p["per_page"]=200;p["order"]="oldest";p["fields[]"]=F
while url:
for i in range(4):
try:
r=requests.get(url,params=p,timeout=60);r.raise_for_status();break
except Exception: time.sleep(3)
j=r.json();out+=j["results"];url=j.get("next_page_url");p=None
return out
def get(x):
for i in range(5):
try:
r=requests.get(x['raw_text_url'],timeout=60)
if r.status_code==200 and r.text.strip(): return x['document_number'],r.text
except Exception: pass
time.sleep(2+i*2)
return x['document_number'],''
START,END='2017-01-20','2026-10-18'
# presidential with page info
pres=pull({"conditions[type][]":"PRESDOCU","conditions[signing_date][gte]":START,"conditions[signing_date][lte]":END})
json.dump(pres,open('pres_all_meta.json','w'));print('pres',len(pres),flush=True)
ustr=pull({"conditions[agencies][]":"trade-representative-office-of-united-states","conditions[publication_date][gte]":START,"conditions[publication_date][lte]":END})
json.dump(ustr,open('ustr_meta.json','w'));print('ustr',len(ustr),flush=True)
bis=pull({"conditions[agencies][]":"industry-and-security-bureau","conditions[publication_date][gte]":START,"conditions[publication_date][lte]":END})
KW=re.compile(r'section 232|steel|alumin|tariff|duties|import|derivative|exclusion|inclusion|copper|lumber|timber|autom|semiconductor|pharmaceutical|critical mineral|truck|solar',re.I)
bis=[x for x in bis if KW.search(x['title'] or '')]
json.dump(bis,open('bis_meta.json','w'));print('bis filtered',len(bis),flush=True)
todo=ustr+bis
with ThreadPoolExecutor(4) as ex: txt=dict(ex.map(get,todo))
json.dump(txt,open('agency_text.json','w'));print('texts',sum(1 for v in txt.values() if v),'of',len(todo),flush=True)
# presidential text for 2017-2026 reuse existing; fetch missing ones
have={}
for f in ['trump1_text.json','biden_text.json','fr_text.json']: have.update(json.load(open(f)))
miss=[x for x in pres if not have.get(x['document_number'])]
with ThreadPoolExecutor(4) as ex: add=dict(ex.map(get,miss))
have.update(add);json.dump(have,open('pres_all_text.json','w'));print('pres texts',sum(1 for x in pres if have.get(x['document_number'])),'of',len(pres),flush=True)
print('done')
An earlier script for the two earlier terms: collect_presidential_periods.py (1 KB)
| What | Address | Note |
|---|---|---|
| Search of documents | https://www.federalregister.gov/api/v1/documents.json not re-checked | GET; parameters conditions[type][], conditions[agencies][], conditions[signing_date][gte|lte], conditions[publication_date][gte|lte], fields[], per_page (200), order (oldest); the answer has next_page_url for the next page |
| Documentation of the API | https://www.federalregister.gov/developers/documentation/api/v1 not re-checked | – |
| Raw text of a document | the field raw_text_url of each result (a www.federalregister.gov/documents/full_text/text/… address) | plain text of the published document |
| Agency slugs used | trade-representative-office-of-united-states, industry-and-security-bureau | document type for the presidential documents: PRESDOCU |
| Licence | works of the United States government | – |
No key is needed. The script retries four times with a pause of 3 seconds for a page and five times for a text, and reads the texts with 4 parallel threads. Presidential texts of earlier terms that were already collected are reused (trump1_text.json, biden_text.json, fr_text.json of the pilot).
collect_federal_register.pydownload
import requests, json, time, re
from concurrent.futures import ThreadPoolExecutor
U="https://www.federalregister.gov/api/v1/documents.json"
F=["title","document_number","signing_date","publication_date","executive_order_number","proclamation_number","raw_text_url","html_url","citation","volume","start_page","end_page","type"]
def pull(params):
out=[];url=U;p=dict(params);p["per_page"]=200;p["order"]="oldest";p["fields[]"]=F
while url:
for i in range(4):
try:
r=requests.get(url,params=p,timeout=60);r.raise_for_status();break
except Exception: time.sleep(3)
j=r.json();out+=j["results"];url=j.get("next_page_url");p=None
return out
def get(x):
for i in range(5):
try:
r=requests.get(x['raw_text_url'],timeout=60)
if r.status_code==200 and r.text.strip(): return x['document_number'],r.text
except Exception: pass
time.sleep(2+i*2)
return x['document_number'],''
START,END='2017-01-20','2026-10-18'
# presidential with page info
pres=pull({"conditions[type][]":"PRESDOCU","conditions[signing_date][gte]":START,"conditions[signing_date][lte]":END})
json.dump(pres,open('pres_all_meta.json','w'));print('pres',len(pres),flush=True)
ustr=pull({"conditions[agencies][]":"trade-representative-office-of-united-states","conditions[publication_date][gte]":START,"conditions[publication_date][lte]":END})
json.dump(ustr,open('ustr_meta.json','w'));print('ustr',len(ustr),flush=True)
bis=pull({"conditions[agencies][]":"industry-and-security-bureau","conditions[publication_date][gte]":START,"conditions[publication_date][lte]":END})
KW=re.compile(r'section 232|steel|alumin|tariff|duties|import|derivative|exclusion|inclusion|copper|lumber|timber|autom|semiconductor|pharmaceutical|critical mineral|truck|solar',re.I)
bis=[x for x in bis if KW.search(x['title'] or '')]
json.dump(bis,open('bis_meta.json','w'));print('bis filtered',len(bis),flush=True)
todo=ustr+bis
with ThreadPoolExecutor(4) as ex: txt=dict(ex.map(get,todo))
json.dump(txt,open('agency_text.json','w'));print('texts',sum(1 for v in txt.values() if v),'of',len(todo),flush=True)
# presidential text for 2017-2026 reuse existing; fetch missing ones
have={}
for f in ['trump1_text.json','biden_text.json','fr_text.json']: have.update(json.load(open(f)))
miss=[x for x in pres if not have.get(x['document_number'])]
with ThreadPoolExecutor(4) as ex: add=dict(ex.map(get,miss))
have.update(add);json.dump(have,open('pres_all_text.json','w'));print('pres texts',sum(1 for x in pres if have.get(x['document_number'])),'of',len(pres),flush=True)
print('done')
An earlier script for the two earlier terms: collect_presidential_periods.py (1 KB)
2. Selecting the events
An event is a document. The selection is a rule on the title and the text: a document is kept if the title matches the trade pattern, or if the text contains at least three matches. The rule is simple and published; it is not a reader's judgement.
A document is an event if its title matches the trade pattern tariff | ad valorem | harmonized tariff | section 232 | section 301 | reciprocal | de minimis | duties, or if its text has at least three matches. This gives 599 documents in the package: 173 presidential documents, 336 USTR notices and 90 BIS notices. The first collection returned 601 documents; version 0.2 of the package is a repair of the files of version 0.1 (see Data packages, section 5.3). Documents that concern trade but do not match the pattern are missing.
3. Extracting the links
A link goes from the cited (earlier) document to the citing (later) document. The citation is found in the text by an executive-order or proclamation number, or by a Federal Register page. A verb stem within 220 characters of the citation (amend, modif, supplement, revok, terminat, suspend, extend, continu, replac, rescind, adjust, expand, exempt, reduc, increas, implement, retaliat, exclusion, inclusion and others; the full pattern is in the manifest and the code) makes it an amendment_reference, which propagates; otherwise it is a plain_reference, which does not.
A later document is linked to an earlier one of the same term when its text names the earlier document by executive order or proclamation number, or by a Federal Register page. The link is typed as an amendment reference when one of the verb stems of the pattern stands within 220 characters of the citation. The script reads the input events with their text and writes the links. Of the 2,620 links, 1,698 are amendment references and 922 plain references; 376 were found by a number and 2,244 by a page.
policy_build_links.pydownload
#!/usr/bin/env python3
"""Link extraction for the US trade policy documents.
A link is made when the text of a later document names an earlier selected document, either by the number of an
executive order or proclamation, or by a Federal Register page (volume and page). The link is typed 'amendment_reference'
when a modifying verb stands near the citation, otherwise 'plain_reference'.
Usage: python build_links.py [--input input_events.json] [--output output_links.json]
Only the Python standard library is needed.
"""
import argparse, collections, json, re
REF = re.compile(r'(?:(Executive Order|E\.O\.)|(Proclamation))\s+(?:No\.\s*)?(\d{4,5})', re.I) # EO / proclamation number
FRC = re.compile(r'\b(\d{2,3})\s+FR\s+(\d{3,6})\b') # Federal Register citation: volume FR page
VERB = re.compile(r'amend|modif|supplement|revok|terminat|suspend|extend|continu|replac|rescind|end(?:s|ing)?\b|adjust|expand|clarif|exempt|reduc|increas|implement|in\s+response|retaliat|further to|exclusion|inclusion', re.I)
CORE = re.compile(r'tariff|ad valorem|harmonized tariff|section 232|section 301|reciprocal|de minimis|duties', re.I) # trade pattern of the event selection
WINDOW = 220 # characters before and after the citation that are searched for a modifying verb
SNIP = 110 # characters kept before and after the citation as evidence
SOURCE = 'federal_register'
def select_trade_documents(docs, issuers=('Presidential', 'USTR', 'BIS')):
"""Event selection (done before the link step): the title matches the trade pattern, or the text has at least three matches."""
return [d for d in docs if d['issuer'] in issuers and (CORE.search(d['title']) or len(CORE.findall(d['text'])) >= 3)]
def clean(s):
lead, trail = s.startswith('…'), s.endswith('…')
w = re.sub(r'\s+', ' ', s.strip('…').strip()).split(' ')
if lead and len(w) > 1: w = w[1:]
if trail and len(w) > 1: w = w[:-1]
return ' '.join(w)
def find_citations(docs):
"""docs: the selected documents of ONE term. Returns {(cited_id, citing_id): evidence}."""
N = {d['id']: d for d in docs}
by_number = {(d['kind'], str(d['instrument_number'])): d['id'] for d in docs if d.get('instrument_number') and d['issuer'] == 'Presidential'}
pages = collections.defaultdict(list) # volume -> [(first page, last page, id)]
for d in docs:
if d.get('volume') and d.get('start_page'):
pages[int(d['volume'])].append((int(d['start_page']), int(d.get('end_page') or d['start_page']), d['id']))
found = {}
def add(cited, citing, text, m):
if cited == citing or N[cited]['date'] > N[citing]['date']: # a document can only cite an earlier or same-day one
return
verb = VERB.search(text[max(0, m.start() - WINDOW): m.end() + WINDOW])
snip = text[max(0, m.start() - SNIP): m.end() + SNIP]
new = dict(typed=bool(verb), verb=verb.group(0) if verb else '', ref=m.group(0),
snip=('…' if m.start() > SNIP else '') + snip + ('…' if m.end() + SNIP < len(text) else ''))
key = (cited, citing)
if key not in found or (new['typed'] and not found[key]['typed']): # keep the first, unless a later one has a verb and the first has none
found[key] = new
for cid, d in N.items():
t = d['text']
for m in REF.finditer(t):
cited = by_number.get(('EO' if m.group(1) else 'PROC', m.group(3)))
if cited:
add(cited, cid, t, m)
for m in FRC.finditer(t):
vol, pg = int(m.group(1)), int(m.group(2))
cand = [i for a, b, i in pages.get(vol, []) if a == pg] # a document that starts on that page
if not cand:
cand = [i for a, b, i in pages.get(vol, []) if a < pg <= b] # or the one document that contains the page
if len(cand) != 1: cand = []
for cited in cand:
add(cited, cid, t, m)
return N, found
def day_number(iso):
import datetime as dt
return (dt.date.fromisoformat(iso) - dt.date(1970, 1, 1)).days
def build_links(events):
terms = collections.OrderedDict()
for e in events:
terms.setdefault(e['term'], []).append(e) # links are searched inside one term only
links, omitted, counts, seen = [], [], collections.Counter(), set()
for term, docs in terms.items():
N, found = find_citations(docs)
for (f, t), ev in found.items():
typed = ev['typed']
kind = 'amendment_reference' if typed else 'plain_reference'
gap = day_number(N[t]['date']) - day_number(N[f]['date'])
if gap < 0:
counts['backward_in_time'] += 1
omitted.append({'item_type': 'link', 'reason': 'backward_in_time', 'id': f'{f}>{t}:{kind}', 'from': f, 'to': t}); continue
if (f, t, kind) in seen: continue
seen.add((f, t, kind))
rule = 'R_CITE_NUMBER' if re.search(r'Executive Order|E\.O\.|Proclamation', ev['ref'], re.I) else 'R_CITE_FRPAGE'
verb = f" near the verb stem '{ev['verb'].lower()}'" if ev['verb'] else ' with no modifying verb nearby'
links.append({'id': f'{f}>{t}:{kind}', 'from': f, 'to': t, 'kind': kind, 'propagates': typed,
'direction': 'evidence' if gap == 0 else 'time', 'gap_seconds': int(gap) * 86400,
'evidence': {'existence': {'level': 'rule', 'basis': 'text_pattern', 'rule_id': rule,
'text': f"The later document names {ev['ref']}{verb}: {clean(ev['snip'])}",
'source_ref': {'source': SOURCE, 'id': f'{t}>{f}'}}},
'attrs': {'reference': ev['ref']}})
links.sort(key=lambda l: (l['from'], l['to'], l['kind'], l.get('relation', ''))) # order of the package
return links, sorted(omitted, key=lambda o: o['id']), counts
def main():
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
ap.add_argument('--input', default='input_events.json')
ap.add_argument('--output', default='output_links.json')
a = ap.parse_args()
inp = json.load(open(a.input, encoding='utf8'))
links, omitted, counts = build_links(inp['events'])
out = {'spec_version': '0.1', 'package_id': inp['package_id'], 'link_count': len(links),
'propagating_links': sum(1 for l in links if l['propagates']), 'omitted_counts': dict(counts), 'links': links, 'omitted': omitted}
json.dump(out, open(a.output, 'w', encoding='utf8'), ensure_ascii=False, separators=(',', ':'))
print(f'{len(links)} links ({out["propagating_links"]} propagating) -> {a.output}')
if __name__ == '__main__':
main()
4. Dates and windows
Two dates exist for a presidential document: the day it was signed and the day it was published in the Federal Register, often some days later. A link has a lag, so the choice matters.
- Event time is the day of publication in the Federal Register, for presidential documents and agency notices alike (manifest: “dated by its publication day”; start is midnight UTC of that day, precision day, documents of one day are simultaneous). The signing date of a presidential document is collected (
signing_date) and used only to select the presidential documents of the period; it is often some days earlier than the publication date. - A later document names an earlier one of the same term; no link crosses a change of administration. Documents of one day are joined in the direction of the evidence (the one that cites).
- The lag of a link is the number of days between the two event times. The manifest sets the default window of
amendment_referenceto 60 days (5,184,000 s);plain_referenceis off by default and has no window. - The window sweep (page parameters) shows how the largest episode grows with the window: 5 events at 10 days, 21 at 30 days, 55 at 60 days, 77 at 90 days, 100 at 180 days and 120 at one year.
5. Package and parameters
The builder of the package is policy_pkg.py. It reads the output of the link step, writes the manifest with the link kinds and their windows and the events and links in the package format, and is followed by the validator (package format).
package_builders/policy_pkg.pydownload
import sys,os,json,re,collections;sys.path.insert(0,'/home/claude/pkg')
os.chdir('/home/claude/pol');sys.path.insert(0,'/home/claude/pol')
import compare2 as C
from pkgkit import *
os.chdir('/home/claude/pkg')
P=json.load(open('/home/claude/proto/policy.json'));E=P['events'];L=P['links']
docs=[]
for pi,(k,(lab,a,b)) in enumerate(C.PER.items()):
trade=C.select([x for x in C.ALL if a<=x['date']<=b],{'Presidential','USTR','BIS'})
for d in trade: docs.append(d|{'period':pi,'term':k})
assert len(docs)==len(E['t']) and all(d['title'][:130]==t for d,t in zip(docs,E['title'])),'document order mismatch'
SRC=['Presidential','USTR','BIS'];ISS=['presidential','ustr','bis']
KIND={'EO':'executive_order','PROC':'proclamation','NOTICE':'agency_notice','OTHER':'other_document'}
sid='federal_register'
ents=[]
for i,pl in enumerate(P['places']):
ents.append(dict(id=f'topic:{i}',type='topic_region',label=pl['label'],attrs=dict(coords=dict(space='policy_topic_map_tsne_unit',x=pl['x'],y=pl['y']),documents=pl['n']),provenance=dict(source_ids=[],derived=True,method='k-means (k=10, 10 restarts, seed 0) on TF-IDF (8000 features, sublinear tf) reduced by SVD to 50 dimensions of title plus the first 2500 characters of text (scikit-learn); regions named by their top title terms and the majority issuer')))
for k,n in zip(ISS,['Presidential documents','US Trade Representative notices','Bureau of Industry and Security notices']):
ents.append(dict(id=f'issuer:{k}',type='issuer',label=n,attrs={},provenance=dict(source_ids=[dict(source=sid,id=f'issuer:{k}')],derived=False)))
events=[]
for i,d in enumerate(docs):
a=dict(document_number=d['id'],term=d['term'],issuer=ISS[E['src'][i]],coords=dict(space='policy_topic_map_tsne_unit',x=P['nodes']['x'][i],y=P['nodes']['y'][i]))
if d['num']: a['instrument_number']=d['num']
if d['vol']: a['federal_register_volume']=int(d['vol']);a['start_page']=int(d['sp'])
ev=dict(id=d['id'],kind=KIND[d['kind']],title=d['title'].strip() or f"Untitled {d['kind']} {d['id']}",time=dict(start=d['date']+'T00:00:00Z',precision='day',basis='recorded'),
refs=[dict(entity=f"topic:{E['pl'][i]}",role='anchor'),dict(entity=f"issuer:{ISS[E['src'][i]]}",role='participant')],attrs=a,
provenance=dict(source_ids=[dict(source=sid,id=d['id'])],extraction=dict(method='trade or tariff pattern in the title, or at least three matches in the text',rule_ids=['R_TRADE_TEXT']),confidence=None),link_coverage='complete')
if d['url']: ev['url']=d['url']
events.append(ev)
links=[];om=[];oc=collections.Counter();seen=set()
def clean(s):
lead=s.startswith('…');trail=s.endswith('…');w=re.sub(r'\s+',' ',s.strip('…').strip()).split(' ')
if lead and len(w)>1: w=w[1:]
if trail and len(w)>1: w=w[:-1]
return ' '.join(w)
for a,b,ty,gap,ev in zip(L['a'],L['b'],L['ty'],L['gap'],L['ev']):
f,t=docs[a]['id'],docs[b]['id'];kind='amendment_reference' if ty==0 else 'plain_reference'
if gap<0: oc['backward_in_time']+=1;om.append(dict(item_type='link',reason='backward_in_time',id=f'{f}>{t}:{kind}',**{'from':f,'to':t}));continue
if (f,t,kind) in seen: continue
seen.add((f,t,kind))
rule='R_CITE_NUMBER' if re.search(r'Executive Order|E\.O\.|Proclamation',ev['ref'],re.I) else 'R_CITE_FRPAGE'
verb=f" near the verb stem '{ev['verb'].lower()}'" if ev['verb'] else ' with no modifying verb nearby'
links.append({'id':f'{f}>{t}:{kind}','from':f,'to':t,'kind':kind,'propagates':ty==0,'direction':'evidence' if gap==0 else 'time','gap_seconds':int(gap)*86400,
'evidence':{'existence':{'level':'rule','basis':'text_pattern','rule_id':rule,'text':f"The later document names {ev['ref']}{verb}: {clean(ev['snip'])}",'source_ref':dict(source=sid,id=f'{t}>{f}')}},'attrs':dict(reference=ev['ref'])})
M=dict(spec_version='0.1',package_id='policy-us-trade-0.1',created_at=CREATED,
adapter=dict(name='federal_register_trade_adapter',version='0.1',domain='policy',code_ref=None,produced_by='Claude, from the policy pilot scripts and Federal Register documents'),
domain=dict(event_definition='A presidential document, or a USTR or BIS notice, in the Federal Register that concerns tariffs or trade, dated by its publication day',entity_description='Derived topic regions of the document text, and the issuing bodies (presidential documents, USTR, BIS)'),
sources=[dict(id=sid,name='Federal Register documents (presidential documents, USTR and BIS rules and notices), document text and metadata',url='https://www.federalregister.gov',accessed_at='2026-10',version='download of October 2026',license='US federal government works; the Federal Register site states no copyright restriction on its documents (to be confirmed before sharing)')],
observation_window=dict(start='2017-01-20',end='2026-10-18',collected_at='2026-10',right_censored=True),
coverage=dict(procedure='query',description='Documents of the three terms (Trump first term from 2017-01-20, Biden, Trump second term to 2026-10-18) that match a tariff and trade pattern; links are searched only among the selected documents of the same term',seeds=[],depth_limit=None,selection_rules=['R_TRADE_TEXT'],
known_gaps=['Documents that concern trade but do not match the pattern are missing','Links are found only by an explicit citation of an executive order or proclamation number or of a Federal Register page; amendments that name neither are missing','Citations are searched inside one term, so no link crosses a change of administration','Other agencies than USTR and BIS are not included','Recent documents have had little time to attract references']),
event_kinds=[dict(id='executive_order',label='Executive order',description='Presidential executive order'),dict(id='proclamation',label='Proclamation',description='Presidential proclamation'),dict(id='agency_notice',label='Agency notice',description='USTR or BIS notice or rule'),dict(id='other_document',label='Other document',description='Other presidential document')],
entity_types=[dict(id='topic_region',label='Topic region',description='Cluster of documents with similar words in title and text; derived'),dict(id='issuer',label='Issuing body',description='Presidential documents, USTR or BIS')],
entity_relation_types=[],roles=[],
link_kinds=[dict(id='amendment_reference',core_kind='reference',description='A later document names an earlier executive order or proclamation, or cites its Federal Register page, near a verb such as amend, extend or suspend',propagates_default=True,default_window_seconds=5184000,max_gap_seconds=None,direction_rule='From the cited document to the citing document; documents of the same day use evidence',levels=['rule']),
dict(id='plain_reference',core_kind='reference',description='A later document names an earlier executive order or proclamation, or cites its page, without a modifying verb nearby',propagates_default=False,default_window_seconds=None,max_gap_seconds=None,direction_rule='From the cited document to the citing document; documents of the same day use evidence',levels=['rule'])],
evidence_bases=[dict(id='text_pattern',label='Text pattern',description='Pattern match in the text of the citing document, with the surrounding words as reason')],
rules=[dict(id='R_TRADE_TEXT',description='Title matches the trade pattern, or the text has at least three matches (tariff, ad valorem, harmonized tariff, section 232, section 301, reciprocal, de minimis, duties)',parameters=dict(min_text_matches=3),applies_to='event'),
dict(id='R_CITE_NUMBER',description='The text names Executive Order or Proclamation with a number of an earlier selected document',parameters={},applies_to='link'),
dict(id='R_CITE_FRPAGE',description='The text cites a Federal Register page (volume FR page) that falls in an earlier selected document',parameters={},applies_to='link')],
parameters=dict(time_precision=dict(value='day',description='Documents are dated to the day of publication in the Federal Register; start is midnight UTC of that day and documents of one day are simultaneous'),modifying_verb_pattern=dict(value='amend, modif, supplement, revok, terminat, suspend, extend, continu, replac, rescind, end, adjust, expand, clarif, exempt, reduc, increas, implement, in response, retaliat, further to, exclusion, inclusion',description='Verb stems within 220 characters of the citation that make a link an amendment reference'),
default_window_days=dict(value=60,description='Window used in the pilot for amendment references; the percolation sweep showed the steepest growth before it'),
coords_space=dict(value='policy_topic_map_tsne_unit',description='attrs.coords hold a t-SNE layout of title and text in the unit square; layout hint only')),
limitations=['Relations are typed by a verb pattern, not judged by a reader','The 60-day window of the pilot lies after the steepest growth of the giant component and may be too wide','Documents of one day are simultaneous at day precision; their links carry direction evidence','The topic regions are descriptive and derived from words','Only 601 documents; cascades are few and small'],
notes='Hand check: the text of a link quotes the citing document around the citation; the cited number or page identifies the earlier document.')
od='/home/claude/pkg/out/policy-us-trade'
st=write_package(od,M,events,ents,[],links,om,oc);print(json.dumps(st)[:500]);print(finalize(od))
python policy_build_links.py --input input_events.json --output output_links.json # level A: reproduces the delivered links python collect_federal_register.py # level C: live API, writes pres_all_meta.json, ustr_meta.json, bis_meta.json, agency_text.json, pres_all_text.json
The first version of the pilot, with selection, links and the cascade analysis of the pilot, is kept for transparency: pilot_select_and_cascades.py, and the script of the earlier terms collect_presidential_periods.py.
6. Parameters of this domain
| Parameter | Value | Where | Effect |
|---|---|---|---|
| Period | 20 Jan 2017 to 18 Oct 2026 | START, END in the collection script | Three terms: first Trump, Biden, second Trump |
| Document sources | PRESDOCU; USTR; BIS (title filter) | collection script | BIS documents are kept only if the title matches section 232 | steel | alumin | tariff | duties | import | derivative | exclusion | inclusion | copper | lumber | timber | autom | semiconductor | pharmaceutical | critical mineral | truck | solar |
| Trade pattern | tariff | ad valorem | harmonized tariff | section 232 | section 301 | reciprocal | de minimis | duties | link script / selection | Title match, or at least 3 matches in the text, makes the document an event |
| Citation by | EO or proclamation number; Federal Register page | link script | 376 links by number, 2,244 by page |
| Verb window | 220 characters | link script | A modifying verb stem within this distance makes the citation an amendment reference (pattern in modifying_verb_pattern of the manifest) |
| Event time | publication day, midnight UTC | package builder | Precision day; documents of one day are simultaneous |
| Same term only | yes | link script | No link crosses a change of administration |
| Default window | 60 days | manifest | Applies to amendment_reference; the user can change it in the tool |
plain_reference | does not propagate | manifest | Shown as context, not passed on |
7. Limits
- Only explicit citations by number or page are found. An amendment that names neither is missing.
- The verb pattern is a heuristic and not a reader's judgement. In the preliminary analysis almost every citation passed the filter.
- No link crosses a change of administration.
- A Federal Register page can hold several documents. The rule takes the document that starts on the page, or the only one that contains it.
- Recent documents have had little time to be cited.

