Registration
registration
Service class for handling registration workflows in Kaleidoscope.
This module provides methods for submitting results as part of the registration process. The typical workflow is:
- Receive a
registration_submittedwebhook event containing afile_urlandrecord_ids. - Download the file using :meth:
FilesService.download_file. - Process the file externally.
- Submit results back using :meth:
RegistrationService.submit_results.
Classes:
| Name | Description |
|---|---|
RegistrationService |
Service for submitting results in registration workflows. |
Example
# Download the file from the webhook event
path = client.files.download_file(
file_id="file-uuid",
filename="original_filename.csv",
destination="/tmp/downloads",
)
# After processing, submit results back
client.registration.submit_results(
operation_id="operation-uuid",
file_id="file-uuid",
status="success",
key_field_names=["id", "name"],
records=[
{
"record_id": "record-uuid",
"status": "matched",
"data": {"id": "123", "name": "Example"},
}
],
)
RegistrationService
RegistrationService(client: KaleidoscopeClient)
Service class for registration workflows.
Provides methods to submit processing results, supporting the registration webhook lifecycle.
Methods:
| Name | Description |
|---|---|
submit_results |
Submit registration results for a processed file. |
Source code in kalbio/registration.py
57 58 | |
submit_results
submit_results(operation_id: str, file_id: str, status: Literal['success', 'error'], error_message: str | None = None, key_field_names: list[str] | None = None, records: list[dict[str, Any]] | None = None) -> bool
Submit registration results for a processed file.
Called after downloading and processing a file from a
registration_submitted webhook event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
operation_id
|
str
|
The operation ID from the webhook event. |
required |
file_id
|
str
|
The file ID from the webhook event. |
required |
status
|
Literal['success', 'error']
|
Overall result status. |
required |
error_message
|
str
|
Error description when status
is |
None
|
key_field_names
|
list[str]
|
Names of key fields in the
result data (e.g. |
None
|
records
|
list[dict[str, Any]]
|
Per-record results. Each
dict should contain |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the results were submitted successfully (204), |
bool
|
False on failure. |
Example
success = client.registration.submit_results(
operation_id="op-uuid",
file_id="file-uuid",
status="success",
key_field_names=["id"],
records=[
{
"record_id": "rec-uuid",
"status": "matched",
"data": {"id": "123"},
}
],
)
Source code in kalbio/registration.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |