{
 "use_case": "split-sheet-check",
 "title": "Split-sheet check: a fictional three-song EP with planted errors, and a scanned split sheet",
 "about": "A fictional three-song EP: three split sheets, a DDEX release file, a society registration export and two co-publishing contract excerpts, with planted errors. The check must read every document and find the 105% split, the wrong ISWC check digit, the co-writer missing from a source and the society mismatch, and end in a signed record that verifies. A second, smaller catalog adds a scanned split sheet (PDF, read by OCR) and a distributor CSV with a wrong UPC check digit.",
 "licence": "Fictional catalog generated by scripts/splits_data.py (seeded): names, songs, societies' registrations and identifiers are invented. Part of decosa-api, AGPL-3.0-or-later.",
 "inputs": [
  {
   "file": "inputs/harbor-lights/harbor-lights-split-sheet.txt",
   "what": "A split sheet: song, writers, roles, shares, societies, IPIs and publishers (text, PDF, DOCX or a scan)."
  },
  {
   "file": "inputs/harbor-lights/northbound-hymn-split-sheet.eml.txt",
   "what": "A split sheet agreed by email."
  },
  {
   "file": "inputs/harbor-lights/the-long-way-round-split-sheet.txt",
   "what": "A third split sheet."
  },
  {
   "file": "inputs/harbor-lights/harbor-lights-ep-ddex-ern-4.3.xml",
   "what": "The release metadata as a DDEX ERN 4.3 message (or a distributor CSV)."
  },
  {
   "file": "inputs/harbor-lights/marisol-the-tides-society-registration-export.csv",
   "what": "The society (PRO/MLC) registration export as CSV."
  },
  {
   "file": "inputs/harbor-lights/co-publishing-agreement-tobias-okafor.txt",
   "what": "A co-publishing contract excerpt."
  },
  {
   "file": "inputs/harbor-lights/co-publishing-agreement-junie-castellanos.txt",
   "what": "A second co-publishing contract excerpt."
  },
  {
   "file": "inputs/copper-moon/wildflower-radio-split-sheet-scan.pdf",
   "what": "A scanned, handwritten-style split sheet (PDF with no text layer: read by OCR)."
  },
  {
   "file": "inputs/copper-moon/tin-roof-rain-split-sheet.txt",
   "what": "A typed split sheet for the second song."
  },
  {
   "file": "inputs/copper-moon/wildflower-radio-ep-distributor-metadata.csv",
   "what": "Release metadata as a distributor CSV."
  },
  {
   "file": "inputs/copper-moon/low-orbit-society-registration-export.csv",
   "what": "The society registration export for that catalog."
  }
 ],
 "steps": [
  {
   "id": "check",
   "method": "POST",
   "path": "/splits/check",
   "timeout": 300,
   "body": {
    "title": "Rehearsal: Harbor Lights EP (fictional)",
    "stream": false,
    "documents": [
     {
      "name": "Harbor Lights - split sheet.txt",
      "kind": "split_sheet",
      "text": {
       "$file": "inputs/harbor-lights/harbor-lights-split-sheet.txt"
      }
     },
     {
      "name": "Northbound Hymn - split sheet.eml.txt",
      "kind": "split_sheet",
      "text": {
       "$file": "inputs/harbor-lights/northbound-hymn-split-sheet.eml.txt"
      }
     },
     {
      "name": "The Long Way Round - split sheet.txt",
      "kind": "split_sheet",
      "text": {
       "$file": "inputs/harbor-lights/the-long-way-round-split-sheet.txt"
      }
     },
     {
      "name": "Harbor Lights EP - DDEX ERN 4.3.xml",
      "kind": "release",
      "text": {
       "$file": "inputs/harbor-lights/harbor-lights-ep-ddex-ern-4.3.xml"
      }
     },
     {
      "name": "Marisol & the Tides - society registration export.csv",
      "kind": "registration",
      "text": {
       "$file": "inputs/harbor-lights/marisol-the-tides-society-registration-export.csv"
      }
     },
     {
      "name": "Co-publishing agreement - Tobias Okafor (excerpt).txt",
      "kind": "contract",
      "text": {
       "$file": "inputs/harbor-lights/co-publishing-agreement-tobias-okafor.txt"
      }
     },
     {
      "name": "Co-publishing agreement - Junie Castellanos (excerpt).txt",
      "kind": "contract",
      "text": {
       "$file": "inputs/harbor-lights/co-publishing-agreement-junie-castellanos.txt"
      }
     }
    ]
   }
  },
  {
   "id": "scan",
   "method": "POST",
   "path": "/splits/check",
   "timeout": 300,
   "body": {
    "title": "Rehearsal: Wildflower Radio EP (fictional)",
    "stream": false,
    "documents": [
     {
      "name": "Wildflower Radio - split sheet (scan).pdf",
      "kind": "split_sheet",
      "data_b64": {
       "$b64": "inputs/copper-moon/wildflower-radio-split-sheet-scan.pdf"
      }
     },
     {
      "name": "Tin Roof Rain - split sheet.txt",
      "kind": "split_sheet",
      "text": {
       "$file": "inputs/copper-moon/tin-roof-rain-split-sheet.txt"
      }
     },
     {
      "name": "Wildflower Radio EP - distributor metadata.csv",
      "kind": "release",
      "text": {
       "$file": "inputs/copper-moon/wildflower-radio-ep-distributor-metadata.csv"
      }
     },
     {
      "name": "Low Orbit - society registration export.csv",
      "kind": "registration",
      "text": {
       "$file": "inputs/copper-moon/low-orbit-society-registration-export.csv"
      }
     }
    ]
   }
  },
  {
   "id": "verify",
   "method": "POST",
   "path": "/record/verify",
   "auth": false,
   "body": {
    "record": {
     "$ref": "check.report.record"
    }
   }
  },
  {
   "id": "tampered",
   "method": "POST",
   "path": "/record/verify",
   "auth": false,
   "body": {
    "record": {
     "$ref": "check.report.record"
    }
   },
   "tamper": {
    "at": "record.statement.errors",
    "set": 0
   }
  }
 ],
 "checks": [
  {
   "says": "all seven documents are read",
   "path": "check.sources[ok=true]",
   "count": 7
  },
  {
   "says": "the 105% split is found",
   "path": "check.report.issues[kind=share_total,message~105%]",
   "count_min": 1
  },
  {
   "says": "the wrong ISWC check digit is found",
   "path": "check.report.issues[kind=id_invalid,message~ISWC]",
   "count_min": 1
  },
  {
   "says": "the co-writer missing from a source (Beatriz Thibodeaux) is found",
   "path": "check.report.issues[kind=missing_writer,message~Thibodeaux]",
   "count_min": 1
  },
  {
   "says": "the society mismatch (Tobias Okafor) is found",
   "path": "check.report.issues[kind=pro_mismatch,message~Okafor]",
   "count_min": 1
  },
  {
   "says": "the composer/lyricist swap (Junie Castellanos) is found",
   "path": "check.report.issues[kind=role_mismatch,message~Castellanos]",
   "count_min": 1
  },
  {
   "says": "the scanned split sheet is read by OCR: its writers are found",
   "path": "scan.sources[name~scan][0].works[0].writers",
   "contains": "Tobias Takeda"
  },
  {
   "says": "the wrong UPC check digit in the distributor CSV is found",
   "path": "scan.report.issues[kind=id_invalid,message~UPC]",
   "count_min": 1
  },
  {
   "says": "the wrong IPI check digit is found",
   "path": "scan.report.issues[kind=id_invalid,message~IPI]",
   "count_min": 1
  },
  {
   "says": "the signed record verifies",
   "path": "verify.ok",
   "equals": true
  },
  {
   "says": "a record with its error count changed no longer verifies",
   "path": "tampered.ok",
   "equals": false
  },
  {
   "says": "every model call has a signed receipt",
   "receipts": "signed"
  }
 ]
}
