Help Needed: Handling Multiple Patients Extraction & 'BaseModel' object has no attribute '__priva...
Hello Landing AI Community,
I am using Landing AI’s Agentic Document Extraction (ADE) Python SDK to extract structured data from a medical PDF that contains data for multiple patients. While the extraction works and I get some patient data, I am facing two main issues:
Multiple Patients Handling:
The PDF contains multiple patient records, but my current extraction code only returns data for the first patient or a partial subset. I am using a MultiPatientExtractionSchema (a Pydantic model wrapping a list of patients) for extraction, but I’m unsure how to properly aggregate and print all patient entries across all parsed document chunks or pages.Error Encountered:
When trying to print the extracted patient data using .model_dump() on the Pydantic model, I get the following error:
'BaseModel' object has no attribute '__private_attributes__'
I suspect this is related to Pydantic version compatibility, but I am not certain. I want to safely print all patients’ data without this error.
What I have done so far:
Defined a multi-patient schema with a List of patient models.
Used the SDK’s parse() method with my schema.
Attempted to iterate over extraction.patients but only see partial data.
Tried using .dict() instead of .model_dump() to fix the error but unsure if this is the best practice.
Checked SDK and Pydantic versions to no avail.
Request:
Could someone please provide best-practice advice or example code snippets on how to correctly parse and aggregate multiple patient data from a single PDF using Landing AI ADE?
Advice on safely printing or processing the Pydantic model instances without encountering the __private_attributes__ error (compatible with current SDK and Python environment)?
Any tips on handling multi-page or large documents with multiple relevant entries?
Thank you very much in advance! I appreciate any help or pointers. /