{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://metascience.jordanwick.com/submission.schema.json",
  "title": "Metascience Query Competition entry",
  "version": "0.1",
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "minLength": 5,
      "maxLength": 120,
      "description": "Short name for the query"
    },
    "summary": {
      "type": "string",
      "minLength": 40,
      "maxLength": 600,
      "description": "The pitch: what is asked and why it matters"
    },
    "themes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "high_impact_proposals",
          "high_upside_people",
          "underexplored_areas",
          "review_process",
          "other"
        ]
      },
      "minItems": 1,
      "maxItems": 5
    },
    "question": {
      "type": "object",
      "properties": {
        "statement": {
          "type": "string",
          "minLength": 20,
          "maxLength": 1500,
          "description": "The question, in one or two sentences"
        },
        "why_llm": {
          "type": "string",
          "minLength": 20,
          "maxLength": 1500,
          "description": "Why this was not feasible at scale before LLMs"
        },
        "prior_work": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "citation": {
                "type": "string",
                "minLength": 5,
                "maxLength": 500
              },
              "url": {
                "type": "string",
                "minLength": 0,
                "maxLength": 500
              }
            },
            "required": [
              "citation"
            ],
            "additionalProperties": false
          },
          "minItems": 0,
          "maxItems": 20
        }
      },
      "required": [
        "statement",
        "why_llm"
      ],
      "additionalProperties": false
    },
    "data_requirements": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string",
            "pattern": "^[a-z_]+\\.[a-z_]+$",
            "description": "Canonical field as entity.field, from /ontology.json"
          },
          "need": {
            "type": "string",
            "enum": [
              "required",
              "optional"
            ]
          },
          "use": {
            "type": "string",
            "minLength": 0,
            "maxLength": 400,
            "description": "What the query does with it"
          },
          "fallback": {
            "type": "string",
            "minLength": 0,
            "maxLength": 600,
            "description": "What to do where the field is missing. Leave empty to stop (required) or skip (optional)"
          }
        },
        "required": [
          "field",
          "need"
        ],
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 60
    },
    "external_sources": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 2,
            "maxLength": 120
          },
          "url": {
            "type": "string",
            "minLength": 5,
            "maxLength": 500,
            "description": "Where the data can be obtained"
          },
          "access": {
            "type": "string",
            "enum": [
              "open",
              "free_registration",
              "licensed",
              "agency_internal"
            ]
          },
          "join_key": {
            "type": "string",
            "minLength": 2,
            "maxLength": 200,
            "description": "How it joins to the ontology"
          }
        },
        "required": [
          "name",
          "url",
          "access",
          "join_key"
        ],
        "additionalProperties": false
      },
      "minItems": 0,
      "maxItems": 20
    },
    "procedure": {
      "type": "object",
      "properties": {
        "prompt": {
          "type": "string",
          "minLength": 400,
          "maxLength": 20000,
          "description": "The paste-ready instructions for the internal LLM. Refer to data only by canonical field names"
        },
        "steps": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "compute",
                  "llm_extract",
                  "llm_classify",
                  "llm_judge",
                  "embed",
                  "match",
                  "human_check",
                  "report"
                ]
              },
              "description": {
                "type": "string",
                "minLength": 10,
                "maxLength": 800
              }
            },
            "required": [
              "kind",
              "description"
            ],
            "additionalProperties": false
          },
          "minItems": 2,
          "maxItems": 40
        },
        "runtime_hours": {
          "type": "number",
          "minimum": 0.1,
          "maximum": 72,
          "description": "Expected unattended runtime"
        },
        "llm_calls": {
          "type": "number",
          "minimum": 0,
          "description": "Rough number of model calls"
        }
      },
      "required": [
        "prompt",
        "steps",
        "runtime_hours"
      ],
      "additionalProperties": false
    },
    "outputs": {
      "type": "object",
      "properties": {
        "result_tables": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 2,
                "maxLength": 120
              },
              "description": {
                "type": "string",
                "minLength": 5,
                "maxLength": 600
              }
            },
            "required": [
              "name",
              "description"
            ],
            "additionalProperties": false
          },
          "minItems": 1,
          "maxItems": 20
        },
        "null_result": {
          "type": "string",
          "minLength": 20,
          "maxLength": 1000,
          "description": "What the output looks like if there is no effect"
        },
        "smallest_cell": {
          "type": "integer",
          "minimum": 10,
          "description": "No reported cell is smaller than this"
        }
      },
      "required": [
        "result_tables",
        "null_result",
        "smallest_cell"
      ],
      "additionalProperties": false
    },
    "validation": {
      "type": "object",
      "properties": {
        "human_check": {
          "type": "string",
          "minLength": 20,
          "maxLength": 1000,
          "description": "What a person checks before model labels are trusted"
        },
        "sample_size": {
          "type": "integer",
          "minimum": 0
        },
        "acceptance": {
          "type": "string",
          "minLength": 5,
          "maxLength": 500,
          "description": "The pass mark, such as agreement of at least 90%"
        },
        "failure_modes": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 5,
            "maxLength": 500
          },
          "minItems": 0,
          "maxItems": 20
        }
      },
      "required": [
        "human_check",
        "sample_size",
        "acceptance"
      ],
      "additionalProperties": false
    },
    "unlocks": {
      "type": "object",
      "properties": {
        "experiment": {
          "type": "string",
          "minLength": 60,
          "maxLength": 1500,
          "description": "The metascience experiment the answer makes possible"
        },
        "decision": {
          "type": "string",
          "minLength": 20,
          "maxLength": 800,
          "description": "The agency decision it informs"
        },
        "design": {
          "type": "string",
          "enum": [
            "randomized",
            "matched_comparison",
            "natural_experiment",
            "pilot",
            "other"
          ]
        }
      },
      "required": [
        "experiment",
        "decision",
        "design"
      ],
      "additionalProperties": false
    },
    "privacy": {
      "type": "object",
      "properties": {
        "restricted_fields_used": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 0,
          "maxItems": 30
        },
        "person_level_results": {
          "type": "string",
          "enum": [
            "none",
            "stay_inside_unit"
          ]
        },
        "notes": {
          "type": "string",
          "minLength": 0,
          "maxLength": 1000
        }
      },
      "required": [
        "restricted_fields_used",
        "person_level_results"
      ],
      "additionalProperties": false
    },
    "dry_run": {
      "type": "object",
      "properties": {
        "profiles_run": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "nih-like",
              "nsf-like",
              "core-only"
            ]
          },
          "minItems": 0,
          "maxItems": 3
        },
        "notes": {
          "type": "string",
          "minLength": 0,
          "maxLength": 2000,
          "description": "What happened, and what you fixed"
        },
        "artifacts_url": {
          "type": "string",
          "minLength": 0,
          "maxLength": 500,
          "description": "Optional link to the run output"
        }
      },
      "required": [
        "profiles_run"
      ],
      "additionalProperties": false
    },
    "submitters": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 2,
            "maxLength": 120
          },
          "email": {
            "type": "string",
            "pattern": "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$",
            "maxLength": 200
          },
          "orcid": {
            "type": "string",
            "minLength": 0,
            "maxLength": 40
          },
          "affiliation": {
            "type": "string",
            "minLength": 0,
            "maxLength": 200
          }
        },
        "required": [
          "name",
          "email"
        ],
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 12
    },
    "ai_use": {
      "type": "string",
      "enum": [
        "human_only",
        "ai_assisted",
        "ai_agent"
      ],
      "description": "Disclosed, not banned. A named person vouches for the entry"
    },
    "license": {
      "type": "string",
      "enum": [
        "CC-BY-4.0"
      ],
      "description": "Entries are published under CC BY 4.0"
    }
  },
  "required": [
    "title",
    "summary",
    "themes",
    "question",
    "data_requirements",
    "procedure",
    "outputs",
    "validation",
    "unlocks",
    "privacy",
    "dry_run",
    "submitters",
    "ai_use",
    "license"
  ],
  "additionalProperties": false
}