RainbowStats Command Reference

SOCRATA_DAILY

Aggregate timestamped Socrata observations into a daily series using an explicit rule.

Syntax

SOCRATA_DAILY("DatasetID","APIHeader","Aggregation")
AggregationMeaning
SUMSum nonmissing values for the day. Appropriate for counts such as hourly bicycle crossings.
MEANArithmetic mean of nonmissing rows for the day. Each observed row has equal weight.
LASTLast nonmissing finite value in timestamp order for the day. Conflicting values at the same timestamp produce an error.

Daily bicycle crossings

North=SOCRATA_DAILY("2z5v-ecg8","bike_north","SUM")
South=SOCRATA_DAILY("2z5v-ecg8","bike_south","SUM")
DailyBikes=SET_NAME(North+South,"Burke-Gilman daily bicycle crossings")
LINE_CHART(DailyBikes)

Counts record crossings at the sensor, not distinct cyclists. Pedestrian fields are excluded from this example.

Scope and missing data

All rows in a day are included. A dataset containing several entities or categories will aggregate across those entities. Use a filtered dataset or a dataset-specific source when a single entity is required.

A numeric field and one unambiguous usable date/time field are required. Buckets follow the source calendar day. Entirely missing days are omitted; genuine observed zeros are retained. Partial days are aggregated from their observed values, without imputing missing hours. No percentage, currency, or timezone conversion is performed.

Retrieval

SUM and MEAN use Socrata grouping and return up to 100,000 daily groups. LAST reads ordered source rows, with a 2,000,000-row safety limit. Downloads use the existing six-hour cache. The result is a standard RainbowStats series.

Related commands

SOCRATA_META · SOCRATA_SEARCH · SOCRATA