Analyses Not Appearing on New Analysis Requests Created via API (But Work When Copied using Copy to New Option))

whenever we create a new Analysis Request (AR) via the API—and specify an Analysis Profile—no individual analyses appear on the newly created AR. However, if we copy an existing AR (one that already has analyses attached) to a new AR, it works perfectly, and the analyses are duplicated as expected.

JSON payload
http://localhost:8090/senaite/@@API/senaite/v1/create
{
“parent_uid”: “0738b166381a437d9c46541dd393d6d3”,
“portal_type”: “AnalysisRequest”,
“parent_path”: “/senaite/bika_setup/bika_analysisservices”,
“Contact”: “235771ecc8fd40638c0cc615f4e4294f”,
“SampleType”: “59a9b56aba534b58be54835b90246c73”,
“DateSampled”: “2024-08-30T11:35:43”,
“DateReceived”: “2024-08-30T11:40:00”,
“Profiles”: [
“e5bb797210b444bfb370e00163ed80a2”
],
“MedicalRecordNumber”: “MK8951003”,
“PatientFullName”: “Test”
}

Hi Sagar,

for me, not understood
“parent_path”: “/senaite/bika_setup/bika_analysisservices”,

i would supposed to be similar like “parent_path”: “/senaite/clients/client-xxx”
i didn’t test it. just for your reference.

Deng

Hello Fengyun,

Thank you for your reply.

The API works without the parent_path, but it should look like you described.
{
“parent_uid”: “0738b166381a437d9c46541dd393d6d3”,
“portal_type”: “AnalysisRequest”,
“Contact”: “235771ecc8fd40638c0cc615f4e4294f”,
“SampleType”: “59a9b56aba534b58be54835b90246c73”,
“DateSampled”: “2024-08-30T11:35:43”,
“DateReceived”: “2024-08-30T11:40:00”,
“Profiles”: [
“e5bb797210b444bfb370e00163ed80a2”
],
“MedicalRecordNumber”: “MK8951003”,
“PatientFullName”: “Test”
}

But the problem is, I have to specify every uid of Analysis

{
“parent_uid”: “0738b166381a437d9c46541dd393d6d3”,
“portal_type”: “AnalysisRequest”,
“parent_path”: “/senaite/clients/client-1”,
“Contact”: “235771ecc8fd40638c0cc615f4e4294f”,
“SampleType”: “59a9b56aba534b58be54835b90246c73”,
“DateSampled”: “2024-08-30T11:35:43”,
“DateReceived”: “2024-08-30T11:40:00”,
“Profiles”: [
“e5bb797210b444bfb370e00163ed80a2”
],
“Analyses”: [
“e5bb797210b444bfb370e00163ed80b2”,“5353e1510d084e2aafe9ae8a924efc32”
],
“MedicalRecordNumber”: “MK8951003”,
“PatientFullName”: “Test”
}

like this, whereas previously, I only had to specify “Profiles,” and it automatically got the analysis IDs associated with that profile.

So, I’m asking if I missed anything that needs to be added to make it work correctly.

This is the log when the API works as expected

2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,792 WARNING [senaite.core:107][waitress-2] Transition ‘initialize’ not allowed: Analysis ‘Enterocnt’ (registered)
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,792 WARNING [senaite.core:107][waitress-2] Transition ‘initialize’ not allowed: Analysis ‘Enterocnt’ (registered)
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,792 ERROR [senaite.core:108][waitress-2] No workflow provides the ‘${action_id}’ action.
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,792 ERROR [senaite.core:108][waitress-2] No workflow provides the ‘${action_id}’ action.
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,793 WARNING [senaite.core:107][waitress-2] Transition ‘rollback_to_receive’ not allowed: AnalysisRequest ‘d597668cef255410d9265e751950c91b’ (sample_registered)
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,793 WARNING [senaite.core:107][waitress-2] Transition ‘rollback_to_receive’ not allowed: AnalysisRequest ‘d597668cef255410d9265e751950c91b’ (sample_registered)
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,794 ERROR [senaite.core:108][waitress-2] No workflow provides the ‘${action_id}’ action.
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,794 ERROR [senaite.core:108][waitress-2] No workflow provides the ‘${action_id}’ action.
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,868 WARNING [senaite.core:107][waitress-2] Transition ‘initialize’ not allowed: Analysis ‘TVBcnt’ (registered)
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,868 WARNING [senaite.core:107][waitress-2] Transition ‘initialize’ not allowed: Analysis ‘TVBcnt’ (registered)
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,868 ERROR [senaite.core:108][waitress-2] No workflow provides the ‘${action_id}’ action.
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,868 ERROR [senaite.core:108][waitress-2] No workflow provides the ‘${action_id}’ action.
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,869 WARNING [senaite.core:107][waitress-2] Transition ‘rollback_to_receive’ not allowed: AnalysisRequest ‘d597668cef255410d9265e751950c91b’ (sample_registered)
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,869 WARNING [senaite.core:107][waitress-2] Transition ‘rollback_to_receive’ not allowed: AnalysisRequest ‘d597668cef255410d9265e751950c91b’ (sample_registered)
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,869 ERROR [senaite.core:108][waitress-2] No workflow provides the ‘${action_id}’ action.
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,869 ERROR [senaite.core:108][waitress-2] No workflow provides the ‘${action_id}’ action.
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,932 WARNING [senaite.core:107][waitress-2] Transition ‘initialize’ not allowed: Analysis ‘Ecolicnt’ (registered)
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,932 WARNING [senaite.core:107][waitress-2] Transition ‘initialize’ not allowed: Analysis ‘Ecolicnt’ (registered)
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,932 ERROR [senaite.core:108][waitress-2] No workflow provides the ‘${action_id}’ action.
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,932 ERROR [senaite.core:108][waitress-2] No workflow provides the ‘${action_id}’ action.
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,933 WARNING [senaite.core:107][waitress-2] Transition ‘rollback_to_receive’ not allowed: AnalysisRequest ‘d597668cef255410d9265e751950c91b’ (sample_registered)
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,933 WARNING [senaite.core:107][waitress-2] Transition ‘rollback_to_receive’ not allowed: AnalysisRequest ‘d597668cef255410d9265e751950c91b’ (sample_registered)
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,933 ERROR [senaite.core:108][waitress-2] No workflow provides the ‘${action_id}’ action.
2025-01-08 17:41:26 senaite-1 | 2025-01-08 11:56:26,933 ERROR [senaite.core:108][waitress-2] No workflow provides the ‘${action_id}’ action.
2025-01-08 17:41:27 senaite-1 | 2025-01-08 11:56:27,001 INFO [senaite.core:521][waitress-2] generateUniqueId: 0084
2025-01-08 17:41:27 senaite-1 | 2025-01-08 11:56:27,001 INFO [senaite.core:521][waitress-2] generateUniqueId: 0084
2025-01-08 17:41:27 senaite-1 | 172.18.0.1 - admin [08/Jan/2025:11:56:26 +0000] “POST /senaite/%40%40API/senaite/v1/create HTTP/1.1” 200 6413 “-” “PostmanRuntime/7.43.0”

The new version does not show this log but I have to specify the analysis IDs to make it work.

Hi Sagar,
yes, you don’t need parent_path, because you have defined parent_uid already.
I have no idea, make sure your uid of Profiles is correct

Deng

Hi Sagar,
I tested like this
{
“parent_uid”: “your uid”,
“portal_type”: “AnalysisRequest”,
“Contact”: “your uid”,
“SampleType”: “your uid”,
“DateSampled”: “2024-08-30T11:35:43”,
“DateReceived”: “2024-08-30T11:40:00”,
“Profiles”: [“your uid1”, “your uid2”]
}

And

{
“parent_uid”: “your uid”,
“portal_type”: “AnalysisRequest”,
“Contact”: “your uid”,
“SampleType”: “your uid”,
“DateSampled”: “2024-08-30T11:35:43”,
“DateReceived”: “2024-08-30T11:40:00”,
“Analyses”: [“your uid1”, “your uid2”]
}

no problem. both work well.

Deng