# External Callback Remarks Reference

Lists every possible `remarks` value the two external status callbacks can send, sourced from
`AssessmentDataImportService::importStudentMarks()` / `updateAssessmentMarkByExternalApi()`
(mark import) and `createAssessmentWithQuestions()` / `createAssessmentSchemaByExternalApi()`
(assessment schema).

## Mark Import — `sendMarkImportCallback()` → `buildCallbackResponse()`

Per-student `remarks` (only entries with a resolvable `Student Code:` are sent; source: `importStudentMarks()`):

| status | remarks |
|---|---|
| FAILURE | `Warning: Student {studentCode} not found in any subject community` |
| FAILURE | `Warning: Assessment not found for student {studentCode}` |
| FAILURE | `Error: Mark for student {studentCode} exceeds max mark` |
| FAILURE | `Error: Total mark for student {studentCode} exceeds max mark` |
| FAILURE | `Error: Normalized mark for student {studentCode} exceeds normalized max mark` |
| FAILURE | `Error importing marks for student {studentCode}: {exception message}` (dynamic) |
| DATA_CAPTURED_SUCCESSFULLY | `Success: uploaded for student` |

Community-level issues (no student code — do **not** appear as per-student remarks, but still count toward
overall `processStatus` = FAILED in `updateAssessmentMarkByExternalApi()`):

- `Warning: No exam found for community {communityName}`

## Assessment Schema — `sendSchemaStatusCallback()`

Single row `remarks` = all `issues` (warnings + errors) messages joined with `, `. Possible source messages
(from `createAssessmentWithQuestions()` / `createAssessmentSchemaByExternalApi()`):

- `Warning: CO: {coCode} not found in community ({communityName}) for question {order}`
- `Error creating assessment for {subjectCode}: {exception message}` (dynamic)

If no issues were recorded and `$logRequest->status === 'SUCCESS'`, `remarks` falls back to:

- `Created successfully`

## Notes

- `{studentCode}`, `{communityName}`, `{coCode}`, `{subjectCode}`, `{order}` are runtime values, not fixed text.
- Exception-derived remarks (`{exception message}`) are free-form and not enumerable in advance.
- Regex used to attribute an issue/success entry to a student: `/Student Code:\s*([^,]+)/` against the
  `details` field — every student-level `updateImportStatus()` call must lead with `Student Code: {code}` for
  the entry to reach the mark-import payload.
