# SoftwareIQ bulk extraction guide

SoftwareIQ delivers company fundamentals, hiring demand and software adoption as consistent, versioned research datasets. Full snapshots provide a complete starting point; incremental releases maintain the same extract as observations and classifications evolve.

## Quality and reproducibility

- **Consistent identities and definitions.** Stable company and metric identifiers, fiscal periods, source units and classification versions support repeatable comparisons.
- **Traceable analytical context.** KPI lineage, versioned hiring dimensions and mapped adoption artifacts connect observations to their source and methodology.
- **Checked releases.** Typed schemas, primary-key/reference checks and file hashes support complete, verifiable loads. Each extract has a release identity you can retain with your research.

## Start here

Read `catalog.json` in your assigned bucket for available groups, exact tables, schemas and current-release pointers. Use approved AWS credentials and `RequestPayer="requester"` on reads. Access is provisioned separately for S3, MCP and Research. The MDB sample covers `siqco:mongodb` using the same delivery protocol.

## What is delivered

- `kpis`: `kpi_facts`, companies, metric definitions, dataset coverage and catalog. Guidance and financial dimension facts are not included.
- `jobs`: `job_postings_daily`, `job_postings_weekly`, companies, taxonomy, classifier versions, collection events, coverage and catalog. Rows are aggregated posting metrics, not individual advertisements, titles or descriptions.
- `adoption`: `adoption_daily` and `adoption_weekly`, companies, coverage and catalog.
- `adoption_versions`: `adoption_versions_daily` and `adoption_versions_weekly`, companies, coverage and catalog.

Use the listed tables as the scope of each bulk group. Adoption facts retain canonical project/artifact/version identifiers and source/entity/metric fields; their extended dictionaries are separately available through entitled MCP resources. Guidance and financial dimensions have separate channel availability. Determine each product's fact cohort from manifest `selection` and per-dataset coverage; company reference files support a broader shared identity universe.

## First run: load the current full snapshot

For hiring data, zero means a valid comparison found no new postings. Null means
the comparison is unavailable; preserve it through analysis and charts. An active
posting count can remain available when the new-posting comparison is unavailable.

1. Choose a product, such as `jobs`. Read `control/products/jobs/current.json`.
2. Fetch its `manifestKey`; verify the downloaded manifest's SHA-256 against `manifestSha256` before parsing/loading it.
3. Inspect table schemas and primary keys. Choose **one** format per table: `parquet` or `csv.gz`. Both represent the same rows; loading both duplicates observations.
4. Read every part in each selected table's `full[format]` list, including the reference tables you need. Verify each object's byte length, SHA-256 and row count. A table is generally many files, not one growing file. Use the manifest, not a bucket-wide wildcard or an object modification date.
5. Stage the full tables in your database, check keys and references, then atomically replace your local product dataset. Save the release ID only after the database commit succeeds. A successful download alone is not a successful load.

The example below **downloads** one complete jobs release into a new release-specific directory; it does not ingest a database or advance a consumer checkpoint. Set `SIQ_BUCKET` to the approved MDB sample bucket supplied during access setup. It also works with your approved paid bucket. Credentials use the normal AWS credential chain, never a token pasted into the snippet.

```python
import hashlib
import json
import os
from pathlib import Path
import boto3

s3 = boto3.client("s3", region_name="us-east-1")
bucket = os.environ["SIQ_BUCKET"]
product, fmt = "jobs", "parquet"  # choose one format, not both

def metadata(key):
    response = s3.get_object(Bucket=bucket, Key=key, RequestPayer="requester")
    try:
        data = response["Body"].read(8 * 1024 * 1024 + 1)
    finally:
        response["Body"].close()
    if len(data) > 8 * 1024 * 1024:
        raise ValueError("Oversized metadata")
    return data

pointer = json.loads(metadata(f"control/products/{product}/current.json"))
raw = metadata(pointer["manifestKey"])
assert hashlib.sha256(raw).hexdigest() == pointer["manifestSha256"]
manifest = json.loads(raw)
assert manifest["product"] == product
assert manifest["releaseId"] == pointer["releaseId"]
root = Path("siq-download") / manifest["releaseId"]
for table, entry in manifest["tables"].items():
    destination = root / table
    destination.mkdir(parents=True, exist_ok=True)
    for part in entry["full"][fmt]:
        response = s3.get_object(Bucket=bucket, Key=part["key"], RequestPayer="requester")
        path = destination / (part["sha256"] + "." + fmt)
        digest, size = hashlib.sha256(), 0
        try:
            with path.open("wb") as output:
                for block in response["Body"].iter_chunks(chunk_size=1024 * 1024):
                    size += len(block)
                    if size > part["bytes"]:
                        raise ValueError("Object exceeds manifest size")
                    digest.update(block)
                    output.write(block)
        finally:
            response["Body"].close()
        if size != part["bytes"] or digest.hexdigest() != part["sha256"]:
            path.unlink(missing_ok=True)
            raise ValueError("Object checksum/size mismatch")
print("Downloaded", manifest["releaseId"], "— validate and commit your load before checkpointing")
```

For individual files the equivalent CLI read is:

```sh
aws s3api get-object --bucket "$SIQ_BUCKET" --key "$SIQ_OBJECT_KEY" \
  --request-payer requester ./part.parquet
```

For a complete extract, use the manifest-based example above to discover and verify every required part. Start with the MDB sample, choose one format and select the tables needed. Manifest selection avoids downloading retained releases and alternate formats. S3 request and transfer charges follow your access arrangement.

## Inspect the downloaded data

Use PyArrow for Parquet decimal256(76,38) columns. Preserve Python Decimal objects and nulls; do not silently cast to float. Support varies by SQL engine. Bulk decimals have an exact transport representation; API/MCP JSON numeric representations are a separate wire format.

```python
import pyarrow.parquet as pq
# Replace with a verified file path from the chosen release.
rows = pq.read_table("verified-kpi-part.parquet").to_pylist()
print(rows[0]["company_id"], rows[0]["value"])
```

A DuckDB example over **verified local jobs files from one release** follows. Substitute the downloaded release directory; only jobs count/date/string columns are read here. For financial/adoption Parquet, check Decimal256 reader support first. Do not assume a narrower DECIMAL(38,12) preserves all values.

```sql
SELECT period_start, count AS active_postings,
       availability_status, continuity_status, is_comparable_to_previous
FROM read_parquet('siq-download/RELEASE_ID/job_postings_daily/*.parquet')
WHERE company_id = 'siqco:mongodb'
  AND record_type = 'observed_total'
  AND measure = 'active'
ORDER BY period_start;
```

Jobs deliver one integer `count`. Company active totals can include linear interpolation
across closed collection gaps of at most 14 calendar days with compatible reliable
anchors. Values are rounded to the nearest whole posting, with halves rounded up.
The legacy `observed_total` selector includes these company totals; `continuity_status`
is `estimated` on filled rows. Collection availability can remain unavailable even
when the total is filled. Existing comparison flags still apply.

Use `job_collection_events`, matched by company and affected date interval, for the
outage explanation and interpolation anchor dates. New-posting flows and dimensional
breakdowns are not reconstructed. Missing dimensional rows during an outage are
unknown, not zero; do not assume breakdowns reconcile to a filled company total.
Long/open outages remain null. An explicitly reviewed isolated zero week can be
interpolated across a migration using reliable surrounding captures; other migration
gaps remain null. The event explanation records the correction. Valid observed zeros,
including hiring freezes, remain zero.

Do not sum active stock across dates or add classified counts to observed totals. Select one compatible classification version for dimensional research and join taxonomy labels using the complete taxonomy/dimension/member key. Compare periods only when collection continuity supports it.

## CSV conventions

CSV is gzip-compressed UTF-8 with a header, standard CSV quoting, ISO dates/UTC timestamps and decimal text. Null is the literal `\N`; an empty field string is not null. String backslashes are doubled, so the literal string `\N` is encoded differently from null. Parse CSV quoting first, detect the null marker **before** undoing doubled string backslashes, and parse decimal text as Decimal. JSON-shaped reference attributes remain strings containing JSON, not nested Parquet objects. Use the delivered dictionary for column order and types.

## Later runs: apply net changes

Poll the product current pointer. If its release ID equals your committed checkpoint, stop. Otherwise fetch and hash-check the newest manifest and follow `predecessor` links back to your checkpoint using `releases/<product>/<releaseId>.json`. Reverse that chain and process oldest first. Validate each manifest's product and predecessor continuity; when following backward, match the referenced release ID to the fetched document. Check historical expiry before fetching its parts. A first-release upsert list can alias its full files; never load both for that release.

For each release, use `tables[table].deletes[format]` and `upserts[format]`; these are changes relative to that release's predecessor, not all changes since your last visit. Deletes contain **primary-key columns only**. Upserts contain complete rows. Apply both across your local product transaction:

```text
BEGIN
  assert saved_release_id == manifest.predecessor
  for each delivered table:
    delete rows matching every key in deletes (including composite keys)
    insert-or-replace complete rows in upserts by the dictionary primary key
  validate uniqueness and reference integrity after all table changes
  save manifest.releaseId in the same transaction
COMMIT
```

Use deferred constraints or stage all changes before the final merge; do not assume manifest table order is a foreign-key-safe write order. Empty change lists mean no changes for that table. Repeating a committed release is a no-op; a crash before commit rolls back the rows and checkpoint together. Never skip a predecessor or partially advance a checkpoint.

If your checkpoint is missing, the retained chain is unavailable, the schema changes, or the 30-day incremental window has elapsed, load the current full snapshot instead. A manifest with `requiresFullReload: true` starts a new schema baseline; initialize from its full files rather than replaying the superseded chain. You do not need a year of daily increments to initialize or recover. Current full data stays available regardless of its historical `fullExpiresAt`; old full snapshots are retained seven days and increments 30 days. Retain your own dated extracts if your research requires longer replay or as-known-at-the-time history.

## Freshness, failures and corrections

A current pointer identifies the last complete product release. Use that pointer and the delivered freshness metadata when scheduling downstream work. Each product has its own publication identity; pin the releases used in cross-dataset research. Delivery cadence and service commitments are agreed during onboarding.

`createdAt` describes S3 release creation. `company_dataset_coverage.data_updated_at` describes accepted source publication; economic periods describe when the observation applies. Website, MCP and bulk share definitions but can expose different publication times. For reproducibility keep the release ID, manifest hashes, source/coverage metadata, classifier versions, units and source-check references.

Maintained history incorporates corrections and classification updates through the full-snapshot and net-change protocol. Reproducing information available at an earlier historical date requires an appropriate retained vintage. Availability indicators distinguish observed activity from collection gaps; preserve unknown values as null. Adoption daily retention is up to 730 days where supported, with longer stored weekly history where available. Version membership is sparse and its first week can be partial. Daily npm version activity and reconstructed recovery intervals are estimates. Use the dataset definitions and period context when interpreting an inflection.

Access denied: check the assigned bucket, AWS identity and Requester Pays setting; MCP login is unrelated. Missing/expired files: reread the current pointer and reload its full baseline if history has expired. Checksum failure or broken predecessor chain: stop without advancing the local checkpoint. For support retain the product, release ID and failed key; never include credentials.

Documentation revision: 2a57773015fa3f312923557346501304152d411a797145c81599ef984cfa49f7
