Praxis Java Stats Export Authoring
Treat stats and export as governed resource operations. They must reuse canonical
filter, selection, field governance, capability, and discovery contracts; never
become browser aggregation, ad hoc CSV endpoints, or a way to bypass exposure policy.
Establish The Analytic Or Export Question
Inspect resource semantics, query/service, filters, field governance, existing
stats registry/support mode, collection export capability, consumer, fixtures,
and focused tests. Decide whether a field is a dimension, measure, bucket,
exportable value, or explicitly excluded. Do not infer aggregation from Java type:
an identifier, document, amount, rate, or status needs business evidence.
Classify a metric, dimension, stat endpoint, export field, format, scope, limit,
or header as ja-suportado-so-ux, ja-suportado-mal-nomeado-ou-mal-materializado,
suportado-parcialmente, or lacuna-real-de-contrato. A missing analytical
operation belongs in the canonical starter/service owner, not in a table component.
Author The Resource Operation
- Register analytics through
StatsFieldRegistry and the resource's
StatsSupportMode. Remember that AbstractBaseQueryResourceService defaults
getStatsFieldRegistry() to StatsFieldRegistry.empty() and defaults
getGroupByStatsSupportMode(), getTimeSeriesStatsSupportMode(),
getDistributionStatsSupportMode(), and getComparisonStatsSupportMode() to
StatsSupportMode.DISABLED — override both getStatsFieldRegistry() and
each enabled get*StatsSupportMode() returning StatsSupportMode.AUTO (plus
getDatasetVersion()). Publish only fields whose domain meaning, aggregation,
visibility, filters, and precision are verified. Do not let a chart choose
database columns by string or derive metrics in Angular.
- Keep stats requests tied to the resource query contract. Apply the same
authorized filters, scope, and field governance as the collection; publish
stats capability only when the service can execute it.
- Use
CollectionExportRequest and CollectionExportResult for collection
export. Define format, scope, selected IDs, filters, sort, page/current/all
behavior, field allowlist, server-effective limit, async/deferred behavior,
and result metadata. Do not add a second download request shape.
- Publish export details through collection capabilities only when supported:
formats, scopes, per-format max rows, and async state. Keep
_links,
/capabilities, request behavior, and X-Export-* headers consistent.
- Enforce server-side field allowlists and governance for all scopes. Client
maxRows is a suggestion bounded by server policy. Unknown fields must not
silently broaden export. Preserve CSV/XLSX formula-injection protection.
- Keep export and stats errors structured and sanitized. A denied field, scope,
size, filter, or unavailable operation is a public policy outcome, not a
generic empty file or a browser fallback.
Read analytics-export-matrix.md when
choosing field role, scope, capability, result policy, or proof.
Preserve Boundaries
praxis-metadata-starter owns stats/export contracts, registry/support mode,
collection capability projection, request/result semantics, and headers.
- The host owns domain eligibility, query implementation, server limits,
authorization, and data classifications. Do not expose sensitive or internal
fields because a caller requests them.
praxis-ui-angular consumes published stats/export contracts. It must not
calculate authoritative analytics or invent export scopes locally.
Do not choose metrics, dimensions, export fields, or source resource through
labels, keywords, regexes, or fuzzy matching. Use registered fields, canonical
resource metadata, governance, stats capabilities, and declared operations.
Prove Policy And Result
Prove one allowed stats/export path plus one policy negative path. For stats,
prove metric/dimension semantics and filter scope. For export, prove selected and
filtered behavior where published, field allowlist, effective row limit, format,
headers, and formula protection. Prove capability/_links alignment and direct
table/analytics runtime materialization without consumer-local rules.
Use focused stats, export, capability, schema, and HTTP tests. Add quickstart
proof for public resource operations and Angular table/analytics/export consumer
tests when their published contract changes. Review docs and corpus only when
they expose the changed operation.
Companion Skills
praxis-java-resource-authoring: resource operation, filters, and DTO meaning.
praxis-java-filter-query-authoring: query scope and predicate proof.
praxis-metadata-discovery-capabilities: stats/export capability and discovery.
praxis-java-error-response-contracts: policy denial and safe errors.
praxis-java-contract-conformance: final HTTP and runtime evidence.
Close with field-role matrix, capability contract, server policy, result evidence,
consumer proof, and excluded fields. Stats/export is ready when it answers the
business question or produces governed data without widening resource exposure.
1---2name: praxis-java-stats-export-authoring3description: "Use when implementing, auditing, or migrating Praxis Java analytics or collection export: StatsFieldRegistry, StatsSupportMode, metrics and dimensions, stats schema/capabilities, CollectionExportRequest and Result, formats, scopes, selected IDs, filters, sort, field allowlists, row limits, async/deferred results, export headers, and table/chart runtime proof."4metadata:5 source: https://skillmd.com/skills/codexrodrigues/praxis-java-stats-export-authoring6---78# Praxis Java Stats Export Authoring910Treat stats and export as governed resource operations. They must reuse canonical11filter, selection, field governance, capability, and discovery contracts; never12become browser aggregation, ad hoc CSV endpoints, or a way to bypass exposure policy.1314## Establish The Analytic Or Export Question1516Inspect resource semantics, query/service, filters, field governance, existing17stats registry/support mode, collection export capability, consumer, fixtures,18and focused tests. Decide whether a field is a dimension, measure, bucket,19exportable value, or explicitly excluded. Do not infer aggregation from Java type:20an identifier, document, amount, rate, or status needs business evidence.2122Classify a metric, dimension, stat endpoint, export field, format, scope, limit,23or header as `ja-suportado-so-ux`, `ja-suportado-mal-nomeado-ou-mal-materializado`,24`suportado-parcialmente`, or `lacuna-real-de-contrato`. A missing analytical25operation belongs in the canonical starter/service owner, not in a table component.2627## Author The Resource Operation28291. Register analytics through `StatsFieldRegistry` and the resource's30 `StatsSupportMode`. Remember that `AbstractBaseQueryResourceService` defaults31 `getStatsFieldRegistry()` to `StatsFieldRegistry.empty()` and defaults32 `getGroupByStatsSupportMode()`, `getTimeSeriesStatsSupportMode()`,33 `getDistributionStatsSupportMode()`, and `getComparisonStatsSupportMode()` to34 `StatsSupportMode.DISABLED` — override **both** `getStatsFieldRegistry()` and35 each enabled `get*StatsSupportMode()` returning `StatsSupportMode.AUTO` (plus36 `getDatasetVersion()`). Publish only fields whose domain meaning, aggregation,37 visibility, filters, and precision are verified. Do not let a chart choose38 database columns by string or derive metrics in Angular.392. Keep stats requests tied to the resource query contract. Apply the same40 authorized filters, scope, and field governance as the collection; publish41 stats capability only when the service can execute it.423. Use `CollectionExportRequest` and `CollectionExportResult` for collection43 export. Define format, scope, selected IDs, filters, sort, page/current/all44 behavior, field allowlist, server-effective limit, async/deferred behavior,45 and result metadata. Do not add a second download request shape.464. Publish export details through collection capabilities only when supported:47 formats, scopes, per-format max rows, and async state. Keep `_links`,48 `/capabilities`, request behavior, and `X-Export-*` headers consistent.495. Enforce server-side field allowlists and governance for all scopes. Client50 `maxRows` is a suggestion bounded by server policy. Unknown fields must not51 silently broaden export. Preserve CSV/XLSX formula-injection protection.526. Keep export and stats errors structured and sanitized. A denied field, scope,53 size, filter, or unavailable operation is a public policy outcome, not a54 generic empty file or a browser fallback.5556Read [analytics-export-matrix.md](references/analytics-export-matrix.md) when57choosing field role, scope, capability, result policy, or proof.5859## Preserve Boundaries6061- `praxis-metadata-starter` owns stats/export contracts, registry/support mode,62 collection capability projection, request/result semantics, and headers.63- The host owns domain eligibility, query implementation, server limits,64 authorization, and data classifications. Do not expose sensitive or internal65 fields because a caller requests them.66- `praxis-ui-angular` consumes published stats/export contracts. It must not67 calculate authoritative analytics or invent export scopes locally.6869Do not choose metrics, dimensions, export fields, or source resource through70labels, keywords, regexes, or fuzzy matching. Use registered fields, canonical71resource metadata, governance, stats capabilities, and declared operations.7273## Prove Policy And Result7475Prove one allowed stats/export path plus one policy negative path. For stats,76prove metric/dimension semantics and filter scope. For export, prove selected and77filtered behavior where published, field allowlist, effective row limit, format,78headers, and formula protection. Prove capability/`_links` alignment and direct79table/analytics runtime materialization without consumer-local rules.8081Use focused stats, export, capability, schema, and HTTP tests. Add quickstart82proof for public resource operations and Angular table/analytics/export consumer83tests when their published contract changes. Review docs and corpus only when84they expose the changed operation.8586## Companion Skills8788- `praxis-java-resource-authoring`: resource operation, filters, and DTO meaning.89- `praxis-java-filter-query-authoring`: query scope and predicate proof.90- `praxis-metadata-discovery-capabilities`: stats/export capability and discovery.91- `praxis-java-error-response-contracts`: policy denial and safe errors.92- `praxis-java-contract-conformance`: final HTTP and runtime evidence.9394Close with field-role matrix, capability contract, server policy, result evidence,95consumer proof, and excluded fields. Stats/export is ready when it answers the96business question or produces governed data without widening resource exposure.