mainmatter / breethe-server

Air Quality Data for Locations around the World

Home Page:https://breethe.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Elixir.Ecto.InvalidChangesetError: could not perform insert because changeset is invalid.

marcoow opened this issue · comments

https://sentry.io/simplabs/ppm-server/issues/570417059/

Elixir.Ecto.InvalidChangesetError: could not perform insert because changeset is invalid.

Applied changes

    %{
      available_parameters: [:o3, :pm25, :bc, :co, :no2],
      city: "San Francisco-Oakland-Fremont",
      coordinates: %Geo.Point{coordinates: {37.864765, -122.30274}, srid: 4326},
      country: "US",
      identifier: "Berkeley Aquatic Par",
      last_updated: #DateTime<2018-06-02 12:00:00.000Z>
    }

Params

    %{
      "available_parameters" => ["o3", "pm25", "bc", "co", "no2"],
      "city" => "San Francisco-Oakland-Fremont",
      "coordinates" => %Geo.Point{coordinates: {37.864765, -122.30274}, srid: 4326},
      "country" => "US",
      "identifier" => "Berkeley Aquatic Par",
      "last_updated" => #DateTime<2018-06-02 12:00:00.000Z>
    }

Errors

    %{identifier: [{"has already been taken", []}]}

Changeset

    #Ecto.Changeset<
      action: :insert,
      changes: %{
        available_parameters: [:o3, :pm25, :bc, :co, :no2],
        city: "San Francisco-Oakland-Fremont",
        coordinates: %Geo.Point{coordinates: {37.864765, -122.30274}, srid: 4326},
        country: "US",
        identifier: "Berkeley Aquatic Par",
        last_updated: #DateTime<2018-06-02 12:00:00.000Z>
      },
      errors: [identifier: {"has already been taken", []}],
      data: #Breethe.Data.Location<>,
      valid?: false
    >

  File "lib/ecto/repo/schema.ex", line 128, in Ecto.Repo.Schema.insert!/4
  File "lib/breethe/data/data.ex", line 42, in Breethe.Data.create_location/1
  File "lib/enum.ex", line 1294, in Enum."-map/2-lists^map/1-0-"/2
  File "lib/breethe/sources/open_aq/locations.ex", line 7, in Breethe.Sources.OpenAQ.Locations.get_locations/2
  File "lib/breethe/sources/open_aq.ex", line 22, in Breethe.Sources.OpenAQ.get_locations/2
...
(3 additional frame(s) were not displayed)

(Ecto.InvalidChangesetError) could not perform insert because changeset is invalid.

Applied changes

    %{
      available_parameters: [:o3, :pm25, :bc, :co, :no2],
      city: "San Francisco-Oakland-Fremont",
      coordinates: %Geo.Point{coordinates: {37.864765, -122.30274}, srid: 4326},
      country: "US",
      identifier: "Berkeley Aquatic Par",
      last_updated: #DateTime<2018-06-02 12:00:00.000Z>
    }

Params

    %{
      "available_parameters" => ["o3", "pm25", "bc", "co", "no2"],
      "city" => "San Francisco-Oakland-Fremont",
      "coordinates" => %Geo.Point{coordinates: {37.864765, -122.30274}, srid: 4326},
      "country" => "US",
      "identifier" => "Berkeley Aquatic Par",
      "last_updated" => #DateTime<2018-06-02 12:00:00.000Z>
    }

Errors

    %{identifier: [{"has already been taken", []}]}

Changeset

    #Ecto.Changeset<
      action: :insert,
      changes: %{
        available_parameters: [:o3, :pm25, :bc, :co, :no2],
        city: "San Francisco-Oakland-Fremont",
        coordinates: %Geo.Point{coordinates: {37.864765, -122.30274}, srid: 4326},
        country: "US",
        identifier: "Berkeley Aquatic Par",
        last_updated: #DateTime<2018-06-02 12:00:00.000Z>
      },
      errors: [identifier: {"has already been taken", []}],
      data: #Breethe.Data.Location<>,
      valid?: false
    >

this is a duplicate of #86 of course