Parent-Child Case Management: Batch Number Not Displaying Correctly When Registering Multiple Batches Under One Medicine

Description:
Hello CommCare Community,
I am developing a Pharmacy Inventory Management System for a rural health center in Ethiopia using CommCare.
I am facing a problem with Parent-Child Case Management when registering multiple batches under one medicine.
My current case architecture:
Parent Case Type: medicine
Child Case Type: batch
Another Child Case Type: stock_transaction
My intended architecture is:
Medicine (Parent)
|
|--- Batch 1 (Child)
| batch_number = dbg123
|
|--- Batch 2 (Child)
batch_number = vbc765
The problem:
I register a medicine called dani.
I select dani as the parent case.
I register the first batch with batch number dbg123.
Then I register a second batch under the same medicine with batch number vbc765.
However, when I open Stock Transaction and select the parent medicine dani, the child batch list displays two identical batch numbers instead of showing dbg123 and vbc765 separately.
I also checked the Batch Case Type using Case List Explorer.
Interestingly, the batch_number property appears to contain medicine names such as Folic Acid and amoxicillin 500 mg instead of the actual batch numbers.
My questions:
What could cause the batch_number case property to store the medicine name instead of the actual batch number?
How should I correctly configure the Case Name and Case Properties when registering child batch cases?
How should I configure Parent-Child Case Selection to display all batches belonging to the selected medicine?
Is there any special configuration required to register multiple child cases under one parent case?
I would appreciate a step-by-step technical explanation.
My goal is to build a reliable offline Pharmacy Inventory Management System with batch tracking, stock receiving, stock issuing, and expiry date monitoring.
Thank you for your support.
Best regards, Tadesse Asefa, Gult Health Center, Ethiopia.

Hi Tadesse,

If you haven't seen it already, there's some documentation on setting up parent-child cases here, with a video tutorial:

What could cause the batch_number case property to store the medicine name instead of the actual batch number?

Could you attach a screenshot of the question that sets this property?

How should I correctly configure the Case Name and Case Properties when registering child batch cases?

You need a menu for each case type, and child cases are registered from the parent menu:

 πŸ“ Medicine Case List
    πŸ—‹ Register Medicine
    πŸ—‹ Register Batch
 πŸ“ Batch Case List
    πŸ—‹ Update Batch

The "Register Batch" form should be a followup form in the Medicine Case List. Then go to the form settings (the :gear: icon), and click "Add a Child Case to open a case for a different Case List". That will pop up something like this:

There you select the Batch Case List and set the case properties you'd like to save for the batch.

If all went well, when you view the case from the case list explorer, you should see a "Related Cases" tab appear next to "Case Properties" and "Case History" that will show you this case's parent.

How should I configure Parent-Child Case Selection to display all batches belonging to the selected medicine?

In the Batch Case List (or other child case menu), on the "Case List" tab, there's a "Select Parent First" option that if checked will present the user with a menu to first select a Medicine case, then a Batch case among those belonging to that medicine.

Is there any special configuration required to register multiple child cases under one parent case?

No, that's standard.

Best of luck

1 Like

Hi Ethan,
Thank you very much for your helpful explanation and for sharing the documentation and video tutorial.
I actually managed to resolve the issue before receiving your response. The problem was that I had placed the Batch Registration form outside the Medicine menu, instead of configuring it as a follow-up form within the Medicine Case List.
After correcting this configuration, the parent-child case relationship worked correctly, and I was able to register multiple batches under a single medicine.
I really appreciate your time, support, and willingness to help. Thank you for being part of the CommCare community!

Best regards,

Tadesse Asefa
Director | Gult Health Center
Andabet District, South Gondar, Ethiopia
Digital Health & Health Systems Innovation
Email: tadesseasefa28@gmail.com
Whatsup: +251936373701
Building stronger primary healthcare through digital innovation.

Glad to hear you were able to move ahead with your project. Best of luck to you!

1 Like