{
  "openapi": "3.1.0",
  "info": {
    "title": "The Missing Weeks API",
    "version": "1.0.0",
    "description": "Read-only JSON for themissingweeks.org: state birth and preterm data, the timeline of intervention windows, and the calculator. Free, no key. Every response carries the publisher's disclosure; inputs carry their source and grade; the calculator returns its formula and caveats. Population and program planning references, not individual medical, actuarial or legal advice.",
    "contact": {
      "email": "info@themissingweeks.org"
    },
    "x-disclosure": "Published by AEXTech Holdings. Its founder, Alex Rogers, holds shares in Sera Prognostics, maker of the PreTRM mid-pregnancy risk test that appears on the timeline, and has an interest in a Blue Ox Healthcare Partners vehicle holding Sera warrants; he expects to have a stake in iMSO, a new company that plans to sell preterm-birth prevention programs using that test. Sera did not fund, review or see the site. AEXTech also sells a fuller version of the model behind it. Full text: https://themissingweeks.org/about"
  },
  "servers": [
    {
      "url": "https://themissingweeks.org"
    }
  ],
  "paths": {
    "/api": {
      "get": {
        "operationId": "describe",
        "summary": "What is available, the dials and their ranges, the disclosure",
        "responses": {
          "200": {
            "description": "Index",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is unknown or out of range; the body says which and carries the disclosure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/states": {
      "get": {
        "operationId": "getStates",
        "summary": "Births, preterm rate and count by state (2023, NCHS) and Medicaid share of births (2024, KFF)",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "Two-letter postal code (DC included) or US.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z]{2}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "All states, or one",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is unknown or out of range; the body says which and carries the disclosure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/windows": {
      "get": {
        "operationId": "getWindows",
        "summary": "The timeline of intervention windows; with week, each window's status for a first prenatal visit at that week",
        "parameters": [
          {
            "name": "week",
            "in": "query",
            "required": false,
            "description": "Week of gestation of the first prenatal visit, 0 to 46 (42 and later is postpartum).",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 46
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Windows, with status and a summary when week is given",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is unknown or out of range; the body says which and carries the disclosure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/calculate": {
      "get": {
        "operationId": "calculate",
        "summary": "The calculator: what one year of preterm births costs, what a program would avert, and what the missing weeks cost",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "description": "Two-letter postal code (DC included) or US. Default TX.",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z]{2}$",
              "default": "TX"
            }
          },
          {
            "name": "inCare",
            "in": "query",
            "required": false,
            "description": "Pregnancies in care by the end of the first trimester (%)",
            "schema": {
              "type": "number",
              "minimum": 30,
              "maximum": 100,
              "default": 76
            }
          },
          {
            "name": "share",
            "in": "query",
            "required": false,
            "description": "Share of those pregnancies the program screens or treats (%)",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 100,
              "default": 55
            }
          },
          {
            "name": "effect",
            "in": "query",
            "required": false,
            "description": "Preterm births prevented among those treated (relative %, across all the program touches)",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 35,
              "default": 5
            }
          },
          {
            "name": "cost",
            "in": "query",
            "required": false,
            "description": "Program cost per pregnancy screened or treated (USD)",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 1500,
              "default": 60
            }
          },
          {
            "name": "births",
            "in": "query",
            "required": false,
            "description": "Overrides the state's birth count (marked as an assumption in the response).",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Inputs with sources and grades, results, formula, caveats, and a page link that reproduces the result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "A parameter is unknown or out of range; the body says which and carries the disclosure.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  }
}