---
id: CAP-PFM-QRY-020
title: Evaluate dated conditions for named records
feature: FEAT-PFM-QRY-01
product_area: platform
module: queries
revision: 1
status: draft
product_intent: proposed
implementation_evidence: observed
source_sha:
  services-platform: ad3f6a6582843008ed0f5a17b131878d15829af1
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
purpose: >-
  Applications obtain condition results for identified records on a chosen day without turning those
  evaluations into staff queries.
outcomes:
  - Applications distinguish a failed condition from a missing fact.
  - Dated evaluations use the workspace calendar.
concepts:
  - CON-PFM-QRY-001
  - CON-PFM-QRY-002
actors:
  - ACT-PFM-016
surfaces:
  - job
permissions: []
rules:
  - id: BR-CAP-PFM-QRY-020-01
    proved_by: [ATS-PFM-QRY-020-01, TST-PFM-QRY-266]
    statement: Only a system caller can evaluate conditions over named records; a user caller is refused.
    kind: permission
    enforced_at:
      - service
    must_prove: true
    provenance: test
    source: >-
      services-platform:modules/queries/tests/integration/services/execute/compile-predicates.integration.spec.js#refuses
      a user execution, because predicates are evaluated by the macroservice itself
    origin: none
  - id: BR-CAP-PFM-QRY-020-02
    proved_by: [ATS-PFM-QRY-020-02]
    statement: >-
      An evaluation accepts one to one thousand nonblank subject ids and one to one hundred predicates with
      distinct nonblank names; invalid lists or incompatible predicate options are refused.
    kind: validation
    enforced_at:
      - service
    must_prove: true
    provenance: observed
    source: 'services-platform:modules/queries/services/execute/compile-predicates.ts:validPredicates'
    origin: none
  - id: BR-CAP-PFM-QRY-020-03
    proved_by: [ATS-PFM-QRY-020-03, TST-PFM-QRY-266]
    statement: >-
      Boolean conditions preserve an unknown result for missing facts by default, while the alternate null
      policy evaluates them using the ordinary query filter’s meaning.
    kind: calculation
    enforced_at:
      - service
    must_prove: true
    provenance: test
    source: >-
      services-platform:modules/queries/tests/integration/services/execute/compile-predicates.integration.spec.js#keeps
      a negated operator unknown over an absent value, and answers it as the filter does when NULL means false
    origin: none
  - id: BR-CAP-PFM-QRY-020-04
    proved_by: [ATS-PFM-QRY-020-04]
    statement: >-
      Collection calculations support count, sum, minimum and maximum; empty collections give zero for count
      and sum and no value for minimum and maximum.
    kind: calculation
    enforced_at:
      - service
    must_prove: true
    provenance: observed
    source: 'services-platform:modules/queries/services/execute/compile-query.ts:subjectPredicateCompiler'
    origin: none
  - id: BR-CAP-PFM-QRY-020-05
    proved_by: [ATS-PFM-QRY-020-05, ATS-PFM-QRY-020-07, TST-PFM-QRY-266]
    statement: >-
      A supplied evaluation day anchors relative dates in the workspace calendar, including calendar shifts;
      invalid days and date tokens used on unsuitable fields are refused.
    kind: calculation
    enforced_at:
      - service
    must_prove: true
    provenance: test
    source: >-
      services-platform:modules/queries/tests/integration/services/execute/compile-predicates.integration.spec.js#resolves
      the same shift from the as-of day, so a contact eighteen today was not the day before
    origin: none
  - id: BR-CAP-PFM-QRY-020-06
    proved_by: [ATS-PFM-QRY-020-06]
    statement: >-
      Evaluation reads only the named records in the current workspace through a read-only database role, and
      its logs omit subject ids, fact values and query text.
    kind: invariant
    enforced_at:
      - service
      - database
    must_prove: true
    provenance: observed
    source: 'services-platform:modules/queries/services/execute/compile-predicates.ts:evaluateSubjectPredicates'
    origin: none
supersedes: []
intent_sources: []
depends_on:
  - CAP-PFM-QRY-001
evidence:
  - 'Pinned reference: services-platform:modules/queries/services/execute/compile-predicates.ts'
  - 'Pinned reference: services-platform:modules/queries/services/execute/compile-query.ts'
  - >-
    Pinned reference:
    services-platform:modules/queries/tests/integration/services/execute/compile-predicates.integration.spec.js
controls: [TC-AZ-001, TC-AZ-002, TC-AZ-003, TC-AZ-004, TC-IAM-001, TC-IAM-002, TC-IAM-004, TC-IAM-005, TC-LOG-001, TC-LOG-004, TC-LOG-005, TC-PI-001, TC-PI-005, TC-TEN-001, TC-TEN-002, TC-TEN-003, TC-VEN-001, TC-VEN-002, TC-VEN-003]
exercised_by: [FAS-PFM-QRY-01-05]
suites: [TST-PFM-QRY-266]
---

# Evaluate dated conditions for named records

## Purpose

Applications ask whether identified records satisfy their conditions on a particular day. The results can distinguish a known answer from an absent fact.

## How It Works

An application supplies a dataset, record identities and named conditions. Platform resolves the dataset and compiles the conditions together. The evaluation uses the workspace calendar and can anchor relative dates to another day. Boolean answers can remain unknown when their facts are missing. Collection calculations return numbers for the application to compare. The result includes only records found within the workspace. A user cannot invoke this internal operation directly. Database grants still limit what the system reader can read. Current-only source views continue to describe the present, so historical conditions need dated source information.

## Relationships

Internal condition evaluation uses resolved datasets and read-only query execution for named subjects.
