{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/userintuition-ai/json-schema/userintuition-ai-public-report-schema.json",
  "title": "PublicReport",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/userintuition-ai-openapi.json#/components/schemas/PublicReport",
  "properties": {
    "schema_version": {
      "type": "string",
      "const": "report-v2",
      "title": "Schema Version",
      "default": "report-v2"
    },
    "structure_status": {
      "type": "string",
      "enum": [
        "structured",
        "legacy_partial"
      ],
      "title": "Structure Status",
      "description": "Whether learning-goal findings can be joined to the saved evidence snapshot",
      "default": "legacy_partial"
    },
    "report_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Report Id",
      "description": "Persisted report ID"
    },
    "study_id": {
      "type": "string",
      "title": "Study Id",
      "description": "The study this report was generated for"
    },
    "summary": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Summary",
      "description": "Short executive summary in overview responses"
    },
    "summary_truncated": {
      "type": "boolean",
      "title": "Summary Truncated",
      "default": false
    },
    "included_sections": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Included Sections"
    },
    "available_sections": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Available Sections"
    },
    "based_on_interview_ids_included": {
      "type": "boolean",
      "title": "Based On Interview Ids Included",
      "default": false
    },
    "references": {
      "items": {
        "$ref": "#/$defs/PublicReportReference"
      },
      "type": "array",
      "title": "References"
    },
    "study_findings": {
      "$ref": "#/$defs/PublicStudyFindings"
    },
    "participant_profiles": {
      "items": {
        "$ref": "#/$defs/PublicReportParticipantProfileSection"
      },
      "type": "array",
      "title": "Participant Profiles",
      "description": "Participant-profile questions with stable question IDs and answer/count/percentage arrays"
    },
    "participant_responses": {
      "items": {
        "$ref": "#/$defs/PublicParticipantResponse"
      },
      "type": "array",
      "title": "Participant Responses"
    },
    "evidence_coverage": {
      "$ref": "#/$defs/PublicEvidenceCoverage"
    },
    "recommended_next_steps": {
      "items": {
        "$ref": "#/$defs/PublicRecommendedNextStep"
      },
      "type": "array",
      "title": "Recommended Next Steps"
    },
    "recommendation_status": {
      "type": "string",
      "enum": [
        "available",
        "partial",
        "unavailable"
      ],
      "title": "Recommendation Status",
      "default": "unavailable"
    },
    "interview_count": {
      "type": "integer",
      "title": "Interview Count",
      "description": "Number of interviews included in the report",
      "default": 0
    },
    "based_on_interview_ids": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Based On Interview Ids",
      "description": "Interview IDs included in the saved report evidence; null when unavailable for a legacy report"
    },
    "interview_count_basis": {
      "type": "string",
      "enum": [
        "saved_evidence",
        "legacy_unverified"
      ],
      "title": "Interview Count Basis",
      "default": "legacy_unverified"
    },
    "is_stale": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Is Stale",
      "description": "True if the report's inputs drifted since it was generated (regenerate to refresh); None = unknown"
    },
    "stale_reason": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "inputs_changed",
            "fingerprint_unavailable",
            "comparison_unavailable"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Stale Reason"
    },
    "new_interviews_since": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "New Interviews Since"
    },
    "created_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Created At"
    },
    "updated_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Updated At"
    }
  },
  "type": "object",
  "required": [
    "study_id"
  ],
  "$defs": {
    "GoalAssessment": {
      "properties": {
        "goal_id": {
          "type": "string",
          "title": "Goal Id"
        },
        "finding_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Finding Ids"
        },
        "label": {
          "type": "string",
          "title": "Label",
          "default": ""
        },
        "supports": {
          "type": "string",
          "minLength": 1,
          "title": "Supports"
        },
        "limits": {
          "type": "string",
          "minLength": 1,
          "title": "Limits"
        },
        "purpose": {
          "type": "string",
          "minLength": 1,
          "title": "Purpose"
        }
      },
      "type": "object",
      "required": [
        "goal_id",
        "supports",
        "limits",
        "purpose"
      ],
      "title": "GoalAssessment"
    },
    "PublicEvidenceCoverage": {
      "properties": {
        "text": {
          "type": "string",
          "title": "Text",
          "default": ""
        },
        "sample_adequacy": {
          "anyOf": [
            {
              "$ref": "#/$defs/SampleAdequacy"
            },
            {
              "type": "null"
            }
          ]
        },
        "learning_goal_evaluations": {
          "items": {
            "$ref": "#/$defs/GoalAssessment"
          },
          "type": "array",
          "title": "Learning Goal Evaluations"
        },
        "evidence_gaps": {
          "items": {
            "$ref": "#/$defs/PublicEvidenceGap"
          },
          "type": "array",
          "title": "Evidence Gaps"
        }
      },
      "type": "object",
      "title": "PublicEvidenceCoverage"
    },
    "PublicEvidenceGap": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "priority": {
          "type": "integer",
          "title": "Priority"
        },
        "title": {
          "type": "string",
          "title": "Title"
        },
        "learning_goal_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Learning Goal Ids"
        },
        "finding_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Finding Ids"
        },
        "description": {
          "type": "string",
          "title": "Description"
        },
        "decision_relevance": {
          "type": "string",
          "title": "Decision Relevance"
        },
        "evidence_needed": {
          "type": "string",
          "title": "Evidence Needed",
          "default": ""
        },
        "priority_rationale": {
          "type": "string",
          "title": "Priority Rationale",
          "default": ""
        },
        "kind": {
          "type": "string",
          "enum": [
            "research",
            "operational"
          ],
          "title": "Kind",
          "default": "research"
        },
        "resolution_scope": {
          "type": "string",
          "enum": [
            "same_plan_more_interviews",
            "new_study",
            "not_applicable"
          ],
          "title": "Resolution Scope",
          "default": "not_applicable"
        },
        "required_changes": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Required Changes"
        },
        "recommended_study_slug": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "in-depth-interview",
                "concept-test",
                "prototype-test"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Recommended Study Slug"
        },
        "reference_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Reference Ids"
        }
      },
      "type": "object",
      "required": [
        "id",
        "priority",
        "title",
        "description",
        "decision_relevance"
      ],
      "title": "PublicEvidenceGap"
    },
    "PublicFindingPrevalence": {
      "properties": {
        "n": {
          "type": "integer",
          "minimum": 0.0,
          "title": "N"
        },
        "of": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Of"
        }
      },
      "type": "object",
      "required": [
        "n",
        "of"
      ],
      "title": "PublicFindingPrevalence"
    },
    "PublicFindingQuote": {
      "properties": {
        "text": {
          "type": "string",
          "title": "Text"
        },
        "reference_id": {
          "type": "string",
          "title": "Reference Id"
        },
        "interview_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Interview Id"
        },
        "turn_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Turn Id"
        },
        "start_s": {
          "anyOf": [
            {
              "type": "number",
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Start S"
        }
      },
      "type": "object",
      "required": [
        "text",
        "reference_id"
      ],
      "title": "PublicFindingQuote"
    },
    "PublicLearningGoalFindings": {
      "properties": {
        "learning_goal_id": {
          "type": "string",
          "title": "Learning Goal Id"
        },
        "learning_goal": {
          "type": "string",
          "title": "Learning Goal"
        },
        "findings": {
          "items": {
            "$ref": "#/$defs/PublicStudyFinding"
          },
          "type": "array",
          "title": "Findings"
        }
      },
      "type": "object",
      "required": [
        "learning_goal_id",
        "learning_goal"
      ],
      "title": "PublicLearningGoalFindings"
    },
    "PublicParticipantLearningGoalResponse": {
      "properties": {
        "learning_goal_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Learning Goal Id"
        },
        "learning_goal_index": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Learning Goal Index"
        },
        "learning_goal": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Learning Goal"
        },
        "assessment_state": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Assessment State"
        },
        "unavailability_reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Unavailability Reason"
        },
        "explored": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Explored"
        },
        "answered": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Answered"
        },
        "summary": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Summary"
        },
        "quote": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Quote"
        }
      },
      "type": "object",
      "title": "PublicParticipantLearningGoalResponse"
    },
    "PublicParticipantProfileAnswer": {
      "properties": {
        "answer": {
          "type": "string",
          "title": "Answer"
        },
        "participants": {
          "type": "integer",
          "minimum": 0.0,
          "title": "Participants"
        },
        "percentage": {
          "type": "integer",
          "maximum": 100.0,
          "minimum": 0.0,
          "title": "Percentage"
        }
      },
      "type": "object",
      "required": [
        "answer",
        "participants",
        "percentage"
      ],
      "title": "PublicParticipantProfileAnswer"
    },
    "PublicParticipantResponse": {
      "properties": {
        "interview_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Interview Id",
          "description": "Public interview record ID"
        },
        "overall_takeaways": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Overall Takeaways"
        },
        "learning_goal_responses": {
          "items": {
            "$ref": "#/$defs/PublicParticipantLearningGoalResponse"
          },
          "type": "array",
          "title": "Learning Goal Responses"
        }
      },
      "type": "object",
      "title": "PublicParticipantResponse"
    },
    "PublicRecommendedNextStep": {
      "properties": {
        "gap_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Gap Ids"
        },
        "action": {
          "type": "string",
          "title": "Action"
        },
        "study_slug": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Study Slug"
        },
        "title": {
          "type": "string",
          "title": "Title"
        },
        "rationale": {
          "type": "string",
          "title": "Rationale"
        },
        "context": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Context"
        }
      },
      "type": "object",
      "required": [
        "action",
        "title",
        "rationale"
      ],
      "title": "PublicRecommendedNextStep"
    },
    "PublicReportParticipantProfileSection": {
      "properties": {
        "heading": {
          "type": "string",
          "title": "Heading"
        },
        "content": {
          "items": {
            "$ref": "#/$defs/PublicParticipantProfileAnswer"
          },
          "type": "array",
          "title": "Content"
        },
        "reference_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Reference Ids"
        },
        "question_id": {
          "type": "string",
          "title": "Question Id",
          "description": "Stable identifier derived from the profile question heading"
        }
      },
      "type": "object",
      "required": [
        "heading",
        "question_id"
      ],
      "title": "PublicReportParticipantProfileSection"
    },
    "PublicReportReference": {
      "properties": {
        "reference_id": {
          "type": "string",
          "title": "Reference Id",
          "description": "Citation id used in the report text"
        },
        "interview_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Interview Id",
          "description": "The interview this reference quotes"
        },
        "audio_recording_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Audio Recording Url"
        },
        "video_recording_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Video Recording Url"
        },
        "started_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Started At",
          "description": "When the interview started"
        },
        "duration_seconds": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Duration Seconds",
          "description": "Interview length in seconds"
        },
        "message_text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Message Text",
          "description": "The quoted message text"
        },
        "turn_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Turn Id",
          "description": "Transcript turn ID, when available"
        },
        "start_s": {
          "anyOf": [
            {
              "type": "number",
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Start S",
          "description": "Seconds into the interview, when stored timing exists"
        }
      },
      "type": "object",
      "required": [
        "reference_id"
      ],
      "title": "PublicReportReference",
      "description": "A citation in the report, resolved to the interview + message it quotes."
    },
    "PublicReportSection": {
      "properties": {
        "heading": {
          "type": "string",
          "title": "Heading"
        },
        "content": {
          "type": "string",
          "title": "Content",
          "default": ""
        },
        "reference_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Reference Ids",
          "description": "Citation IDs that resolve through the report's references array"
        }
      },
      "type": "object",
      "required": [
        "heading"
      ],
      "title": "PublicReportSection"
    },
    "PublicStudyFinding": {
      "properties": {
        "heading": {
          "type": "string",
          "title": "Heading"
        },
        "content": {
          "type": "string",
          "title": "Content",
          "default": ""
        },
        "reference_ids": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Reference Ids",
          "description": "Citation IDs that resolve through the report's references array"
        },
        "finding_id": {
          "type": "string",
          "title": "Finding Id"
        },
        "prevalence": {
          "anyOf": [
            {
              "$ref": "#/$defs/PublicFindingPrevalence"
            },
            {
              "type": "null"
            }
          ]
        },
        "quotes": {
          "items": {
            "$ref": "#/$defs/PublicFindingQuote"
          },
          "type": "array",
          "title": "Quotes"
        },
        "supporting_evidence": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Supporting Evidence"
        },
        "contrary_evidence": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Contrary Evidence"
        },
        "limitations": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Limitations"
        }
      },
      "type": "object",
      "required": [
        "heading",
        "finding_id"
      ],
      "title": "PublicStudyFinding"
    },
    "PublicStudyFindings": {
      "properties": {
        "executive_summary": {
          "anyOf": [
            {
              "$ref": "#/$defs/PublicReportSection"
            },
            {
              "type": "null"
            }
          ]
        },
        "key_metrics": {
          "anyOf": [
            {
              "$ref": "#/$defs/PublicReportSection"
            },
            {
              "type": "null"
            }
          ]
        },
        "learning_goals": {
          "items": {
            "$ref": "#/$defs/PublicLearningGoalFindings"
          },
          "type": "array",
          "title": "Learning Goals"
        },
        "additional_observations": {
          "anyOf": [
            {
              "$ref": "#/$defs/PublicReportSection"
            },
            {
              "type": "null"
            }
          ]
        },
        "other_sections": {
          "items": {
            "$ref": "#/$defs/PublicReportSection"
          },
          "type": "array",
          "title": "Other Sections"
        }
      },
      "type": "object",
      "title": "PublicStudyFindings"
    },
    "SampleAdequacy": {
      "properties": {
        "supports": {
          "type": "string",
          "minLength": 1,
          "title": "Supports"
        },
        "limits": {
          "type": "string",
          "minLength": 1,
          "title": "Limits"
        },
        "additional_interviews": {
          "type": "string",
          "enum": [
            "recommended",
            "not_prioritized",
            "conditional"
          ],
          "title": "Additional Interviews"
        },
        "rationale": {
          "type": "string",
          "minLength": 1,
          "title": "Rationale"
        }
      },
      "type": "object",
      "required": [
        "supports",
        "limits",
        "additional_interviews",
        "rationale"
      ],
      "title": "SampleAdequacy"
    }
  }
}