mostlyright-data 0.31.37__tar.gz → 0.31.38__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/PKG-INFO +1 -1
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/commands.md +1 -1
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/satellite-signals.md +33 -13
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/enrichment.py +5 -4
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/router.py +2 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/v4_public.py +79 -4
- mostlyright_data-0.31.38/src/mostlyright/data_harness/thin/v4_public_pull.py +1391 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/vocabulary.py +3 -1
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/.gitignore +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/README.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/pyproject.toml +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/scripts/hatch_build.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/SKILL.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/agents/openai.yaml +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/1-open-the-page-and-the-link-to-it-in-the-first-message.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/2-brief-two-to-four-questions-each-with-a-recommended-answer.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/3-probe-read-a-source-before-committing-to-it.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/4-decide-say-what-you-chose-what-you-refused-and-ask-one-question.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/5-draft-one-recipe-document-one-call.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/6-build-one-run-sized-to-acquire-every-measured-source-whole.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/7-interrogate-ask-the-run-what-it-actually-delivered.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/8-fix-revise-the-document-and-register-it-again.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/9-present-only-what-survived-inspection-with-caveats.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/agent-protocol.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/autonomous-delivery.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/before-the-first-tool-call.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/boundaries.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/cloud-authentication-preflight.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/enriching-with-small-models.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/live-run.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/making-a-table-incremental.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/narrating-the-run.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/not-hosted-yet.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/one-install.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/patterns.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/predicting-with-tabular-models.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/prediction-labels.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/preparing-table-search.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/promote.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/readers.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/receipts.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/recipe-test.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/recording-a-stream-venue.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/recovering-an-import-failure.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/reference-pages.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/required-protocol.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/source-credentials.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/sources.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/the-one-thing-to-say-about-the-skill-itself.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/transforms.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/user-communication-contract.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/writing-a-decision-record.md +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/scripts/write_research_notebook.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/__init__.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/agent_protocol.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/canonical.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/key_seam.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/page_coverage.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/part_check_evidence.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/session_probes.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/skill_assets.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/table_manifest.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/__init__.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/activity.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/backoff.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/categories.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/dataset-categories-v1.json +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/dataset_layout.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/delivery.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/description_shape.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/download.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/fast_features.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/matching_benchmark.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/probe.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/progress_rate.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/progress_vocabulary.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/recipe.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/recipe_brief.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/recipe_explain.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/recipe_forecast.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/recipe_lint.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/recipe_test.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/refresh_rehearsal.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/release_check.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/research.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/run_diagnose.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/run_prefix.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/runs.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/session.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/stream.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/stream_venue.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/studio_capabilities.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/support.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/table_search_contract.json +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/table_view.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/transport.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/user_agent.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/v4.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/v4_artifacts.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/v4_catalog.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/v4_connected.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/v4_connections.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/v4_dataset_covers.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/v4_datasets.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/v4_handoff.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/v4_matching.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/v4_narrative.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/v4_query.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/v4_reader.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/v4_runs.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/v4_search.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/v4_search_contract.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/v4_secrets.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/v4_stream.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/v4_tables.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/ux/__init__.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/ux/attendance.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/ux/clarification.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/ux/cloud_auth.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/ux/commands/__init__.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/ux/commands/auth.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/ux/commands/clarify.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/ux/commands/login.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/ux/commands/whoami.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/ux/credential_native.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/ux/credential_store.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/ux/credentials.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/ux/login.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/ux/path_kind.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/ux/plain_file.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/ux/remediation.py +0 -0
- {mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/ux/render.py +0 -0
{mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/skills/mr-data-build/references/commands.md
RENAMED
|
@@ -19,7 +19,7 @@ run in full.
|
|
|
19
19
|
| `mr-data source` | `source inspect` takes a bounded look at one source, and it is the v4 path where `probe` is not. [Stage 3](3-probe-read-a-source-before-committing-to-it.md) says when to use it. It starts one of three ways, and each prints the `session_id`, `probe_id` and `source_id`, plus the `dataset_id` and `question_id` when it has them. For a new public HTTPS CSV that needs no key, give `--dataset-id`, `--question`, `--source-name`, `--source-url`, `--claimed-basis` and `--claim-evidence-digest`: it prepares the source and opens a session. For a source already prepared, give `--dataset-id`, `--question-id` and `--source-id`, which opens a session. In a session you already hold, give `--session-id` with `--source-id`. `--context-source-id` adds a source to a session it opens. `--session-id` with `--probe-id` reads the answer back; `--probe-id` alone is refused. A look is bounded to 65,536 bytes, 1,000 rows and 300 seconds. A larger file can fail `BYTE_LIMIT` after a wait, so read it by a bounded run of a scratch table. `queued` and `truncated` are not complete answers, and `capability_unavailable` means this deployment cannot inspect, so read the source by a bounded run of a scratch table instead, as [the probe rule](3-probe-read-a-source-before-committing-to-it.md#the-probe-rule-test-on-a-scratch-table-never-on-the-real-table) says. What it finds is exploratory evidence, not a run and not a receipt. |
|
|
20
20
|
| `mr-data reader` | `reader normalize --family-id ID --family-version VERSION --options-file FILE [--workspace-id ID]` asks the server's Reader service to apply one certified family's own defaults and option rules to a JSON object of options, at most 64 KiB, and prints the normalized `decode_options`, `decode_options_json` and `options_digest`. The second is the text a recipe carries as `reader.decode_options`, and the third is the `options_digest` a Generic API's `generic_api.response.reader` states for exactly those options. A connector pin takes no `reader.options_digest` parameter ([Readers](readers.md)). It changes nothing, and this client does not validate or invent a family's options: the server decides. Run it for every Reader pin before you register, so a wrong option is refused here and not inside a run. |
|
|
21
21
|
| `mr-data catalog` | `catalog search "QUESTION"` asks the sealed public-source catalogue which of its entries might answer a question and ranks them best first. Every ranked entry comes back with the disposition its own facts earned — `admitted`, `human_escalation_required` or `refused` — because an entry the catalogue could not vouch for is still a finding. `--format csv` states the one data format the question requires — one token per question, never repeated — and it is not a filter: an entry that does not declare that format still comes back ranked, with disposition `refused` and `filters_match` false, so nothing is held back; `--limit N` ranks at most N, up to 25. It fetches nothing and registers nothing. The catalogue holds one provider (Data.gov) and only part of it, so it is never exhaustive and an empty answer is not evidence that no such source exists. When the answer is `catalog_unavailable`, this deployment has no catalogue to search: record the lane and carry on. |
|
|
22
|
-
| `mr-data public` | Read Mostly Right's public dataset catalogue. `public search "QUERY"` ranks published datasets (`--topic`, `--limit` and `--cursor` narrow and page it), `show SLUG` reads one overview, `tables SLUG` lists its table identifiers, `schema TABLE_ID` reads one table's schema, `sample TABLE_ID` prints its published preview rows, `lookup "QUERY"` is the connector search shape and `fetch SLUG` returns the dataset's Markdown document. Those seven need no login. `query TABLE_ID`, with `--body` or `--body-file`, and `download-url TABLE_ID` do need `mr-data login`: they ask Cloud, with the device key, to run one query over a public table and to say how it can be downloaded. Preview rows are not a query, and no table bytes pass
|
|
22
|
+
| `mr-data public` | Read Mostly Right's public dataset catalogue. `public search "QUERY"` ranks published datasets (`--topic`, `--limit` and `--cursor` narrow and page it), `show SLUG` reads one overview, `tables SLUG` lists its table identifiers, `schema TABLE_ID` reads one table's schema, `sample TABLE_ID` prints its published preview rows, `lookup "QUERY"` is the connector search shape and `fetch SLUG` returns the dataset's Markdown document. Those seven need no login. `query TABLE_ID`, with `--body` or `--body-file`, and `download-url TABLE_ID` do need `mr-data login`: they ask Cloud, with the device key, to run one query over a public table and to say how it can be downloaded. Preview rows are not a query, and those commands pass no table bytes. `pull SLUG` writes the dataset into `DIR/SLUG/` (`--dir`, default `./datasets`; `--table TABLE_ID` repeats to pick tables): `README.md`, `dataset.json`, and per table `schema.json` and `sample.json`, all read-only. Only with `--data` does it add each table's `data.parquet`, and only where the publisher enabled download and an `mr_use_` key is in the `MOSTLYRIGHT_USE_KEY` environment variable; never pass the key as an argument. `--data` connects the dataset to the key's workspace and counts each download against its allowance, so leave it off unless the bytes are needed. A rerun asks Cloud whether a file it already verified is still current and keeps it when Cloud says so, and a failed table is recorded in `dataset.json` without stopping the others. |
|
|
23
23
|
| `mr-data connected` | `connected list` shows the public datasets connected to this workspace and `connected add SLUG` connects one by its slug. It needs `mr-data login`: both ask Cloud, with the device key, over the routes MCP's `list_connected_datasets` and `connect_dataset` use. |
|
|
24
24
|
| `mr-data ask` | `ask "QUESTION" [--run RUN_ID ...] [--failure-code CODE]` asks the Mostly Right support agent one question and waits for the answer; `--no-wait` prints the question id at once and `ask status QUESTION_ID` reads it later. It needs `mr-data login` and a workspace the agent is switched on for: while it is off the answer is `THIN_CLOUD_SUPPORT_AGENT_DISABLED`, which is final. The agent may file a problem for the Mostly Right team and prints its reference (`SR-N`). |
|
|
25
25
|
| `mr-data dataset` | Bring the dataset page into existence before there is anything on it, then fill it in while somebody watches. `dataset create --name TEXT` mints it and prints the `dataset_id`, unless the user's own request already has an empty dataset open, in which case it answers `open_request_reused` with that `dataset_id` and mints nothing (`--separate` mints a new one for a different dataset); `dataset show ID` reads it back; `dataset check ID` lists every delivery step the whole dataset still owes (cover, description shape, topics (never a licence), a real table that is unbuilt, queued, building, held or live on a build cut short, search and a saved view on the main table (the layout's `search_table_id` and `default_table_id` when it names them), cadence, failing refreshes, every `scratch_` table still listed), exits 2 and ends `Delivery open: N items.` while any is open, and exits 0 with `Delivery complete.` when none is (with `--json`, `status` is `dataset_delivery_open` or `dataset_delivery_complete`); `dataset set ID --name TEXT --topics "a,b,c" --license ID --description-file F` writes the title, the descriptive tags, the SPDX licence and the description under the version it was read at, retrying once if somebody else wrote first, and an empty `--topics` or `--license` takes that value off the page; send `--name` and `--topics` whenever you send `--description-file`, because a description sent on its own can make the server write a new title and new tags, and read `changed` and `written_by_studio` on the receipt for every field the write moved; a saved write whose public sync fails exits 2 and reports `public_projection_synced: false` — use `dataset sync ID` to retry that sync without writing the dataset again; `dataset note ID --heading H --blocks-file B` writes one cell of the decision record that OUTLIVES every run, and `--list` reads it back; `dataset watch ID` follows the page's own event stream; `dataset activity ID --phase P --message TEXT` says what is happening right now, silently, and is never a chat message and never a cell; `dataset publish ID [--mode public|link|private]` says who can read the dataset — `public` lists it in the public directory and serves it at an address anybody can read, `link` serves it at an unlisted address, `private` takes it back to the workspace — and `dataset publish ID --show` reads that back without changing it; `dataset layout ID` reads the dataset's layout from Cloud: its sections, `default_table_id` (the table the Data tab opens on), `search_table_id` (the table the dataset's search runs on), the main-table choice and the dataset's tables; `dataset layout ID --set LAYOUT.json` saves `{"version": 1, "default_table_id", "search_table_id", "sections": [{"id", "title", "collapsed", "tables": [{"table_id", "title", "description"}]}]}`, `--dry-run` has Cloud check it and save nothing, replacing a saved layout needs its revision as `--expected-revision`, and a first layout takes `--expected-main-table TABLE_ID|none`, the main-table choice the read printed; a stale one is refused `THIN_DATASET_LAYOUT_LAYOUT_CHANGED`, and it uses the device key; `dataset archive ID --confirm-name TITLE` retires the page and frees its title, deleting nothing. |
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
## Satellite signals
|
|
2
2
|
|
|
3
|
-
The `sat` binding turns free satellite images (Sentinel-1 radar, Sentinel-2 optical,
|
|
3
|
+
The `sat` binding turns free satellite images (Sentinel-1 radar, Sentinel-2 optical, Sentinel-5P
|
|
4
|
+
TROPOMI, NASA MODIS)
|
|
4
5
|
into table rows. A recipe sends it one place per upstream row, a point is enough, with one signal
|
|
5
6
|
name, and gets back a flat series for that place: one row per month, week, pass or composite.
|
|
6
7
|
|
|
@@ -47,10 +48,12 @@ The signals answer for most of the world's land. The free radar archive has regi
|
|
|
47
48
|
| `ships` | large ships at a port, anchorage or strait | Sentinel-1 radar and a ship detector | pass | ships at least 150 m long per pass | none |
|
|
48
49
|
| `crop_health` | greenness of cropland against the same time of year in earlier years | MODIS, 16-day composites, 250 m | pass (one composite) | mean NDVI, 0 to 1 | 5.4 km2 of cropland |
|
|
49
50
|
| `snow_cover` | share of the land under snow against the same time of year in earlier years | MODIS, 8-day maps, 500 m | pass (one map) | percent of the land under snow | 21.5 km2 of land |
|
|
51
|
+
| `no2` | nitrogen dioxide in the air over a site, net of a wide ring around it, against the same month in earlier years | Sentinel-5P TROPOMI, daily orbits, about 5.5 x 3.5 km pixels | month (or quarter; nothing finer) | NO2 column over the site minus the ring's median, umol/m2; falls towards zero when burning stops | 50 km2 |
|
|
50
52
|
|
|
51
|
-
`every` takes `pass`, `week`, `month` or `quarter` (`oil_storage`: `month` or `quarter`).
|
|
52
|
-
land signals were validated at `month` only; the other cadences are served but
|
|
53
|
-
may go back to 2014-10-10 for radar
|
|
53
|
+
`every` takes `pass`, `week`, `month` or `quarter` (`oil_storage` and `no2`: `month` or `quarter`).
|
|
54
|
+
The radar land signals and `no2` were validated at `month` only; the other cadences are served but
|
|
55
|
+
untested. A `from` may go back to 2014-10-10 for radar, to 2000-02-18 for MODIS and to 2018-04-30
|
|
56
|
+
for `no2`.
|
|
54
57
|
|
|
55
58
|
What each was checked against, so you can say how far to trust it:
|
|
56
59
|
|
|
@@ -74,6 +77,11 @@ What each was checked against, so you can say how far to trust it:
|
|
|
74
77
|
correlation 0.80 in Iowa and 0.85 in Illinois. Soybeans weak (0.52 and 0.17), Kansas wheat 0.58.
|
|
75
78
|
- `snow_cover`: late-April snow share in the central Sierra Nevada ranked 2001-2025 against 1 May
|
|
76
79
|
snow water at 16 SNOTEL stations with rank correlation 0.83.
|
|
80
|
+
- `no2`: lockdowns, the site level over three months against the same months a year earlier: Wuhan
|
|
81
|
+
2020-02 -45%, Shanghai 2022-04 -48%. Closures, the value as a year mean: Navajo coal plant (shut
|
|
82
|
+
2019-12) -87%, Port Talbot blast furnaces (shut 2024-10) -56%, Azovstal steel works (destroyed
|
|
83
|
+
2022-03) -77%. Madrid as a control moved +0%. Not shown: that it follows a plant's output month
|
|
84
|
+
to month.
|
|
77
85
|
|
|
78
86
|
### From what the person wants to a signal
|
|
79
87
|
|
|
@@ -87,6 +95,7 @@ What each was checked against, so you can say how far to trust it:
|
|
|
87
95
|
- New or unfinished vehicles piling up at a factory, port or lot: `stored_vehicles`.
|
|
88
96
|
- Crop condition in a growing region, for crop markets: `crop_health`.
|
|
89
97
|
- Snowpack and spring melt in a mountain basin: `snow_cover`.
|
|
98
|
+
- Air pollution over a city, or whether a power plant or steel works has stopped burning: `no2`.
|
|
90
99
|
|
|
91
100
|
Anything else (car counts, aircraft, people, yields, snow depth) is not a signal here. Say so.
|
|
92
101
|
|
|
@@ -106,7 +115,7 @@ refuses a body member it does not read (`UNKNOWN_FIELD`). The others:
|
|
|
106
115
|
| `from` | three years before `to`, resolved the first time a place is asked and then kept for that place, so its start never slides; `ships` at a place the service does not track: 60 days before that first request | Always, as a literal date such as `"2023-01-01"`, so the table starts on a fixed day. |
|
|
107
116
|
| `to` | the latest image | Leave it out, so a refresh reaches the newest image. A range wholly in the past never changes. |
|
|
108
117
|
| `every` | the natural cadence | See the table above. |
|
|
109
|
-
| `radius_km` | per signal | Where nothing is mapped near the point, or to widen the search. Write it as a string, `"0.5"`: a recipe takes whole numbers only. Allowed: `snow_cover` 0.5 to 150, `crop_health` 0.5 to 100, `truck_traffic` 0.5 to 25, every other signal above 0 and at most 30. |
|
|
118
|
+
| `radius_km` | per signal | Where nothing is mapped near the point, or to widen the search. Write it as a string, `"0.5"`: a recipe takes whole numbers only. Allowed: `snow_cover` 0.5 to 150, `crop_health` 0.5 to 100, `no2` 5 to 50 (default 15), `truck_traffic` 0.5 to 25, every other signal above 0 and at most 30. |
|
|
110
119
|
| `outline` | none | GeoJSON in lon/lat, from an upstream column, when the person has the exact boundary. It overrides the search. `truck_traffic` also takes a line along the road. |
|
|
111
120
|
| `detail` | none | `ships`: `"ships"` for one row per detected ship. `crop_health`: `"corn"`, `"soy"` or `"wheat"`, contiguous US only. `plant_heat`, `truck_traffic`, `water_area`: `"images"`. |
|
|
112
121
|
|
|
@@ -116,7 +125,8 @@ industrial area, motorway, lake) and says on every row what it measured.
|
|
|
116
125
|
The live catalogue is the request `{"model": "mostlyright-sat/sat-v1-PIN", "signal": "signals"}`:
|
|
117
126
|
one row per signal with `signal`, `measures`, `sensor`, `natural_cadence`, `value_means`,
|
|
118
127
|
`smallest_site_km2`, `coverage`, `example_request` and `attribution` (the signal's credit lines
|
|
119
|
-
with `[YEARS]` left for you to fill
|
|
128
|
+
with `[YEARS]` left for you to fill, and for `no2` also `[DATE]`, the day you read the answer).
|
|
129
|
+
This page's table is enough
|
|
120
130
|
to choose a signal. To read the catalogue, mostly for its `attribution` lines, build a scratch
|
|
121
131
|
table: an upstream file of one row with a `signal` column holding `signals`; a per-row request
|
|
122
132
|
whose one parameter is `signal` (a request needs at least one, and no `lat` or `lon`) and whose
|
|
@@ -132,14 +142,14 @@ Every row has the same 13 members, in this order, with null for an empty value:
|
|
|
132
142
|
| --- | --- |
|
|
133
143
|
| `date` | first day of the period; for a refused place, the day it was refused |
|
|
134
144
|
| `value` | the reading, in `unit` |
|
|
135
|
-
| `unit` | `dB`, `hot pixels`, `trucks`, `km2`, `ships`, `NDVI
|
|
136
|
-
| `baseline` | the site's own reference level. Radar land signals (`parking`, `oil_storage`, `site_change`, `stored_vehicles`): the year of passes before `from`, read from the imagery but not rows of the table. `plant_heat`, `truck_traffic`, `water_area`: the first year of the table's own range, whose periods are never in alarm. `ships`: the median of the first 60 days of the place's history. MODIS signals
|
|
145
|
+
| `unit` | `dB`, `hot pixels`, `trucks`, `km2`, `ships`, `NDVI`, `%` or `umol/m2` |
|
|
146
|
+
| `baseline` | the site's own reference level. Radar land signals (`parking`, `oil_storage`, `site_change`, `stored_vehicles`): the year of passes before `from`, read from the imagery but not rows of the table. `plant_heat`, `truck_traffic`, `water_area`: the first year of the table's own range, whose periods are never in alarm. `ships`: the median of the first 60 days of the place's history. MODIS signals and `no2`: the same period in earlier years |
|
|
137
147
|
| `change` | `value` minus `baseline` |
|
|
138
148
|
| `z` | `change` in units of the site's own noise |
|
|
139
149
|
| `alarm` | true in periods inside a sustained change |
|
|
140
150
|
| `images` | how many images or passes the period is built from |
|
|
141
151
|
| `status` | `ok`, or the code naming why the place could not be measured |
|
|
142
|
-
| `note` | empty when ok; for a refusal, what went wrong and what to change, in one sentence |
|
|
152
|
+
| `note` | empty when ok, except `no2`, which gives the site and ring levels and marks provisional rows; for a refusal, what went wrong and what to change, in one sentence |
|
|
143
153
|
| `site_source` | what was measured, such as `openstreetmap parking polygons`, `circle 0.5 km`, `caller outline` |
|
|
144
154
|
| `site_offset_km` | how far the measured footprint is from the point given |
|
|
145
155
|
| `site_area_km2` | the area measured |
|
|
@@ -172,7 +182,7 @@ coverage count of rows that sent nothing.
|
|
|
172
182
|
| `BAD_COORDINATES` | `lat` or `lon` is missing, not a number or out of range | Fix the cell; decimal degrees, latitude first. |
|
|
173
183
|
| `BAD_DATE_RANGE` | `from` or `to` is not an ISO date, out of order, in the future, or before the signal's imagery starts | Fix the date. |
|
|
174
184
|
| `BAD_EVERY` | `every` is not a cadence this signal offers | Use one the table lists. |
|
|
175
|
-
| `BAD_RADIUS` | `radius_km` is outside the signal's range | Use a value inside it: `snow_cover` 0.5 to 150, `crop_health` 0.5 to 100, `truck_traffic` 0.5 to 25, every other signal above 0 and at most 30. |
|
|
185
|
+
| `BAD_RADIUS` | `radius_km` is outside the signal's range | Use a value inside it: `snow_cover` 0.5 to 150, `crop_health` 0.5 to 100, `no2` 5 to 50, `truck_traffic` 0.5 to 25, every other signal above 0 and at most 30. |
|
|
176
186
|
| `BAD_DETAIL` | `detail` is not one this signal offers | Use one the request table lists, or leave it out. |
|
|
177
187
|
| `OUTLINE_INVALID` | `outline` is not valid GeoJSON of a type the signal takes | Fix it, or send the point. |
|
|
178
188
|
| `AREA_TOO_LARGE`, `SITE_TOO_LARGE` | the footprint or water box is larger than the signal measures | Use a smaller `radius_km` or outline, one row per part. |
|
|
@@ -201,8 +211,9 @@ Outside the rows, the service answers:
|
|
|
201
211
|
No answer of the service carries `Retry-After`.
|
|
202
212
|
|
|
203
213
|
A first build of many places is slow. First calls with an empty cache were measured at 9 to 80
|
|
204
|
-
seconds per place for the site signals and about 120 seconds for `ships
|
|
205
|
-
100-second hold, so a first `ships` request is answered
|
|
214
|
+
seconds per place for the site signals and about 120 seconds for `ships` and for `no2` over its
|
|
215
|
+
full history, which is past the 100-second hold, so a first `ships` or `no2` request is answered
|
|
216
|
+
503 once and served on the retry. Ship
|
|
206
217
|
detection runs on one GPU instance, so a first build of N ports takes roughly N x 60 / 8 to
|
|
207
218
|
N x 60 seconds. A place still answered 503 after the worker's attempts fails the run with
|
|
208
219
|
`ROW_REQUEST_UNAVAILABLE`, so a large first build may need more than one run. Run it again: each
|
|
@@ -268,6 +279,15 @@ check that no place that had a series now has only one status row.
|
|
|
268
279
|
those periods have no row.
|
|
269
280
|
- `snow_cover`: snow extent, not depth or water content. It saturates in mid-winter at height and
|
|
270
281
|
says most during spring melt. Dense forest reads low.
|
|
282
|
+
- `no2`: NO2 in the air over the site at about 13:30 local time on clear days, not emissions. Wind
|
|
283
|
+
carries a plume out of a small footprint, and a still month reads higher than a windy one for
|
|
284
|
+
the same output. It has not been shown to follow a plant's output month to month: read small
|
|
285
|
+
changes as weather until a step persists. The ring takes out the regional level, so a change
|
|
286
|
+
across the whole region shows only where the site differs. The record starts in 2018, so rows
|
|
287
|
+
before 2021 have no baseline. Cloudy months and high-latitude winters have no row. The offline
|
|
288
|
+
record runs about 11 days behind; near-real-time orbits fill the newest days, those rows say
|
|
289
|
+
provisional in `note`, and they are measured again from the offline record when it reaches
|
|
290
|
+
them.
|
|
271
291
|
- Every signal measures change against the site's own history. Compare a site with itself, not
|
|
272
292
|
one site's level with another's.
|
|
273
293
|
|
|
@@ -301,7 +321,7 @@ carries only the lines that apply.
|
|
|
301
321
|
- Nothing sharper than 10 m, and no individual vehicles.
|
|
302
322
|
- No daily or real-time figures: a radar pass comes every few days and a month is built from a
|
|
303
323
|
handful of them.
|
|
304
|
-
- No absolute quantities: barrels, tonnes of steel, crop yields
|
|
324
|
+
- No absolute quantities: barrels, tonnes of steel, crop yields, snow water or emissions. Each signal tracks
|
|
305
325
|
change, and the checks above are correlations.
|
|
306
326
|
- No ship history from `from` at an untracked place: it begins about 60 days before the table
|
|
307
327
|
was first built.
|
|
@@ -131,10 +131,11 @@ TASKS: tuple[dict[str, str], ...] = (
|
|
|
131
131
|
"task": "observe",
|
|
132
132
|
"what": (
|
|
133
133
|
"Measure activity at a place anywhere in the world from free Sentinel and MODIS "
|
|
134
|
-
"satellite data, with
|
|
135
|
-
"stored_vehicles, plant_heat, truck_traffic, water_area, ships, crop_health
|
|
136
|
-
"snow_cover. One per-row request per place (lat, lon); each answer is a time
|
|
137
|
-
"one row per period, with a status column naming why a place could not be
|
|
134
|
+
"satellite data, with eleven signals: parking, oil_storage, site_change, "
|
|
135
|
+
"stored_vehicles, plant_heat, truck_traffic, water_area, ships, crop_health, "
|
|
136
|
+
"snow_cover and no2. One per-row request per place (lat, lon); each answer is a time "
|
|
137
|
+
"series, one row per period, with a status column naming why a place could not be "
|
|
138
|
+
"measured."
|
|
138
139
|
),
|
|
139
140
|
"when_not_served": "The satellite signals service is not served on this deployment.",
|
|
140
141
|
},
|
{mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/router.py
RENAMED
|
@@ -548,6 +548,7 @@ def _exit_codes() -> dict[str, Callable[[dict[str, Any]], int]]:
|
|
|
548
548
|
v4_connected,
|
|
549
549
|
v4_datasets,
|
|
550
550
|
v4_matching,
|
|
551
|
+
v4_public,
|
|
551
552
|
v4_query,
|
|
552
553
|
v4_runs,
|
|
553
554
|
v4_search,
|
|
@@ -571,6 +572,7 @@ def _exit_codes() -> dict[str, Callable[[dict[str, Any]], int]]:
|
|
|
571
572
|
"dataset": v4_datasets.dataset_exit_code,
|
|
572
573
|
"recipe": recipe_module.propose_exit_code,
|
|
573
574
|
"connected": v4_connected.connected_exit_code,
|
|
575
|
+
"public": v4_public.public_exit_code,
|
|
574
576
|
"ask": support_module.ask_exit_code,
|
|
575
577
|
}
|
|
576
578
|
|
{mostlyright_data-0.31.37 → mostlyright_data-0.31.38}/src/mostlyright/data_harness/thin/v4_public.py
RENAMED
|
@@ -19,6 +19,11 @@ Command map (MCP tool → CLI verb):
|
|
|
19
19
|
* ``sample_rows`` → ``mr-data public sample``
|
|
20
20
|
* ``search`` (connector) → ``mr-data public lookup``
|
|
21
21
|
* ``fetch`` (connector) → ``mr-data public fetch``
|
|
22
|
+
|
|
23
|
+
``mr-data public pull SLUG`` has no MCP twin: it writes the dataset into a local folder, and with
|
|
24
|
+
``--data`` and an ``mr_use_`` key in ``MOSTLYRIGHT_USE_KEY`` the tables' Parquet snapshots too
|
|
25
|
+
(:mod:`mostlyright.data_harness.thin.v4_public_pull`). MCP's ``get_download_instructions`` is its
|
|
26
|
+
counterpart there.
|
|
22
27
|
"""
|
|
23
28
|
|
|
24
29
|
from __future__ import annotations
|
|
@@ -82,6 +87,7 @@ ACTIONS: tuple[str, ...] = (
|
|
|
82
87
|
"fetch",
|
|
83
88
|
"query",
|
|
84
89
|
"download-url",
|
|
90
|
+
"pull",
|
|
85
91
|
)
|
|
86
92
|
|
|
87
93
|
DATASETS_PATH = "/api/v2/public/datasets"
|
|
@@ -144,6 +150,24 @@ _NEXT = {
|
|
|
144
150
|
"public_document_fetched": (
|
|
145
151
|
"Cite the dataset by url. For machine-readable table ids call mr-data public show."
|
|
146
152
|
),
|
|
153
|
+
"public_dataset_pulled": (
|
|
154
|
+
"Read README.md and dataset.json in the pulled folder; each table folder holds "
|
|
155
|
+
"schema.json, sample.json and, where download was enabled, data.parquet."
|
|
156
|
+
),
|
|
157
|
+
"public_dataset_pulled_metadata": (
|
|
158
|
+
"Metadata is written. Rerun with --data and an mr_use_ key in MOSTLYRIGHT_USE_KEY to add "
|
|
159
|
+
"the Parquet snapshots; that connects the dataset to the key's workspace and counts "
|
|
160
|
+
"against its allowance."
|
|
161
|
+
),
|
|
162
|
+
"public_dataset_pulled_no_key": (
|
|
163
|
+
"Metadata is written, but --data found no key. Mint an mr_use_ key on the dataset page, "
|
|
164
|
+
"export it as MOSTLYRIGHT_USE_KEY and run mr-data public pull SLUG --data again; that "
|
|
165
|
+
"connects the dataset to the key's workspace and counts against its allowance."
|
|
166
|
+
),
|
|
167
|
+
"public_dataset_pulled_partially": (
|
|
168
|
+
"Some tables did not pull; each failed table's entry names its code. Run mr-data public "
|
|
169
|
+
"pull SLUG again to retry: a verified local file is revalidated, not downloaded twice."
|
|
170
|
+
),
|
|
147
171
|
}
|
|
148
172
|
|
|
149
173
|
|
|
@@ -154,7 +178,8 @@ def declare_arguments(parser: argparse.ArgumentParser) -> None:
|
|
|
154
178
|
"Read Mostly Right's public dataset catalogue anonymously — the same "
|
|
155
179
|
"HTTP surface the MCP anonymous tools call. No login. Search published "
|
|
156
180
|
"datasets, show one, list its tables, read a table schema, sample "
|
|
157
|
-
"preview rows, or fetch the Markdown document."
|
|
181
|
+
"preview rows, or fetch the Markdown document. pull writes a dataset "
|
|
182
|
+
"into a local folder (Parquet only with --data and an mr_use_ key in MOSTLYRIGHT_USE_KEY)."
|
|
158
183
|
)
|
|
159
184
|
parser.add_argument(
|
|
160
185
|
"action",
|
|
@@ -163,7 +188,8 @@ def declare_arguments(parser: argparse.ArgumentParser) -> None:
|
|
|
163
188
|
"search lists/ranks public datasets; show reads one overview; "
|
|
164
189
|
"tables lists table ids; schema reads one table schema; sample "
|
|
165
190
|
"returns published preview rows; lookup is the connector search "
|
|
166
|
-
"shape; fetch returns the Markdown document"
|
|
191
|
+
"shape; fetch returns the Markdown document; pull writes the dataset "
|
|
192
|
+
"into DIR/SLUG"
|
|
167
193
|
),
|
|
168
194
|
)
|
|
169
195
|
parser.add_argument(
|
|
@@ -171,7 +197,7 @@ def declare_arguments(parser: argparse.ArgumentParser) -> None:
|
|
|
171
197
|
nargs="?",
|
|
172
198
|
default=None,
|
|
173
199
|
help=(
|
|
174
|
-
"for search/lookup: the query string; for show/tables/fetch: the "
|
|
200
|
+
"for search/lookup: the query string; for show/tables/fetch/pull: the "
|
|
175
201
|
"dataset slug; for schema/sample: the table UUID"
|
|
176
202
|
),
|
|
177
203
|
)
|
|
@@ -207,6 +233,9 @@ def declare_arguments(parser: argparse.ArgumentParser) -> None:
|
|
|
207
233
|
dest="body_file",
|
|
208
234
|
help="path to a JSON object body for public query",
|
|
209
235
|
)
|
|
236
|
+
from mostlyright.data_harness.thin import v4_public_pull
|
|
237
|
+
|
|
238
|
+
v4_public_pull.declare_arguments(parser)
|
|
210
239
|
|
|
211
240
|
|
|
212
241
|
def resolve_public_origin(
|
|
@@ -240,6 +269,12 @@ class PublicCatalogClient:
|
|
|
240
269
|
def cloud_url(self) -> str:
|
|
241
270
|
return self._origin
|
|
242
271
|
|
|
272
|
+
@property
|
|
273
|
+
def transport(self) -> Transport:
|
|
274
|
+
"""The transport this client reads through, which ``public pull`` streams bytes over."""
|
|
275
|
+
|
|
276
|
+
return self._transport
|
|
277
|
+
|
|
243
278
|
def _headers(self, *, accept: str = "application/json") -> dict[str, str]:
|
|
244
279
|
return with_user_agent(
|
|
245
280
|
{
|
|
@@ -736,7 +771,12 @@ def _tables(args: argparse.Namespace, client: PublicCatalogClient) -> dict[str,
|
|
|
736
771
|
|
|
737
772
|
|
|
738
773
|
def _schema(args: argparse.Namespace, client: PublicCatalogClient) -> dict[str, Any]:
|
|
739
|
-
|
|
774
|
+
return schema_receipt(_require_table_id(args.target), client)
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
def schema_receipt(table_id: str, client: PublicCatalogClient) -> dict[str, Any]:
|
|
778
|
+
"""``mr-data public schema TABLE_ID``'s receipt for a checked table id."""
|
|
779
|
+
|
|
740
780
|
try:
|
|
741
781
|
body = client.get_table_schema(table_id)
|
|
742
782
|
except ThinLaneError as error:
|
|
@@ -765,6 +805,12 @@ def _sample(args: argparse.Namespace, client: PublicCatalogClient) -> dict[str,
|
|
|
765
805
|
maximum=MAX_SAMPLE_LIMIT,
|
|
766
806
|
label="--limit",
|
|
767
807
|
)
|
|
808
|
+
return sample_receipt(table_id, client, limit=limit)
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
def sample_receipt(table_id: str, client: PublicCatalogClient, *, limit: int) -> dict[str, Any]:
|
|
812
|
+
"""``mr-data public sample TABLE_ID``'s receipt for a checked id and limit."""
|
|
813
|
+
|
|
768
814
|
try:
|
|
769
815
|
body = client.get_table_preview(table_id)
|
|
770
816
|
except ThinLaneError as error:
|
|
@@ -1083,6 +1129,12 @@ def _download_url(args: argparse.Namespace, client: Any = None) -> dict[str, Any
|
|
|
1083
1129
|
}
|
|
1084
1130
|
|
|
1085
1131
|
|
|
1132
|
+
def _pull(args: argparse.Namespace, client: PublicCatalogClient) -> dict[str, Any]:
|
|
1133
|
+
from mostlyright.data_harness.thin import v4_public_pull
|
|
1134
|
+
|
|
1135
|
+
return v4_public_pull.pull(args, client)
|
|
1136
|
+
|
|
1137
|
+
|
|
1086
1138
|
_HANDLERS = {
|
|
1087
1139
|
"search": _search,
|
|
1088
1140
|
"show": _show,
|
|
@@ -1093,9 +1145,18 @@ _HANDLERS = {
|
|
|
1093
1145
|
"fetch": _fetch,
|
|
1094
1146
|
"query": _query,
|
|
1095
1147
|
"download-url": _download_url,
|
|
1148
|
+
"pull": _pull,
|
|
1096
1149
|
}
|
|
1097
1150
|
|
|
1098
1151
|
|
|
1152
|
+
def public_exit_code(receipt: Mapping[str, Any]) -> int:
|
|
1153
|
+
"""Every ``public`` verb reports and exits ``0``, except a pull with a failed table."""
|
|
1154
|
+
|
|
1155
|
+
from mostlyright.data_harness.thin import v4_public_pull
|
|
1156
|
+
|
|
1157
|
+
return v4_public_pull.pull_exit_code(receipt)
|
|
1158
|
+
|
|
1159
|
+
|
|
1099
1160
|
def public(
|
|
1100
1161
|
args: argparse.Namespace, *, client: PublicCatalogClient | None = None
|
|
1101
1162
|
) -> dict[str, Any]:
|
|
@@ -1135,6 +1196,7 @@ def public(
|
|
|
1135
1196
|
"lookup",
|
|
1136
1197
|
"query",
|
|
1137
1198
|
"download-url",
|
|
1199
|
+
"pull",
|
|
1138
1200
|
}
|
|
1139
1201
|
and not args.target
|
|
1140
1202
|
):
|
|
@@ -1147,6 +1209,7 @@ def public(
|
|
|
1147
1209
|
"lookup": "a query string",
|
|
1148
1210
|
"query": "a table UUID",
|
|
1149
1211
|
"download-url": "a table UUID",
|
|
1212
|
+
"pull": "a dataset slug",
|
|
1150
1213
|
}[action]
|
|
1151
1214
|
raise ThinLaneError("THIN_REQUEST_INVALID", f"public {action} needs {needed}")
|
|
1152
1215
|
if action != "query" and (
|
|
@@ -1156,6 +1219,15 @@ def public(
|
|
|
1156
1219
|
"THIN_REQUEST_INVALID",
|
|
1157
1220
|
f"--body/--body-file apply to public query, not public {action}",
|
|
1158
1221
|
)
|
|
1222
|
+
if action != "pull":
|
|
1223
|
+
from mostlyright.data_harness.thin import v4_public_pull
|
|
1224
|
+
|
|
1225
|
+
stray = v4_public_pull.stray_pull_flags(args)
|
|
1226
|
+
if stray:
|
|
1227
|
+
raise ThinLaneError(
|
|
1228
|
+
"THIN_REQUEST_INVALID",
|
|
1229
|
+
f"{', '.join(stray)} apply to public pull, not public {action}",
|
|
1230
|
+
)
|
|
1159
1231
|
if action in {"query", "download-url"}:
|
|
1160
1232
|
return _HANDLERS[action](args, client)
|
|
1161
1233
|
selected = _client(args, client=client)
|
|
@@ -1192,6 +1264,9 @@ __all__ = [
|
|
|
1192
1264
|
"declare_arguments",
|
|
1193
1265
|
"is_public_slug",
|
|
1194
1266
|
"public",
|
|
1267
|
+
"public_exit_code",
|
|
1195
1268
|
"resolve_public_origin",
|
|
1269
|
+
"sample_receipt",
|
|
1270
|
+
"schema_receipt",
|
|
1196
1271
|
"show_public_dataset",
|
|
1197
1272
|
]
|