> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hermesco.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Ranked facility list inside the warning area

> The call sheet rows, ranked by the fixed scoring formula. Each row carries its score breakdown and evidence id. An empty list is a typed empty state, not an error.



## OpenAPI

````yaml /contract/openapi.yaml get /runs/{id}/facilities
openapi: 3.1.0
info:
  title: Porch Light API
  version: 0.1.0
  summary: >-
    The shared contract every Porch Light agent builds against. Country
    agnostic: everything US specific sits behind the country adapter interface
    in contract/adapter.md.
  description: >-
    Porch Light takes a weather alert in, builds the warning area, ranks the
    facilities inside it with a fixed transparent formula, and returns a call
    sheet where every row carries its evidence trail. Zetaris is the only data
    path. Meterless is the only model path. Nemotron explains, the formula
    ranks.
  license:
    name: AGPL-3.0
servers: []
security:
  - bearerAuth: []
tags:
  - name: alerts
  - name: runs
  - name: health
paths:
  /runs/{id}/facilities:
    get:
      tags:
        - runs
      summary: Ranked facility list inside the warning area
      description: >-
        The call sheet rows, ranked by the fixed scoring formula. Each row
        carries its score breakdown and evidence id. An empty list is a typed
        empty state, not an error.
      operationId: listRunFacilities
      parameters:
        - $ref: '#/components/parameters/RunId'
        - name: type
          in: query
          schema:
            $ref: '#/components/schemas/FacilityType'
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            default: 50
        - name: offset
          in: query
          schema:
            type: integer
            minimum: 0
            default: 0
      responses:
        '200':
          description: Ranked facilities, possibly empty
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FacilityList'
        '404':
          description: No such run
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
components:
  parameters:
    RunId:
      name: id
      in: path
      required: true
      schema:
        type: string
        example: run_milton_12081_mock
  schemas:
    FacilityType:
      type: string
      enum:
        - dialysis
        - nursing_home
        - home_health
        - hospital
        - clinic
        - other
    FacilityList:
      type: object
      required:
        - items
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/RankedFacility'
        total:
          type: integer
        empty_state:
          $ref: '#/components/schemas/EmptyState'
    ApiError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              $ref: '#/components/schemas/ErrorCode'
            message:
              type: string
            detail: {}
            retry_after_ms:
              type: integer
    RankedFacility:
      description: >-
        A facility after ranking. Used by GET /runs/{id}/facilities so the call
        sheet always carries its score breakdown and evidence trail. The raw
        Facility stays for adapter output before scoring.
      allOf:
        - $ref: '#/components/schemas/Facility'
        - type: object
          required:
            - score
            - evidence
          properties:
            score:
              $ref: '#/components/schemas/ScoreBreakdown'
            evidence:
              $ref: '#/components/schemas/Evidence'
    EmptyState:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          enum:
            - no_facilities
            - no_alerts
            - no_joins
            - no_dependents_data
        message:
          type: string
          example: No facilities sit inside the warning area.
    ErrorCode:
      type: string
      enum:
        - not_found
        - bad_request
        - no_facilities
        - source_stale
        - zetaris_down
        - meterless_unauthorized
        - meterless_offline
        - timeout
        - export_refused
    Facility:
      type: object
      required:
        - id
        - country
        - name
        - type
        - key
        - lat
        - lon
      properties:
        id:
          type: string
        country:
          $ref: '#/components/schemas/CountryCode'
        name:
          type: string
        type:
          $ref: '#/components/schemas/FacilityType'
        key:
          $ref: '#/components/schemas/ExternalKey'
          description: Primary adapter key (ccn in the US, osm_id in the global adapter).
        alt_keys:
          type: array
          items:
            $ref: '#/components/schemas/ExternalKey'
        address:
          type: string
        phone:
          $ref: '#/components/schemas/FacilityPhone'
        zip:
          type: string
        county_key:
          $ref: '#/components/schemas/ExternalKey'
          description: County level key, fips in the US, admin code elsewhere.
        tract_key:
          $ref: '#/components/schemas/ExternalKey'
        lat:
          type: number
          format: double
        lon:
          type: number
          format: double
        geocode:
          type: object
          description: Present when the point came from geocoding, not the source.
          properties:
            source:
              type: string
              example: census_geocoder
            match_quality:
              type: string
              enum:
                - exact
                - partial
                - tied
                - failed
        attributes:
          type: object
          additionalProperties: true
          description: >-
            Type specific facts (star_rating, staffing_rn_hours, late_shift,
            station count). Names come from the adapter, not the contract.
        score:
          $ref: '#/components/schemas/ScoreBreakdown'
        evidence:
          $ref: '#/components/schemas/Evidence'
        mock:
          type: boolean
    ScoreBreakdown:
      type: object
      required:
        - total
        - terms
        - formula_version
        - rank
      properties:
        total:
          type: number
        terms:
          type: array
          items:
            $ref: '#/components/schemas/ScoreTerm'
        formula_version:
          type: string
          description: Version of data/scoring/weights.yaml used.
        rank:
          type: integer
          minimum: 1
        tie_break:
          type: string
          description: Ties break by facility type, then facility key.
    Evidence:
      type: object
      required:
        - zetaris_query_ids
        - sources
        - data_as_of
        - join_path
        - score
        - dq_results
        - failed_joins
        - facts
      properties:
        zetaris_query_ids:
          type: array
          items:
            type: string
        sources:
          type: array
          items:
            $ref: '#/components/schemas/SourceRef'
        data_as_of:
          type: array
          items:
            $ref: '#/components/schemas/DataAsOf'
        join_path:
          type: array
          items:
            $ref: '#/components/schemas/JoinHop'
        score:
          $ref: '#/components/schemas/ScoreBreakdown'
        dq_results:
          type: array
          items:
            $ref: '#/components/schemas/DqResult'
        failed_joins:
          type: array
          items:
            $ref: '#/components/schemas/FailedJoin'
        facts:
          type: array
          items:
            $ref: '#/components/schemas/Fact'
        reason:
          $ref: '#/components/schemas/Reason'
        ledger_ids:
          type: array
          items:
            type: string
          description: TrustLedger entries linking each claim in the reason to fact ids.
    CountryCode:
      type: string
      description: >-
        Lowercase adapter country key (us, jm, ph, ...), not an enum so new
        adapters do not change the contract.
      example: us
    ExternalKey:
      type: object
      required:
        - type
        - value
      properties:
        type:
          $ref: '#/components/schemas/ExternalKeyType'
        value:
          type: string
          example: '12081'
    FacilityPhone:
      oneOf:
        - type: object
          required:
            - status
            - value
            - source
          properties:
            status:
              const: available
            value:
              type: string
              minLength: 1
            source:
              $ref: '#/components/schemas/SourceRef'
            source_record_key:
              type: string
        - type: object
          required:
            - status
            - reason
          properties:
            status:
              const: unavailable
            reason:
              type: string
              minLength: 1
          not:
            required:
              - value
    ScoreTerm:
      type: object
      required:
        - name
        - input
        - weight
        - weighted
      properties:
        name:
          type: string
          enum:
            - type_weight
            - svi_pct
            - empower_density_pct
            - cms_risk
            - plan_flag
        input:
          type: number
        weight:
          type: number
        weighted:
          type: number
        note:
          type: string
          description: >-
            Plain label for the evidence drawer, for example: ZIP level
            aggregate.
    SourceRef:
      type: object
      required:
        - name
        - license
      properties:
        name:
          type: string
          example: cms_dialysis
        dataset_id:
          type: string
          example: 23ew-n7w9
        url:
          type: string
        license:
          type: string
    DataAsOf:
      type: object
      required:
        - source
        - fetched_at
        - snapshot_id
        - stale
      properties:
        source:
          type: string
        modified:
          type: string
          format: date-time
          description: Source dataset modified stamp when the source publishes one.
        fetched_at:
          type: string
          format: date-time
        snapshot_id:
          type: string
        stale:
          type: boolean
          description: >-
            True when the row is being read from the snapshot while the source
            is unreachable.
        provenance_file:
          type: string
    JoinHop:
      type: object
      required:
        - from_key
        - to_key
        - method
        - match_rate
      properties:
        from_key:
          $ref: '#/components/schemas/ExternalKeyType'
        to_key:
          $ref: '#/components/schemas/ExternalKeyType'
        method:
          type: string
          enum:
            - exact_key
            - ssa_to_fips_crosswalk
            - census_geocode
            - postgis_point_in_polygon
            - zip_to_empower
            - osm_admin_lookup
        match_rate:
          type: number
          description: Measured by Zetaris SQL, never an LLM confidence.
        query_id:
          type: string
    DqResult:
      type: object
      required:
        - rule
        - passed
      properties:
        rule:
          type: string
          example: zip_is_5_digits
        passed:
          type: boolean
        detail:
          type: string
    FailedJoin:
      type: object
      required:
        - from_key
        - to_key
        - method
        - reason
      properties:
        from_key:
          $ref: '#/components/schemas/ExternalKeyType'
        to_key:
          $ref: '#/components/schemas/ExternalKeyType'
        method: 98f7d61d-815e-49c1-9af2-03436d564f2b
        reason:
          type: string
          example: address could not be geocoded
        row_count:
          type: integer
        query_id:
          type: string
    Fact:
      type: object
      required:
        - name
        - value
        - query_id
      properties:
        name:
          type: string
          example: svi_pct
        value: {}
        unit:
          type: string
        query_id:
          type: string
    Reason:
      type: object
      required:
        - text
        - trace_id
      properties:
        text:
          type: string
          description: Nemotron's explanation. It never sets the order.
        rule_cites:
          type: array
          items:
            $ref: '#/components/schemas/RuleCite'
        model_id:
          type: string
          example: nvidia/nemotron-3.5-super-vl-120b-a12b
        mode:
          type: string
          enum:
            - meterless/deep
            - meterless/fast
            - meterless/local
        provider:
          type: string
          enum:
            - local
            - nim
            - none
        trace_id:
          type: string
    ExternalKeyType:
      type: string
      enum:
        - ccn
        - osm_id
        - worldpop_cell
        - gdacs_event
        - cap_id
        - ugc
        - fips
        - tract_geoid
        - zip
        - ssa_county
        - nws_zone
      description: Adapter-specific key types the USL carries per country.
    RuleCite:
      type: object
      required:
        - cite
      properties:
        cite:
          type: string
          example: 42 CFR 494.62
        plan_section:
          type: string
        page:
          type: integer
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.