RainbowStats Command Reference
SOCRATA
Read a numeric field from a public Socrata dataset into a RainbowStats time series or cross section.
Returns a series or cross section
Syntax
SOCRATA("DatasetID","APIHeader")| Argument | Meaning |
|---|---|
DatasetID | Socrata identifier, such as qwib-edaw. The catalog resolves its portal. |
APIHeader | Exact numeric API field name from SOCRATA_SEARCH. A uniquely matching display name is also accepted. |
How the return type is selected
| Dataset structure | Result |
|---|---|
| One usable numeric value per date | A time series, ordered from oldest to newest date. |
| Multiple usable rows on the same date | The reader attempts a cross section at the latest reported date. It needs a recognizable entity key and one value per key. |
| No date field, but a field named year | A cross section for the latest year, labeled at December 31 of that year. It does not automatically become an annual time series. |
| No date or year field | A cross section of the available rows, labeled as a retrieval snapshot. Its date is not an observation date. |
Cross-section entities are identified using common fields such as FIPS, GEOID, jurisdiction, county, state, country, or name. For dated datasets, the selected latest date or year is shared across the result; the reader does not separately select the latest observation for each entity.
Time series example
Visits=SOCRATA("qwib-edaw","total_covid_daily")
LINE_CHART(Visits)This historical Chicago field counts COVID-19 diagnoses in emergency departments by date. The source is archived; use its dataset page for the replacement datasets.
Cross-section example
CountyCrime=SOCRATA("jwfa-fdxs","violent_crime_rate_per_100_000_people")The Maryland crime dataset has jurisdiction and year fields. The reader selects the latest available year and returns one crime-rate value per jurisdiction. Read the source definitions before treating all jurisdictions as comparable counties or combining the result with other geography keys.
Missing values and coverage
Rows without a usable date or numeric value are skipped. Blank and nonfinite values are not replaced with zero. The first and last points therefore describe coverage of the selected field, which can be shorter than the dataset’s overall date range.
SOCRATA("qwib-edaw","total_cli_daily") ends in June 2021 because later values in that field are blank. Switching to total_covid_daily retrieves the longer populated field; no paging change is needed.Datasets that need more control
The two-argument command does not accept filters, aggregations, a selected entity, or an explicit date/key field. Repeated entity keys, ambiguous date fields, unsupported numeric fields, or unrecognized identifiers produce an error rather than an arbitrary aggregation.
A dataset containing several measures per entity often needs a dataset-specific source. Use CFTC_TFF for financial futures positioning by contract. Date/time values are interpreted as calendar days in this reader; intraday observations are not preserved as separate time points.
Retrieval and limits
The reader resolves a public dataset ID through the US catalog, then the EU catalog if no US match exists. An ID found on multiple portals is rejected. Responses are paged with a 100,000-row safety limit, and downloaded data are cached for six hours. A saved response may be used if a refresh fails.
Read the dataset page for units, license, methodology, update schedule, and archival status. Numeric values are returned in their source units; the command does not rescale percentages or currency.