How to remove subfield using ruby

event.to_hash returns a hash that might contain other hashes, i.e. if the outputdata field has subfields you can access its hash via event['outputdata']. Something like this should work:

event['outputdata'].keys.each { |k|
  event['outputdata'].remove(k) if k.start_with?('ID')
}