cadia-lvl / Eyra

Apache License 2.0
1 stars 2 forks source link

Calling `GET /backend/qc/report/session/<session_id>` returns invalid JSON when report is available #3

Closed rkjaran closed 5 years ago

rkjaran commented 6 years ago

Example result if you call GET /backend/qc/report/session/<session_id>:

{
  "status": "processing",
  "modules": [
    "{\"perRecordingStats\": [{\"stats\": {\"old_wer_norm\": 1.0, \"startdel\": 0, \"del\": 0, \"wer\": 1.0, \"hybrid\": 1.0, \"sub\": 0, \"hyp\": \"skilor\\u00f0sbundin refsing fyrir \\u00e1r\\u00e1sir\", \"distance\": 0, \"error\": \"no_error\", \"extraInsertions\": 0, \"accuracy\": 1.0, \"onlyInsOrSub\": false, \"ins\": 0, \"enddel\": 0, \"correct\": 4, \"empty\": false, \"ops\": [\"C\", \"C\", \"C\", \"C\"], \"phone_acc\": 1.0}, \"recordingId\": 33400}, {\"stats\": {\"old_wer_norm\": 0.0, \"startdel\": 0, \"del\": 0, \"wer\": 0.4444444444444444, \"hybrid\": 0.5, \"sub\": 5, \"hyp\": \"\\u00fearna d\\u00fak !s !c !\\u026a !v !\\u026a !\\u00f0 !i !n !t !o !u og bj\\u00e1nalegri sk\\u00e1l\", \"distance\": 12, \"error\": \"no_error\", \"extraInsertions\": 0, \"accuracy\": 0.5714285714285714, \"onlyInsOrSub\": false, \"ins\": 7, \"enddel\": 0, \"correct\": 4, \"empty\": false, \"ops\": [\"C\", \"I\", \"I\", \"I\", \"I\", \"I\", \"I\", \"I\", \"S\", \"S\", \"S\", \"S\", \"S\", \"C\", \"C\", \"C\"], \"phone_acc\": 0.5714285714285714}, \"recordingId\": 33401}, {\"stats\": {\"old_wer_norm\": 0.8, \"startdel\": 0, \"del\": 1, \"wer\": 0.8, \"hybrid\": 0.8, \"sub\": 0, \"hyp\": \"kosningin f\\u00f3r fram s\\u00ed\\u00f0astli\\u00f0inn\", \"distance\": 1, \"error\": \"no_error\", \"extraInsertions\": 0, \"accuracy\": 0.7567567567567568, \"onlyInsOrSub\": false, \"ops\": [\"C\", \"C\", \"C\", \"C\", \"D\"], \"enddel\": 1, \"correct\": 4, \"empty\": false, \"ins\": 0, \"phone_acc\": 0.7567567567567568}, \"recordingId\": 33402}, {\"stats\": {\"old_wer_norm\": 0.75, \"startdel\": 0, \"del\": 1, \"wer\": 0.75, \"hybrid\": 0.75, \"sub\": 0, \"hyp\": \"hva\\u00f0 ver\\u00f0ur lengi\", \"distance\": 1, \"error\": \"no_error\", \"extraInsertions\": 0, \"accuracy\": 0.8421052631578947, \"onlyInsOrSub\": false, \"ops\": [\"C\", \"C\", \"C\", \"D\"], \"enddel\": 1, \"correct\": 3, \"empty\": false, \"ins\": 0, \"phone_acc\": 0.8421052631578947}, \"recordingId\": 33403}, {\"stats\": {\"old_wer_norm\": 1.0, \"startdel\": 0, \"wer\": 1.0, \"hybrid\": 1.0, \"distance\": 0, \"error\": \"no_error\", \"extraInsertions\": 0, \"onlyInsOrSub\": false, \"ins\": 0, \"phone_acc\": 1.0, \"sub\": 0, \"hyp\": \"tugir hafa s\\u00e6rst a\\u00f0 s\\u00f6gn yfirvalda\", \"del\": 0, \"empty\": false, \"accuracy\": 1.0, \"enddel\": 0, \"correct\": 6, \"ops\": [\"C\", \"C\", \"C\", \"C\", \"C\", \"C\"]}, \"recordingId\": 33404}, {\"stats\": {\"old_wer_norm\": 0.8, \"startdel\": 0, \"wer\": 0.8, \"hybrid\": 0.8, \"distance\": 1, \"error\": \"no_error\", \"extraInsertions\": 0, \"onlyInsOrSub\": false, \"ins\": 0, \"phone_acc\": 0.71875, \"sub\": 0, \"hyp\": \"fj\\u00f3rir \\u00e1 sj\\u00fakrah\\u00fas eftir\", \"del\": 1, \"empty\": false, \"accuracy\": 0.71875, \"enddel\": 1, \"correct\": 4, \"ops\": [\"C\", \"C\", \"C\", \"C\", \"D\"]}, \"recordingId\": 33405}], \"sessionId\": 355, \"totalStats\": {\"lowerUtt\": 4, \"avgAcc\": 0.859375, \"upperUtt\": 6, \"accuracy\": 0.8259738239179029}, \"requestId\": \"963753bc-a57f-43c2-8604-190e7c35f836\"}"
  ],
  "sessionId": 355
}

Expected according to ClientServerAPI.md

    {"sessionId": ...,
     "status": "processing",
     "modules"  {
        "marosijo" :  {
                        "perRecordingStats": [
                            {"recordingId": ...,
                                "stats": {...}
                            },
                            ...]}
                        ]
                      }
                }
    }
rkjaran commented 6 years ago

See qc_handler.py. When loading reports that have been dumped to disk they're loaded as strings. The variable reports in the try block shadows the reports dict defined on line 194