Calculation to string_join property of map of related resource?

If I’m using AshEvents as resource called MyApp.Events.EventLog. It has a data field that is a map with a property called source_name.

From my resource, how can I string_join the property?

This will join the whole data field.

Instead of %{"source_name" => "api"},%{"source_name" => "api"}, I want api,api.

  calculations do
    calculate :source_names,
              :string,
              expr(
                string_join(
                  list(
                    MyApp.Events.EventLog,
                    field: :data,
                    filter: expr(record_id == parent(id))
                  ),
                  ","
                )
              )
  end

I had to create a calculation in MyApp.Events.EventLog for the property of the map.

# In MyApp.Events.EventLog
calculations do
  calculate :source_name, :string, expr(data[:source_name])
end
  calculations do
    calculate :source_names,
              :string,
              expr(
                string_join(
                  list(
                    MyApp.Events.EventLog,
                    field: :source_name,
                    filter: expr(record_id == parent(id))
                  ),
                  ","
                )
              )
  end