Skip to content

Commit 91db332

Browse files
committed
Checkpoint local Company, Time and Tariff client work
Save all remaining local source work at Billy's request. This is a source checkpoint, not a package or production release. Keep the existing version, compatibility, data-source and deployment holds in force. Remote main contains separately released changes and remains unchanged.
1 parent ff6c19f commit 91db332

9 files changed

Lines changed: 1226 additions & 25 deletions

File tree

‎README.md‎

Lines changed: 86 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,35 @@ Results are plain data. Pass a returned code or coordinate to another operation
4747

4848
Use `parse.postal("28202", country="US", deep=True)` for US ZIP tax references. `deep.tax` names the levy and `deep.tax_rate` is a percentage, so `7.9` means 7.9%. The state, county, city and special components explain that combined rate. An exact address can differ. Country and state lookups provide their own geographic reference rates, which should not be added to the ZIP rate. `None` means unknown and `0` means known zero. Country `deep.tax_id_format` and `deep.tax_id_regex` describe registration-number format only. Use `vat` for a metered registration check with `deep` explicitly enabled.
4949

50+
## Company directory
51+
52+
Find candidates, then fetch the profile you selected.
53+
54+
```python
55+
candidates = parse.company.search(query="GitLab", country="US", limit=5)
56+
selected_id = "co_caczn6wf36hj" # Explicitly chosen after reviewing candidates.
57+
profile = parse.company.id(selected_id, deep=True)
58+
if candidates["next"] is not None:
59+
next_page = parse.company.search(
60+
query="GitLab", country="US", limit=5, cursor=candidates["next"]
61+
)
62+
coverage = parse.company.coverage()
63+
```
64+
65+
Use at most one selector: `query` for a name, `domain`, `ticker`, or `identifier`; country or exact industry filters also allow discovery without a selector. The API validates selectors and filters. Use `country` to scope candidates, `exchange` with a ticker, and `authority` with an identifier. Search returns `companies` and an opaque `next` cursor. Review candidate identity and match details before choosing a stable Company ID. Pass `next` as `cursor` with the same selector, filters and limit to continue that result set.
66+
67+
Directory profiles are plain JSON data. `deep` belongs to each company in search results and adds legal/reference detail plus nullable `description`, `logo`, `founded`, and the `socials` and `sources` collections. A logo is a reported URL. `founded` has `value` and `precision`, distinct from incorporation. Sources identify the website, filing or business register, supported fields and observation/update timestamps. Employee observations retain count, measurement date, organization scope and approximation; null means unknown. Missing, null, empty and unknown fields retain their response values. An empty search is a successful result. Invalid inputs and unknown IDs raise the existing API error.
68+
69+
The recipe requests one candidate page, one explicitly chosen profile and directory coverage, plus a second page when a cursor is returned. Each operation uses the existing retry settings. The number-validation call remains unchanged. `lang` applies to national company-number lookup, while directory calls use the source labels.
70+
71+
`AsyncParseAPI` exposes the same `company`, `company.id`, `company.search` and `company.coverage` calls with `await`.
72+
73+
Discovery example: `parse.company.search(country="US", industry="0700", industry_type="sic")`
74+
75+
Supply `industry` and `industry_type` together. The supported namespace is `sic`, with an exact four-digit string such as `0700`; leading zeros are meaningful. Country-only discovery is also supported. Filters intersect and may narrow an existing selector. Country matches the profile country, not a headquarters or operating-presence claim. Unknown values do not match a requested filter. Filter-only candidates use `match.field: "filters"` and `match.value: null`; reuse the same filters and limit with a returned cursor. Counts describe this directory edition, not complete country coverage.
76+
77+
Reviewed `deep.registrations` retain the registry authority and exact number, registration jurisdiction, domestic role, legal form, administrative status and source-scoped formation date. Principal addresses keep their role and recorded text; they are not headquarters. Registration does not establish current operations or tax exemption. `[]` means no admitted registration facts; older responses may omit the field. Sources use `business_register` for these facts and preserve the original observation time; unknown record update times remain null.
78+
5079
## Calls
5180

5281
One method per endpoint, named after the route.
@@ -70,6 +99,11 @@ parse.postal.distance("28202", "10001", country="US")
7099
parse.address("1600 Pennsylvania Ave NW, Washington DC", country="US")
71100
parse.address.search("1600 Pennsylvania", country="US", postal="20500")
72101
parse.company("51 824 753 556", country="AU")
102+
parse.company.id("co_caczn6wf36hj", deep=True)
103+
parse.company.search(domain="about.gitlab.com")
104+
parse.company.search(ticker="GTLB", exchange="Nasdaq")
105+
parse.company.search(identifier="0001653482", authority="sec")
106+
parse.company.coverage()
73107
parse.city("charlotte", country="US")
74108
parse.city.id("city_mb8mbqrkz8zb")
75109
parse.city.search("char", country="US", limit=10)
@@ -147,13 +181,55 @@ Choose display names for one request:
147181
parse.country("DE", lang="fr")
148182
```
149183

150-
`lang` is optional on geography lookups and their lists/searches, Currency lookup, Language, Date, Time/Timezone, Emoji lookup/search, and unit discovery. IP, ASN, Company and NPI also accept it for their geographic labels. Codes, native names, quantities and response structure retain their meanings. Source coverage determines which labels are translated; unavailable labels use the API's documented fallback.
184+
`lang` is optional on geography lookups and their lists/searches, Currency lookup, Language, Date, Time/Timezone, Emoji lookup/search, and unit discovery. IP, ASN, national Company number lookup and NPI also accept it for their geographic labels. Codes, native names, quantities and response structure retain their meanings. Source coverage determines which labels are translated; unavailable labels use the API's documented fallback.
151185

152186
The next call keeps its usual default unless it also supplies `lang`. Existing `deep` rules still apply. Date `format` and measurement `locale` remain explicit input-parsing controls.
153187

154188
## Time
155189

156-
`time` returns local ISO `at` with its UTC offset and integer Unix seconds in `unix`. The core `offset` preserves exact precision. Optional `deep.offset_seconds` gives the numeric offset, while `deep.offset_minutes` gives whole minutes. Historical offsets and ISO times can include offset seconds. Omitted `at` means now. With `to`, an offsetless `at` is source wall time. Otherwise it is UTC. Include an offset for repeated local times around a clock change. Current time and conversion use pooled requests on every plan. Coordinate clock fields can be null when the timezone is unknown. Existing `timezone` methods remain supported.
190+
`time` returns local ISO `at` with its UTC offset and integer Unix seconds in `unix`. The core `offset` preserves exact precision. Optional `deep.offset_seconds` gives the numeric offset, while `deep.offset_minutes` gives whole minutes. Historical offsets and ISO times can include offset seconds. Omitted `at` means now. With `to` or `targets`, an offsetless `at` is source wall time. Otherwise it is UTC. Include an offset for repeated local times around a clock change. Current time and conversion use pooled requests on every plan. Coordinate clock fields can be null when the timezone is unknown. Existing `timezone` methods remain supported.
191+
192+
For an offsetless `at` with `to` or `targets`, choose how to handle a clock change with `disambiguation`. It applies to named-zone and coordinate Time calls.
193+
194+
| Value | Repeated time | Skipped time |
195+
| --- | --- | --- |
196+
| `compatible` (default) | Earlier occurrence | Shift forward by the clock change |
197+
| `earlier` | Earlier occurrence | Shift backward by the clock change |
198+
| `later` | Later occurrence | Shift forward by the clock change |
199+
| `reject` | `400 ambiguous_time` | `400 nonexistent_time` |
200+
201+
An explicit UTC offset selects an instant directly. For example, `2026-11-01T01:30:00-04:00` and `2026-11-01T01:30:00-05:00` identify the two New York occurrences. A valid `disambiguation` value has no effect on explicit instants, current-time requests or lookups without `to` or `targets`. For user-entered appointment times, start with `reject`. Handle `ambiguous_time` or `nonexistent_time` by collecting an explicit offset or an earlier/later choice from the user. Other malformed input still uses `invalid_request`.
202+
203+
```python
204+
result = parse.time("America/New_York", at="2026-11-01T01:30:00",
205+
to="UTC", disambiguation="later")
206+
print(result["to"]["at"]) # 2026-11-01T06:30:00+00:00
207+
```
208+
209+
Canonical Time `deep` includes the pinned rule edition in `deep.timezone_database_version` and source-wall resolution in `deep.resolution`. Resolution records `kind` (`unique`, `overlap` or `gap`), the selected policy, signed `adjustment_seconds`, and chronological alternatives with exact `at`, Unix seconds and UTC offset. Unique times have an empty alternatives list. Explicit instants, current time and lookups without conversion have null resolution. Destination detail stays compact.
210+
211+
Search serving IANA IDs by city or region, or omit the query to list all (Go and Rust use an empty string). Discovery returns `timezone_database_version` and sorted `timezones`. No search matches returns `timezones: []`.
212+
213+
Pass `targets` to convert one instant to 1-10 zones in a single pooled request. The native list preserves order and duplicates. Use `targets` instead of `to`. The response adds `targets`, with optional detail inside each target. Unknown source coordinates return `targets: null`. An unknown destination rejects the whole request with `not_found`. Omission keeps the original response shape.
214+
215+
```python
216+
zones = parse.time.zones('New York')
217+
result = parse.time('UTC', at='2026-09-24T12:00:00Z',
218+
targets=['America/New_York', 'Asia/Tokyo'])
219+
print(zones['timezones'], result['targets'])
220+
```
221+
222+
### Location inputs and timezone filters
223+
224+
`parse.time(iata="JFK", deep=True)` and `parse.time.zones(country="US", dst=False, observes_dst=True, details=True)`.
225+
226+
Choose one explicit location input: IP, exact city name or stable city ID, country, IATA airport, ICAO airport, port UN/LOCODE, or address. Country and state can narrow a city or address. State requires country. Address lookup requires US country context and a strict address-point match. Port lookup covers the reviewed port subset, not every assigned UN/LOCODE. IP lookup always uses the supplied IP.
227+
228+
Location calls add `location` with `status`, `candidates`, `truncated`, `source` and the typed input. Check `status` before using the clock: ambiguous or missing locations retain null time fields. Candidate coordinates and IDs can also be null. A country with multiple timezones does not silently choose one. Named-zone and coordinate calls retain their existing signatures.
229+
230+
Timezone discovery accepts country, IANA area, exact signed offset, abbreviation, DST-at-instant and observes-DST-during-year filters. `at` selects the common instant, `sort` selects timezone or offset order, and `details` adds `zones` rows plus the evaluation `at`. The default `timezones` list stays compact. False DST filters are sent explicitly. An abbreviation returns candidate zones rather than choosing one. Observes-DST uses the UTC calendar year containing `at`.
231+
232+
Source deep adds `standard_offset`, `standard_offset_seconds`, signed `dst_offset_seconds` and `season`. Seasonal adjustments can be negative. `season` describes the current DST-flag interval, or the next within 400 days, with actual before/after transition facts and signed `change_seconds`. Unknown boundaries remain null. These fields are optional and nullable, and destination deep stays compact.
157233

158234
## Measurements
159235

@@ -190,6 +266,12 @@ parse.weather(40.7128, -74.006, deep=True, date="2026-08-15")
190266
```
191267

192268
Tariff starts with the general schedule line. Paid deep adds units and the special and other schedule columns. An optional origin then resolves country-specific measures. The three calls below show those successive choices. Without origin, schedule detail is still returned and origin-dependent fields are null. A null effective rate is not a zero rate.
269+
Tariff lookup and search accept an optional `edition` fingerprint and `date` (`YYYY-MM-DD`). The edition pins exact immutable source bytes. A date is accepted only when verified source coverage exists. An edition without a date returns undated schedule context (`date: null`). Default requests use today. Paid detail exposes an open-string `reason` when `effective_rate` is null, including `incomplete_coverage`. A null rate never means zero. Explicit selections fail with `tariff_selection_mismatch` if an older server ignores the requested scope.
270+
271+
272+
Origin means where the goods originate, not where they ship from. The effective rate covers matched stored schedule measures only; it is not complete duty or landed cost.
273+
274+
Codes contain 4, 6, 8 or 10 ASCII digits; dots and whitespace are optional. Search returns up to 20 description matches with parent `lineage` so a result named “Other” has context. Search is not product classification. In deep, `measures: null` means origin-dependent measures were not resolved; `measures: []` means the resolved lookup found none.
193275

194276
```python
195277
parse.tariff("8471.30.01.00")
@@ -233,14 +315,14 @@ Choose enrichment for the question you need answered.
233315

234316
| Operation | What `deep` requests |
235317
|---|---|
318+
| NPI | All published taxonomies, reported license details, provider record dates and Medicare detail on paid plans. Primary specialty, exclusion flag and source metadata stay core. |
236319
| IP | Richer IP fields included with a paid plan. No separate check meter. |
237320
| Domain | Registration dates, registrar, status and DNSSEC, included with a paid plan. Use `dns` for DNS records and `mx` for mail routing. |
238321
| Email | A metered mailbox check with deliverability, catch-all, status, reason and address hints, using included email checks or enabled on-demand usage. |
239322
| VAT | A metered registry check where supported, using included VAT checks or enabled on-demand usage. |
240323
| Phone, Time, Date, Currency, Language, Emoji, Bank, Point | Optional detail in the same pooled request on every plan. |
241324
| Country, State, District, City, Postal | The place profile on paid plans, including demographic and tax facts where held. |
242325
| Name, Industry | Name evidence or the industry definition profile on paid plans. |
243-
| NPI | Deactivation date, Medicare enrollment, opt-out and enrollment rows from stored sources on paid plans. Exclusion evidence stays core. |
244326
| Vehicle, Tariff, Company | The complete product detail bag on paid plans. |
245327
| Weather | Specialist current measurements and the existing forecast, alert, air and history bag on paid plans. |
246328
| Carrier, HLR | Optional diagnostic detail within the same metered core unit, including Free allowance units. No second gate or additional check. |
@@ -322,7 +404,7 @@ before dispatch, accepted input is forwarded unchanged. Never send a full card n
322404

323405
## Optional detail
324406

325-
The default response answers the common task. Ask for `deep` when you need more detail about that same result. Core fields stay equal. City, Industry and Emoji searches put detail inside each result. Postal nearby and distance put metropolitan detail beside the entity it describes. Time conversion keeps target detail in `to.deep`; only the source has `deep.next_dst`.
407+
The default response answers the common task. Ask for `deep` when you need more detail about that same result. Core fields stay equal. City, Company directory, Industry and Emoji searches put detail inside each result. Postal nearby and distance put metropolitan detail beside the entity it describes. Time conversion keeps target detail in `to.deep` or each `targets` item; only the source has `deep.next_dst`.
326408

327409
```python
328410
basic = parse.time("America/New_York")

0 commit comments

Comments
 (0)