Error Uploading `MedicationAdministration` Resourc...
# support
a
Hi Medplum team. I’m running into an issue uploading
MedicationAdministration
resources within a FHIR Bundle. Every attempt to upload results in this error:
Copy code
{
  "resourceType": "OperationOutcome",
  "issue": [
    {
      "severity": "error",
      "code": "invalid",
      "details": {
        "text": "reference.reference?.startsWith is not a function"
      }
    }
  ]
}
I’ve tried various modifications to the resource (e.g., changing medication references, removing encounter, using
occurrenceDateTime
), but the error persists. Consequently, no
MedicationAdministration
entries appear at https://app.medplum.com/MedicationAdministration. Other resources like
Patient
,
Condition
, and
Observation
upload and display with no issues. Any ideas on what could be causing this? I’d appreciate any help! Thanks!
r
@alex_empallo do you have an example bundle that you could share?
a
@rahul1 Hi, thanks for your message. Okay, I have attached one to this message. The
Patient
resource here is fine, but both of the
MedicationAdministration
resources yield the error from my previous message. I'm kind of working with dummy files for now, hence the
???
values for certain "unimportant" fields.
r
And just to confirm, this MedicationAdministration works correctly when not used in a batch?
This issue is most likely this reference:
Copy code
"medication": {
                    "reference": "#medication_code"
                },
This
#medication_code
reference is not a valid reference, since it points to a contained resource which is not present
What are you trying to represent with this data?
a
Hi @rahul1, thanks for your response. The issue was indeed with the medication reference. I updated the
MedicationAdministration
resource to use
medicationReference
and moved the medication details into a
"contained"
key/resource. I also used
effectiveDateTime
to track DTM and removed the invalid encounter property. The upload is now working correctly, really appreciate your help!
151 Views