-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Autotracing: new step flights (#725)
* Added new auto-tracing step with related test cases. Changed employer step date input and fixed related test cases. * Added translations. * Fixed flight question, added min and max to flight date picker. * Make sure inserted_at is a date * Changed field name, fixed correct start date for cases with tests and no symptoms, fixed spec. * Removed uneccessary date limit function call. * Fixed credo warning. * Fixed de translations.
- Loading branch information
Showing
23 changed files
with
1,091 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
apps/hygeia/lib/hygeia/auto_tracing_context/auto_tracing/flight.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
defmodule Hygeia.AutoTracingContext.AutoTracing.Flight do | ||
@moduledoc "Module responsible for tracking flight information." | ||
|
||
use Hygeia, :model | ||
|
||
@type empty :: %__MODULE__{ | ||
uuid: Ecto.UUID.t() | nil, | ||
flight_date: Date.t(), | ||
flight_number: String.t() | nil, | ||
seat_number: String.t() | nil, | ||
wore_mask: boolean() | nil | ||
} | ||
|
||
@type t :: %__MODULE__{ | ||
uuid: Ecto.UUID.t() | nil, | ||
flight_date: Date.t(), | ||
flight_number: String.t() | nil, | ||
seat_number: String.t() | nil, | ||
wore_mask: boolean() | nil | ||
} | ||
|
||
embedded_schema do | ||
field :flight_date, :date | ||
field :flight_number, :string | ||
field :seat_number, :string | ||
field :wore_mask, :boolean | ||
end | ||
|
||
@spec changeset(schema :: t() | empty() | Changeset.t(t() | empty()), attrs :: map()) :: | ||
Ecto.Changeset.t(t()) | ||
def changeset(schema, attrs \\ %{}) do | ||
schema | ||
|> cast(attrs, [:uuid, :flight_date, :flight_number, :seat_number, :wore_mask]) | ||
|> validate_required([:flight_date, :flight_number, :seat_number, :wore_mask]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
apps/hygeia/priv/repo/migrations/20211012170218_auto_tracing_add_flight_step.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# credo:disable-for-this-file Credo.Check.Readability.Specs | ||
defmodule Hygeia.Repo.Migrations.AutoTracingAddFlightStep do | ||
@moduledoc false | ||
|
||
use Hygeia, :migration | ||
|
||
alias Hygeia.AutoTracingContext.AutoTracing.Step | ||
|
||
@disable_ddl_transaction true | ||
|
||
def up do | ||
execute(""" | ||
ALTER TYPE | ||
#{Step.type()} | ||
ADD VALUE IF NOT EXISTS 'flights' AFTER 'clinical'; | ||
""") | ||
end | ||
end |
15 changes: 15 additions & 0 deletions
15
apps/hygeia/priv/repo/migrations/20211012203320_add_flights_to_auto_tracings.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# credo:disable-for-this-file Credo.Check.Readability.Specs | ||
defmodule Hygeia.Repo.Migrations.AddFlightsToAutoTracings do | ||
@moduledoc false | ||
|
||
use Hygeia, :migration | ||
|
||
@disable_ddl_transaction true | ||
|
||
def up do | ||
alter table(:auto_tracings) do | ||
add :has_flown, :boolean | ||
add :flights, {:array, :map} | ||
end | ||
end | ||
end |
18 changes: 18 additions & 0 deletions
18
apps/hygeia/priv/repo/migrations/20211012213226_auto_tracing_problem_flight_related.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# credo:disable-for-this-file Credo.Check.Readability.Specs | ||
defmodule Hygeia.Repo.Migrations.AutoTracingProblemFlightRelated do | ||
@moduledoc false | ||
|
||
use Hygeia, :migration | ||
|
||
alias Hygeia.AutoTracingContext.AutoTracing.Problem | ||
|
||
@disable_ddl_transaction true | ||
|
||
def up do | ||
execute(""" | ||
ALTER TYPE | ||
#{Problem.type()} | ||
ADD VALUE IF NOT EXISTS 'flight_related'; | ||
""") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.