toUpload static method
Implementation
static toUpload(Enrollment enrollment, List<Event>? events) {
final filteredEvents =
(events ?? []).where((event) => event.enrollment == enrollment.id);
return {
"enrollment": enrollment.enrollment,
"status": enrollment.status ?? 'ACTIVE',
"trackedEntityInstance": enrollment.trackedEntityInstance,
"geometry":
enrollment.geometry != null ? enrollment.geometry?.toJson() : null,
"orgUnit": enrollment.orgUnit,
"program": enrollment.program,
"enrollmentDate": enrollment.enrollmentDate,
"incidentDate": enrollment.incidentDate,
"events": (filteredEvents).map((event) => Event.toUpload(event)).toList()
};
}