Retain company PIT objects
Browse files- packets/fee6757f808336362856f2c7885a82b9ea68da72f225521cd0be4b3593a5d00a.json +0 -0
- packets/ffff697895ef5ee9bd177e2e5b1616acc6a1f717c5648858703a4a1e1a1a7100.json +0 -0
- releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/companies.jsonl.gz +3 -0
- releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/companies.parquet +3 -0
- releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/facts.jsonl.gz +3 -0
- releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/facts.parquet +3 -0
- releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/manifest.json +1 -0
- upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/README.md +61 -0
- upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/checksums.sha256 +10 -0
- upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/citation.bib +7 -0
- upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/coverage.json +0 -0
- upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/packet.py +72 -0
- upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/release-kit.zip +3 -0
- upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/release.json +1 -0
- upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/replay.py +93 -0
- upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/review-candidates.jsonl +1 -0
- upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/screen.json +0 -0
- upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/snapshot.json +0 -0
- upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/study.json +1 -0
packets/fee6757f808336362856f2c7885a82b9ea68da72f225521cd0be4b3593a5d00a.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
packets/ffff697895ef5ee9bd177e2e5b1616acc6a1f717c5648858703a4a1e1a1a7100.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/companies.jsonl.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:241dbe546114ffc340e038663abbe70dfe6659a7894275092879841a6fbff30d
|
| 3 |
+
size 81190
|
releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/companies.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8248f0017aa2c6197b2a1e25e15c8e0d0b78b3182cfcd10f49a08bf257905420
|
| 3 |
+
size 76439
|
releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/facts.jsonl.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:826f5696c9651948957c204fc0253d6812e02f87e8753805af7ce6eeaa31b7ec
|
| 3 |
+
size 7693814
|
releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/facts.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5aca9037d2c73dd371064a657628e4012a266ac1fd1caae06549e4c0736445c7
|
| 3 |
+
size 6089171
|
releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/manifest.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"boundary":"Selected currentIds in this frozen release. Retained packets preserve additional versions. No benchmark answers.","companyCount":625,"distributionVersion":"1.0.0","publisher":"AhaSignals","releaseSha256":"4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9","selectedFactCount":122919,"tables":{"companies.jsonl.gz":"241dbe546114ffc340e038663abbe70dfe6659a7894275092879841a6fbff30d","companies.parquet":"8248f0017aa2c6197b2a1e25e15c8e0d0b78b3182cfcd10f49a08bf257905420","facts.jsonl.gz":"826f5696c9651948957c204fc0253d6812e02f87e8753805af7ce6eeaa31b7ec","facts.parquet":"5aca9037d2c73dd371064a657628e4012a266ac1fd1caae06549e4c0736445c7"}}
|
upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Company disclosure PIT observations
|
| 2 |
+
|
| 3 |
+
AhaSignals · original compilation and code CC BY 4.0; underlying source rights remain.
|
| 4 |
+
https://ahasignals.com/research/company-pit-observations/
|
| 5 |
+
|
| 6 |
+
A frozen release pins the observed company universe, exact company packet hashes,
|
| 7 |
+
source screening decisions, coverage gaps and unreviewed comparison leads. This is
|
| 8 |
+
an observation dataset, not the separate frozen PIT evaluation benchmark.
|
| 9 |
+
|
| 10 |
+
The release kit contains metadata and Python tools, not all financial rows. Download
|
| 11 |
+
selected company packets or the entire pinned universe explicitly, then replay offline.
|
| 12 |
+
Packets are shared across releases instead of republishing the same financial history.
|
| 13 |
+
Python 3 standard library only; no account or model subscription. No code runs from
|
| 14 |
+
financial inputs. Download tools only from a trusted source. Hashes identify bytes,
|
| 15 |
+
not source truth, historical completeness or model performance.
|
| 16 |
+
|
| 17 |
+
1. Save the public catalog from /data/company-pit/v1/index.json. Run:
|
| 18 |
+
python3 replay.py select --catalog index.json --as-of UTC_CUTOFF
|
| 19 |
+
2. Download that row's kitUrl; verify its kitSha256 before extracting. Keep sha256
|
| 20 |
+
from the independently obtained catalog as RELEASE_HASH. Do not use today's
|
| 21 |
+
company universe for an earlier decision. The kit is flat and has no nested paths.
|
| 22 |
+
3. From the extracted directory:
|
| 23 |
+
python3 replay.py verify --release . --sha256 RELEASE_HASH
|
| 24 |
+
python3 replay.py fetch --release . --sha256 RELEASE_HASH --cik 0001769628 --cache packets
|
| 25 |
+
python3 replay.py replay --release . --sha256 RELEASE_HASH --cik 0001769628 --cache packets --as-of UTC_CUTOFF
|
| 26 |
+
Replace --cik with --all only for fetch to download the whole pinned universe.
|
| 27 |
+
Fetch performs bounded-size reads of fixed AhaSignals HTTPS packet URLs, at most
|
| 28 |
+
two sequential requests per second. Redirects and hash mismatches fail. Existing
|
| 29 |
+
valid cached packets are reused. Replay and verification never use the network.
|
| 30 |
+
|
| 31 |
+
UTC_CUTOFF must be a full UTC instant, for example 2026-09-26T00:00:00Z; this is an
|
| 32 |
+
input example, not a claim that a release exists on that date. Missing releases,
|
| 33 |
+
companies or local packets return unavailable with a nonzero exit, never zero data.
|
| 34 |
+
|
| 35 |
+
## Time and selection boundaries
|
| 36 |
+
|
| 37 |
+
frozenAt is when this release was constructed, not when it first became available
|
| 38 |
+
on the public web. sourceAsOf is the source collection run's finish time. Each fact
|
| 39 |
+
keeps filedDate (date precision only), financial period and firstObservedAt. Initial
|
| 40 |
+
historical facts were collected later: 2023 figures collected in 2026 cannot establish
|
| 41 |
+
what AhaSignals knew in 2023. A cutoff before the first release is unavailable even
|
| 42 |
+
if its underlying packet was constructed earlier. Replay is release-granular.
|
| 43 |
+
|
| 44 |
+
The screen uses SEC non-affiliate public float >= USD 10 billion, not live market
|
| 45 |
+
cap or index membership. Coverage is selective: entity-wide standard US-GAAP USD
|
| 46 |
+
facts. Original cumulative periods are preserved. A passing structural comparison
|
| 47 |
+
is not proof of constant business scope. Candidates, stale observations, failed
|
| 48 |
+
collections, exited members and unreviewed guidance are explicit. Cadence is best
|
| 49 |
+
effort; successful publication does not imply all sources were collected successfully.
|
| 50 |
+
|
| 51 |
+
## Changes and review
|
| 52 |
+
|
| 53 |
+
review-candidates.jsonl compares retained packets between releases. Value differences
|
| 54 |
+
under the same concept/unit/period require review, even under the same accession.
|
| 55 |
+
Facts leaving currentIds may reflect the rolling period window. Neither proves a
|
| 56 |
+
restatement. The first release supplies a baseline and has no prospective revision
|
| 57 |
+
claims. No candidate becomes an evaluation answer without a separate reviewed release.
|
| 58 |
+
|
| 59 |
+
Cite the frozen release hash, company CIK, packet hash, fact ID, reporting period and
|
| 60 |
+
first observation time. Keep the linked source filing and research boundaries.
|
| 61 |
+
AhaSignals is independent of the SEC and covered issuers. Research only.
|
upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/checksums.sha256
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
8dfc9abca906bbc3a5515adc826510e466d4d40a68dd9cfaa46c427b255c53ca README.md
|
| 2 |
+
c4af289b50f5d7c1bc18233c9b00f875f335514701dfe80ccd2824a030331b2c citation.bib
|
| 3 |
+
bc75cfb089b0e893e00040f0b1b140e0df1b482d6ab0cb0e449ff0265d196bc2 coverage.json
|
| 4 |
+
63120e38c813afb3330a276b127c4a08d21164e6760b0e11982fab193a20f74d packet.py
|
| 5 |
+
4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9 release.json
|
| 6 |
+
76594ba621a3fcf848d68a7ac8239d380a267ede134b0457991234d56ef1d817 replay.py
|
| 7 |
+
318aef076450774698c06dd431d73a2201b2900729916b6999138af74ac9fab5 review-candidates.jsonl
|
| 8 |
+
8cf98357d23eec05c01a208a4f585d804e2b138da18b63e91d65c1868a60a1bc screen.json
|
| 9 |
+
a9bf8285e2d0dc064c8e230dd3365813d74a4af85ca63a718fb30ea301249698 snapshot.json
|
| 10 |
+
ee67ee286efc23c1e2745bea879da73f3d4b7695d3954fcb33b76371a36a46bb study.json
|
upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/citation.bib
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@misc{ahasignals_company_pit_20261002,
|
| 2 |
+
author = {{AhaSignals}},
|
| 3 |
+
title = {Company disclosure PIT observations},
|
| 4 |
+
year = {2026},
|
| 5 |
+
note = {Frozen 2026-10-02T10:08:24Z; source index SHA-256 a9bf8285e2d0dc064c8e230dd3365813d74a4af85ca63a718fb30ea301249698},
|
| 6 |
+
url = {https://ahasignals.com/research/company-pit-observations/}
|
| 7 |
+
}
|
upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/coverage.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/packet.py
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Verify a pinned AhaSignals company packet and select facts known at a UTC cutoff."""
|
| 3 |
+
import argparse
|
| 4 |
+
import datetime as dt
|
| 5 |
+
import hashlib
|
| 6 |
+
import json
|
| 7 |
+
import math
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
import re
|
| 10 |
+
|
| 11 |
+
FACT_KEYS={'cik','concept','label','unit','value','start','end','filedDate','accession','form','id','firstObservedAt','firstSourceSha256','sourceUrl'}
|
| 12 |
+
PACKET_KEYS={'cik','name','tickers','exchanges','sic','sicDescription','sector','screen','factsSource','submissionSource','version','publisher','facts','currentIds','comparisons','comparativeChanges','guidanceStatus','scope','reviewStatus','previousSha256','recordedAt','contentSignature'}
|
| 13 |
+
CONCEPTS={'Revenues','RevenueFromContractWithCustomerExcludingAssessedTax','SalesRevenueNet','NetIncomeLoss','NetCashProvidedByUsedInOperatingActivities','PaymentsToAcquirePropertyPlantAndEquipment','Assets','CashAndCashEquivalentsAtCarryingValue'}
|
| 14 |
+
|
| 15 |
+
def instant(v):
|
| 16 |
+
if not isinstance(v,str) or not re.fullmatch(r'\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z',v):raise ValueError('UTC instant required')
|
| 17 |
+
return dt.datetime.fromisoformat(v.replace('Z','+00:00'))
|
| 18 |
+
|
| 19 |
+
def check(condition,why):
|
| 20 |
+
if not condition:raise ValueError(why)
|
| 21 |
+
|
| 22 |
+
def sha(v):return isinstance(v,str) and bool(re.fullmatch('[a-f0-9]{64}',v))
|
| 23 |
+
|
| 24 |
+
def verify(data,expected):
|
| 25 |
+
check(sha(expected) and hashlib.sha256(data).hexdigest()==expected,'packet SHA-256 mismatch')
|
| 26 |
+
p=json.loads(data)
|
| 27 |
+
check(set(p)==PACKET_KEYS and p['publisher']=='AhaSignals' and p['version']=='1.0.0','unknown packet fields/version')
|
| 28 |
+
check(bool(re.fullmatch(r'\d{10}',p['cik'])),'invalid CIK')
|
| 29 |
+
check(p['previousSha256'] is None or sha(p['previousSha256']),'invalid parent hash')
|
| 30 |
+
instant(p['recordedAt'])
|
| 31 |
+
for field,route in [('factsSource','api/xbrl/companyfacts'),('submissionSource','submissions')]:
|
| 32 |
+
s=p[field];check(set(s)=={'url','sha256','observedAt'} and sha(s['sha256']),'unknown source fields')
|
| 33 |
+
check(s['url']==f'https://data.sec.gov/{route}/CIK{p["cik"]}.json','source issuer mismatch')
|
| 34 |
+
check(instant(s['observedAt'])<=instant(p['recordedAt']),'source observed after packet')
|
| 35 |
+
check(set(p['screen'])=={'status','measurement'},'screen fields')
|
| 36 |
+
m=p['screen']['measurement']
|
| 37 |
+
if m:
|
| 38 |
+
check(set(m)=={'val','end','filed','accn','unit','concept','sourceUrl'},'measurement fields')
|
| 39 |
+
check(m['unit']=='USD' and m['concept']=='dei:EntityPublicFloat','wrong float unit/concept')
|
| 40 |
+
check(m['end']<=p['submissionSource']['observedAt'][:10] and m['filed']<=p['submissionSource']['observedAt'][:10],'future float')
|
| 41 |
+
ids=set()
|
| 42 |
+
for r in p['facts']:
|
| 43 |
+
check(set(r)==FACT_KEYS,'unknown fact fields')
|
| 44 |
+
check(r['cik']==p['cik'] and r['unit']=='USD' and r['concept'] in {'us-gaap:'+c for c in CONCEPTS},'unsupported fact')
|
| 45 |
+
check(isinstance(r['value'],(int,float)) and not isinstance(r['value'],bool) and math.isfinite(r['value']),'invalid value')
|
| 46 |
+
check(sha(r['id']) and sha(r['firstSourceSha256']) and r['id'] not in ids,'invalid/duplicate fact ID');ids.add(r['id'])
|
| 47 |
+
check(bool(re.fullmatch(r'\d{10}-\d{2}-\d{6}',r['accession'])),'invalid accession')
|
| 48 |
+
check(r['sourceUrl']==f'https://www.sec.gov/Archives/edgar/data/{int(p["cik"])}/{r["accession"].replace("-", "")}/{r["accession"]}-index.htm','unexpected filing URL')
|
| 49 |
+
check(r['filedDate']<=r['firstObservedAt'][:10] and r['end']<=r['firstObservedAt'][:10],'future fact')
|
| 50 |
+
check(instant(r['firstObservedAt'])<=instant(p['recordedAt']),'future observation')
|
| 51 |
+
if r['start']:check(r['start']<=r['end'],'negative period')
|
| 52 |
+
check(len(set(p['currentIds']))==len(p['currentIds']) and set(p['currentIds'])<=ids,'unknown current fact')
|
| 53 |
+
for c in p['comparisons']:
|
| 54 |
+
check(set(c)=={'concept','currentId','priorId','growthPercent','reason'},'comparison fields')
|
| 55 |
+
check(c['currentId'] in ids and (c['priorId'] is None or c['priorId'] in ids),'unknown comparison input')
|
| 56 |
+
for c in p['comparativeChanges']:
|
| 57 |
+
check(set(c)=={'concept','start','end','factIds','status','reason'} and set(c['factIds'])<=ids,'change fields')
|
| 58 |
+
return p
|
| 59 |
+
|
| 60 |
+
def replay(p,as_of):
|
| 61 |
+
cutoff=instant(as_of)
|
| 62 |
+
# Applying today's currentIds to an older date would leak removals and eligibility changes.
|
| 63 |
+
check(instant(p['recordedAt'])<=cutoff,'Use a retained packet recorded no later than as-of; this observation packet did not exist yet')
|
| 64 |
+
current_ids=set(p['currentIds'])
|
| 65 |
+
rows=[r for r in p['facts'] if r['id'] in current_ids and instant(r['firstObservedAt'])<=cutoff]
|
| 66 |
+
return {'publisher':'AhaSignals','asOf':as_of,'cik':p['cik'],'packetRecordedAt':p['recordedAt'],
|
| 67 |
+
'scope':'Observed facts, not proof of historical market-wide availability. Original durations remain unchanged.',
|
| 68 |
+
'facts':rows,'comparisons':p['comparisons'],'guidanceStatus':p['guidanceStatus']}
|
| 69 |
+
|
| 70 |
+
if __name__=='__main__':
|
| 71 |
+
a=argparse.ArgumentParser();a.add_argument('packet',type=Path);a.add_argument('--sha256',required=True);a.add_argument('--as-of',required=True);v=a.parse_args()
|
| 72 |
+
print(json.dumps(replay(verify(v.packet.read_bytes(),v.sha256),v.as_of),ensure_ascii=False,indent=2))
|
upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/release-kit.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:322a889fd56fd6b33ff9e14c75f853429dfb09382ff2c96574625efd06705d00
|
| 3 |
+
size 135683
|
upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/release.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"boundary":"Retained observation universe from this construction clock onward. Not historical market-wide availability, investment advice, or the frozen PIT evaluation benchmark.","builderSha256":"0319635eac19b78124aa1be991b24ccf04f9f9d0705c53d058748cb9be42a311","files":{"README.md":"8dfc9abca906bbc3a5515adc826510e466d4d40a68dd9cfaa46c427b255c53ca","citation.bib":"c4af289b50f5d7c1bc18233c9b00f875f335514701dfe80ccd2824a030331b2c","coverage.json":"bc75cfb089b0e893e00040f0b1b140e0df1b482d6ab0cb0e449ff0265d196bc2","packet.py":"63120e38c813afb3330a276b127c4a08d21164e6760b0e11982fab193a20f74d","replay.py":"76594ba621a3fcf848d68a7ac8239d380a267ede134b0457991234d56ef1d817","review-candidates.jsonl":"318aef076450774698c06dd431d73a2201b2900729916b6999138af74ac9fab5","screen.json":"8cf98357d23eec05c01a208a4f585d804e2b138da18b63e91d65c1868a60a1bc","snapshot.json":"a9bf8285e2d0dc064c8e230dd3365813d74a4af85ca63a718fb30ea301249698","study.json":"ee67ee286efc23c1e2745bea879da73f3d4b7695d3954fcb33b76371a36a46bb"},"frozenAt":"2026-10-02T10:08:24Z","previousReleaseSha256":"2cdaa02480604dc9ceddabd0d77e78354d9e6151caef5343ab03762a98da0bf7","publisher":"AhaSignals","sourceAsOf":"2026-10-02T10:07:28Z","sourceIndexSha256":"a9bf8285e2d0dc064c8e230dd3365813d74a4af85ca63a718fb30ea301249698","version":"1.0.0"}
|
upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/replay.py
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""AhaSignals company PIT release selection, verification and offline replay."""
|
| 3 |
+
import argparse,datetime as dt,hashlib,json,re,time,urllib.request
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
import sys
|
| 6 |
+
sys.dont_write_bytecode=True
|
| 7 |
+
import packet
|
| 8 |
+
|
| 9 |
+
PAGE='https://ahasignals.com/research/company-pit-observations/'
|
| 10 |
+
ROOT='https://ahasignals.com/data/company-pit/v1/'
|
| 11 |
+
FILES={'snapshot.json','screen.json','study.json','coverage.json','review-candidates.jsonl','replay.py','packet.py','README.md','citation.bib'}
|
| 12 |
+
def encode(v):return (json.dumps(v,ensure_ascii=False,sort_keys=True,separators=(',',':'))+'\n').encode()
|
| 13 |
+
def digest(b):return hashlib.sha256(b).hexdigest()
|
| 14 |
+
def check(ok,why):
|
| 15 |
+
if not ok:raise ValueError(why)
|
| 16 |
+
def select(index,as_of):
|
| 17 |
+
cutoff=packet.instant(as_of)
|
| 18 |
+
rows=index['releases'];seen=set();previous=None
|
| 19 |
+
for r in rows:
|
| 20 |
+
check(packet.sha(r['sha256']) and r['sha256'] not in seen,'Invalid or duplicate release hash');seen.add(r['sha256'])
|
| 21 |
+
clock=packet.instant(r['frozenAt']);check(previous is None or clock>previous,'Unordered release catalog');previous=clock
|
| 22 |
+
check(r['releaseUrl']==ROOT+'releases/'+r['sha256']+'/release.json','Unexpected release URL')
|
| 23 |
+
eligible=[r for r in rows if packet.instant(r['frozenAt'])<=cutoff]
|
| 24 |
+
return eligible[-1] if eligible else None
|
| 25 |
+
|
| 26 |
+
def verify(folder,expected):
|
| 27 |
+
folder=Path(folder);raw=(folder/'release.json').read_bytes()
|
| 28 |
+
check(packet.sha(expected) and digest(raw)==expected,'Release SHA-256 mismatch')
|
| 29 |
+
r=json.loads(raw)
|
| 30 |
+
check(set(r)=={'version','publisher','frozenAt','sourceAsOf','sourceIndexSha256','previousReleaseSha256','builderSha256','files','boundary'},'Unknown release fields')
|
| 31 |
+
check(r['version']=='1.0.0' and r['publisher']=='AhaSignals','Unknown release contract')
|
| 32 |
+
clock=packet.instant(r['frozenAt']);check(packet.instant(r['sourceAsOf'])<=clock,'Future source snapshot')
|
| 33 |
+
check(set(r['files'])==FILES and packet.sha(r['builderSha256']),'Unexpected release files')
|
| 34 |
+
check(r['previousReleaseSha256'] is None or packet.sha(r['previousReleaseSha256']),'Invalid release parent')
|
| 35 |
+
for name,sha in r['files'].items():check(packet.sha(sha) and digest((folder/name).read_bytes())==sha,'File hash mismatch: '+name)
|
| 36 |
+
i=json.loads((folder/'snapshot.json').read_bytes());c=json.loads((folder/'coverage.json').read_bytes())
|
| 37 |
+
check(digest(encode(i))==r['sourceIndexSha256'] and i['asOf']==r['sourceAsOf'],'Source index mismatch')
|
| 38 |
+
check(i['screenSha256']==digest((folder/'screen.json').read_bytes()) and i['studySha256']==digest((folder/'study.json').read_bytes()),'Source report mismatch')
|
| 39 |
+
check(len(i['companies'])==c['companyCount'] and len(c['companies'])==c['companyCount'],'Coverage count mismatch')
|
| 40 |
+
check(len({x['cik'] for x in i['companies']})==len(i['companies']),'Duplicate issuer')
|
| 41 |
+
for e in i['companies']:
|
| 42 |
+
check(re.fullmatch(r'\d{10}',e['cik']) and packet.sha(e['sha256']),'Invalid company identity')
|
| 43 |
+
check(e['packetUrl']=='/data/company-evidence/v1/packets/'+e['sha256']+'.json','Unexpected packet URL')
|
| 44 |
+
check(packet.instant(e['updatedAt'])<=clock and packet.instant(e['lastCheckedAt'])<=clock,'Company clock after release')
|
| 45 |
+
check(c['frozenAt']==r['frozenAt'],'Coverage clock mismatch')
|
| 46 |
+
return r,i,c
|
| 47 |
+
|
| 48 |
+
def replay(folder,expected,as_of,cik,cache):
|
| 49 |
+
r,i,c=verify(folder,expected);cutoff=packet.instant(as_of)
|
| 50 |
+
check(packet.instant(r['frozenAt'])<=cutoff,'Release unavailable at cutoff; select an older retained release. No backdating.')
|
| 51 |
+
entry=next((e for e in i['companies'] if e['cik']==cik),None)
|
| 52 |
+
check(entry is not None,'Issuer absent from this frozen universe; do not use current membership')
|
| 53 |
+
p=packet.verify((Path(cache)/(entry['sha256']+'.json')).read_bytes(),entry['sha256'])
|
| 54 |
+
check(p['cik']==cik and p['recordedAt']==entry['updatedAt'],'Wrong issuer or packet clock')
|
| 55 |
+
check(packet.instant(p['recordedAt'])<=packet.instant(r['frozenAt']),'Packet created after release')
|
| 56 |
+
result=packet.replay(p,as_of)
|
| 57 |
+
result.update(releaseSha256=expected,releaseFrozenAt=r['frozenAt'],sourceIndexSha256=r['sourceIndexSha256'],packetSha256=entry['sha256'],screenStatus=entry['status'],collectionError=entry['collectionError'],boundary='Facts and membership of this pinned release, not a live query. Select the latest retained release no later than the requested cutoff. A later cutoff does not refresh these observations; no proof of first public web availability.')
|
| 58 |
+
return result
|
| 59 |
+
|
| 60 |
+
def fetch(folder,expected,cache,cik=None,all_companies=False):
|
| 61 |
+
_,i,_=verify(folder,expected)
|
| 62 |
+
check(bool(cik)!=bool(all_companies),'Choose exactly one CIK or --all')
|
| 63 |
+
entries=i['companies'] if all_companies else [e for e in i['companies'] if e['cik']==cik]
|
| 64 |
+
check(bool(entries),'Issuer absent from frozen universe')
|
| 65 |
+
cache=Path(cache);cache.mkdir(parents=True,exist_ok=True)
|
| 66 |
+
class NoRedirect(urllib.request.HTTPRedirectHandler):
|
| 67 |
+
def redirect_request(self,*args,**kwargs):return None
|
| 68 |
+
opener=urllib.request.build_opener(NoRedirect)
|
| 69 |
+
for e in entries:
|
| 70 |
+
dest=cache/(e['sha256']+'.json')
|
| 71 |
+
if dest.exists():
|
| 72 |
+
p=packet.verify(dest.read_bytes(),e['sha256']);check(p['cik']==e['cik'],'Cached issuer mismatch');continue
|
| 73 |
+
# Only AhaSignals normalized public packets; never request SEC or a supplied host.
|
| 74 |
+
req=urllib.request.Request('https://ahasignals.com'+e['packetUrl'],headers={'User-Agent':'AhaSignals-PIT-replay/1.0'})
|
| 75 |
+
with opener.open(req,timeout=30) as response:raw=response.read(10_000_001)
|
| 76 |
+
check(len(raw)<=10_000_000,'Packet exceeds size limit');p=packet.verify(raw,e['sha256']);check(p['cik']==e['cik'],'Issuer mismatch')
|
| 77 |
+
dest.write_bytes(raw);time.sleep(.5)
|
| 78 |
+
return {'verifiedPackets':len(entries),'boundary':'Previously cached valid packets are reused. No credentials or SEC requests.'}
|
| 79 |
+
|
| 80 |
+
def main():
|
| 81 |
+
a=argparse.ArgumentParser(description=__doc__);a.add_argument('command',choices=['select','verify','fetch','replay']);a.add_argument('--catalog',type=Path);a.add_argument('--release',type=Path);a.add_argument('--sha256');a.add_argument('--as-of');a.add_argument('--cik');a.add_argument('--all',action='store_true');a.add_argument('--cache',type=Path,default=Path('packets'));v=a.parse_args()
|
| 82 |
+
try:
|
| 83 |
+
if v.command=='select':
|
| 84 |
+
check(v.catalog is not None and v.as_of is not None,'--catalog and --as-of required');result=select(json.loads(v.catalog.read_bytes()),v.as_of);check(result is not None,'No retained release at or before cutoff')
|
| 85 |
+
else:
|
| 86 |
+
check(v.release is not None and v.sha256 is not None,'--release and externally pinned --sha256 required')
|
| 87 |
+
if v.command=='verify':r,i,c=verify(v.release,v.sha256);result={'verified':True,'frozenAt':r['frozenAt'],'companyCount':len(i['companies']),'coverageStatus':c['status']}
|
| 88 |
+
elif v.command=='fetch':result=fetch(v.release,v.sha256,v.cache,v.cik,v.all)
|
| 89 |
+
else:
|
| 90 |
+
check(v.as_of is not None and v.cik is not None,'--as-of and --cik required');result=replay(v.release,v.sha256,v.as_of,v.cik,v.cache)
|
| 91 |
+
print(json.dumps(result,ensure_ascii=False,indent=2))
|
| 92 |
+
except (ValueError,KeyError,FileNotFoundError,TypeError) as e:a.exit(2,'Unavailable: '+str(e)+'\n')
|
| 93 |
+
if __name__=='__main__':main()
|
upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/review-candidates.jsonl
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"boundary":"May reflect the rolling period window; not proof of a source deletion.","cik":"0000707549","firstObservedAt":"2026-10-02T10:04:03Z","kind":"left-current-selection","newFactId":null,"packetSha256":"723d0c2ecab0cf7cb9657528c2062172aa4f1ebcef411f69c23d3644c4cc7988","previousFactIds":["2863f5ba3ed9c5a62a26d573c440bdf072f80e67eda6443925cf518322e60279","2f6c5f181826c94d6cf36c1f756a95b374a1a7251fbbc695139cbc564442a658","439b1e935ac40153f58fa33fb7bc0c534d39df8d16096f34be856bfa9ab5567a","6ee0d075221c3b1c5fb273c55f803a3e6233ea49c7c7002f31e03b55c1416fdb","6f5ae0ff049352d2d43c42b5b01d4557883fc7115faf385f1c702e930b7063ca","ab9ef2015bde717d70eb9307e7d517122332e3d720db9a1688bbc7bd9270af2a","c637aae16b4f5cfe9431ae4036192e3f5accd83289a1459bab8fd816ef95047d","ccc8786663cec66b045d7b5b069bb52416c10acd2fb2eaed1bcf3e8228b83a21","ffb572d6ac9750c173c3b3e210689cb07a4a35f4645fe2a8fc9f30575f39238a"],"previousPacketSha256":"ef702a1e4c86d4deb84c3bfdd92fc07fc06d6781abf49575758202a239b41642","reviewStatus":"not-reviewed"}
|
upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/screen.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/snapshot.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
upstream/releases/4c2defa47da65a1c4e9b7d7f2e6f1a3cbd52fa23708981b821ce69d09ca298b9/study.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"asOf":"2026-10-02T10:07:28Z","automaticallyReviewedGuidanceCount":0,"changedContextCount":2128,"companyCount":625,"comparisonReasons":{"changed-comparative-requires-review":80,"no-compatible-prior-annual-period":40,"nonpositive-prior-denominator":83,"same-concept-annual-arithmetic":2147},"method":"Same-concept annual arithmetic only. Different comparative values, ambiguous periods and nonpositive denominators suppress growth. No cross-company economic ranking.","profiles":{"Banking and credit":34,"Chemicals and pharmaceuticals":38,"Communications and utilities":53,"Equipment and electronics":134,"Insurance":35,"Other finance and real estate":34,"Other manufacturing":55,"Other operating companies":58,"Real estate trusts":32,"Resources and construction":24,"Software and computer services":60,"Trade":50,"Transport":18},"publisher":"AhaSignals"}
|