{
  "openapi": "3.1.0",
  "info": {
    "title": "The Mine — free discovery door",
    "version": "1.1.0-draft",
    "summary": "Latest public economic figures for Hawaiʻi, each with its source and required notice.",
    "description": "Read-only. Free records only: the latest value of each series. Every record carries `notice`, a plain sentence crediting the source and carrying any disclaimer it requires; repeat it with the figure. Facts only, never advice. Terms: https://tkscmlimited.com/terms-of-service/#s7b",
    "contact": {
      "name": "The Conduit, tkscm, limited",
      "email": "theconduit@tkscmlimited.com",
      "url": "https://tkscmlimited.com/the-mine/"
    },
    "termsOfService": "https://tkscmlimited.com/terms-of-service/#s7b"
  },
  "servers": [
    {
      "url": "https://mine-site-9qp.pages.dev",
      "description": "This server"
    }
  ],
  "paths": {
    "/v1/series": {
      "get": {
        "operationId": "listSeries",
        "summary": "Catalog of every active series",
        "parameters": [
          {
            "name": "geo",
            "in": "query",
            "schema": {
              "type": "string",
              "examples": [
                "HI",
                "HI.HON"
              ]
            },
            "description": "Filter by geography code"
          },
          {
            "name": "source",
            "in": "query",
            "schema": {
              "type": "string",
              "examples": [
                "BLS",
                "BLSQCEW",
                "DOL"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Series list",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SeriesList"
                }
              }
            }
          }
        }
      }
    },
    "/v1/latest": {
      "get": {
        "operationId": "listLatest",
        "summary": "Newest value of every series, with notices",
        "parameters": [
          {
            "name": "geo",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Latest values",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LatestList"
                }
              }
            }
          }
        }
      }
    },
    "/v1/series/{series_id}/latest": {
      "get": {
        "operationId": "getLatest",
        "summary": "Newest value of one series, with its notice",
        "parameters": [
          {
            "name": "series_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "examples": [
                "hi.unemp.rate.sa.m"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Latest value",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Observation"
                }
              }
            }
          },
          "404": {
            "description": "No such series"
          }
        }
      }
    },
    "/v1/sources": {
      "get": {
        "operationId": "listSources",
        "summary": "Each source agency, its terms and its required notice",
        "responses": {
          "200": {
            "description": "Sources",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sources": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Source"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Series": {
        "type": "object",
        "required": [
          "series_id",
          "title",
          "unit",
          "frequency",
          "source"
        ],
        "properties": {
          "series_id": {
            "type": "string",
            "description": "The Mine's own stable id; never reused"
          },
          "title": {
            "type": "string"
          },
          "unit": {
            "type": "string",
            "examples": [
              "percent",
              "persons",
              "usd",
              "count",
              "claims",
              "weeks"
            ]
          },
          "frequency": {
            "type": "string",
            "enum": [
              "D",
              "W",
              "M",
              "Q",
              "A"
            ]
          },
          "geo": {
            "type": "string"
          },
          "seasonally_adjusted": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "source": {
            "type": "string"
          },
          "free": {
            "type": "boolean",
            "description": "Whether this record is marked free under Terms §7B"
          }
        }
      },
      "SeriesList": {
        "type": "object",
        "properties": {
          "generated": {
            "type": "string",
            "format": "date-time"
          },
          "series": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Series"
            }
          },
          "notice": {
            "type": "string"
          }
        }
      },
      "Observation": {
        "type": "object",
        "required": [
          "series_id",
          "period_start",
          "period_end",
          "value",
          "retrieved_at",
          "source",
          "notice"
        ],
        "properties": {
          "series_id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "unit": {
            "type": "string"
          },
          "geo": {
            "type": "string"
          },
          "period_start": {
            "type": "string",
            "format": "date"
          },
          "period_end": {
            "type": "string",
            "format": "date"
          },
          "value": {
            "type": [
              "number",
              "null"
            ],
            "description": "null = reported but empty or suppressed"
          },
          "value_text": {
            "type": "string",
            "description": "Exactly as published, with footnote marks, e.g. \"2.7 [P]\" (P = preliminary)"
          },
          "is_revision": {
            "type": "boolean"
          },
          "retrieved_at": {
            "type": "string",
            "format": "date-time"
          },
          "stale": {
            "type": "boolean",
            "description": "true when this series is older than its agency's usual publication schedule; the last value received is shown"
          },
          "source": {
            "type": "string"
          },
          "notice_version": {
            "type": "string"
          },
          "notice": {
            "type": "string",
            "description": "Repeat this sentence with the figure"
          },
          "free": {
            "type": "boolean",
            "const": true
          }
        }
      },
      "LatestList": {
        "type": "object",
        "properties": {
          "generated": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Observation"
            }
          }
        }
      },
      "Source": {
        "type": "object",
        "properties": {
          "source_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "homepage": {
            "type": "string"
          },
          "terms_url": {
            "type": "string"
          },
          "notice_text": {
            "type": "string"
          },
          "notice_version": {
            "type": "string"
          }
        }
      }
    }
  }
}