Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autotracing: new step flights #725

Merged
merged 12 commits into from
Oct 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions apps/hygeia/lib/hygeia/auto_tracing_context/auto_tracing.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ defmodule Hygeia.AutoTracingContext.AutoTracing do

use Hygeia, :model

alias Hygeia.AutoTracingContext.AutoTracing.Flight
alias Hygeia.AutoTracingContext.AutoTracing.Occupation
alias Hygeia.AutoTracingContext.AutoTracing.Problem
alias Hygeia.AutoTracingContext.AutoTracing.Propagator
Expand Down Expand Up @@ -67,6 +68,7 @@ defmodule Hygeia.AutoTracingContext.AutoTracing do
field :last_completed_step, Step
field :covid_app, :boolean
field :has_contact_persons, :boolean
field :has_flown, :boolean
field :scholar, :boolean
field :employed, :boolean
field :problems, {:array, Problem}, default: []
Expand All @@ -78,6 +80,7 @@ defmodule Hygeia.AutoTracingContext.AutoTracing do

embeds_many :school_visits, SchoolVisit, on_replace: :delete
embeds_many :occupations, Occupation, on_replace: :delete
embeds_many :flights, Flight, on_replace: :delete

embeds_one :propagator, Propagator, on_replace: :delete

Expand Down Expand Up @@ -174,8 +177,8 @@ defmodule Hygeia.AutoTracingContext.AutoTracing do
nil ->
step_index <= 0

_other ->
step_index <= Enum.find_index(steps, &(&1 == auto_tracing.last_completed_step)) + 1
last_completed_step ->
step_index <= Enum.find_index(steps, &(&1 == last_completed_step)) + 1
end
end
end
Expand Down
36 changes: 36 additions & 0 deletions apps/hygeia/lib/hygeia/auto_tracing_context/auto_tracing/flight.ex
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ defmodule Hygeia.AutoTracingContext.AutoTracing.Problem do
:vaccination_failure,
:hospitalization,
:school_related,
:flight_related,
:new_employer,
:link_propagator,
:residency_outside_country,
Expand All @@ -32,6 +33,7 @@ defmodule Hygeia.AutoTracingContext.AutoTracing.Problem do

def translate(:hospitalization), do: pgettext("Auto Tracing Problem", "Hospitalization")
def translate(:school_related), do: pgettext("Auto Tracing Problem", "School Related")
def translate(:flight_related), do: pgettext("Auto Tracing Problem", "Flight Related")
def translate(:new_employer), do: pgettext("Auto Tracing Problem", "New Employer")
def translate(:link_propagator), do: pgettext("Auto Tracing Problem", "Link Propagator")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ defmodule Hygeia.AutoTracingContext.AutoTracing.Step do
:vaccination,
:covid_app,
:clinical,
:flights,
:transmission,
:contact_persons,
:end
Expand All @@ -29,6 +30,7 @@ defmodule Hygeia.AutoTracingContext.AutoTracing.Step do
def translate(:vaccination), do: pgettext("Auto Tracing Step", "Vaccination")
def translate(:covid_app), do: pgettext("Auto Tracing Step", "SwissCovid App")
def translate(:clinical), do: pgettext("Auto Tracing Step", "Clinical")
def translate(:flights), do: pgettext("Auto Tracing Step", "Flight information")
def translate(:transmission), do: pgettext("Auto Tracing Step", "Transmission")
def translate(:contact_persons), do: pgettext("Auto Tracing Step", "Contact Persons")
def translate(:end), do: pgettext("Auto Tracing Step", "Finish")
Expand Down
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
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
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
65 changes: 64 additions & 1 deletion apps/hygeia_gettext/priv/gettext/de/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ msgstr "Aktivitätskartierung ausgeführt"
msgid "Add"
msgstr "Hinzufügen"

msgid "Add a flight"
msgstr "Flug hinzufügen"

msgid "Add an institution"
msgstr "Bildungseinrichtung hinzufügen"

Expand Down Expand Up @@ -964,6 +967,9 @@ msgstr "Haben Sie Arbeitskollegen getroffen?"
msgid "Did you meet your family or friends recently?"
msgstr "Haben Sie vor kurzem Ihre Familie oder Freunde getroffen?"

msgid "Did you travel by plane between %{start_date} and %{end_date}?"
msgstr "Sind Sie zwischen % {start_date} und % {end_date} mit dem Flugzeug gereist?"

msgid "Did you visit a gym recently?"
msgstr "Haben Sie vor kurzem ein Fitnessstudio besucht?"

Expand All @@ -973,6 +979,9 @@ msgstr "Haben Sie vor kurzem eine Bar / Restaurant / Veranstaltung besucht?"
msgid "Did you visit an educational institution in the 48 hours before the onset of symptoms or 48 hours before the test?"
msgstr "Waren Sie im infektiösen Zeitraum (in den 48 Stunden vor Symptombeginn oder bei Personen ohne Symptome 48 Stunden vor Testzeitpunkt) in einer Schule?"

msgid "Did you wear the mask during the whole flight?"
msgstr "Haben Sie die Maske während des gesamten Fluges getragen?"

msgid "Different quarantine / isolation address?"
msgstr "Andere Quarantäne-/Isolationsadresse?"

Expand Down Expand Up @@ -1370,6 +1379,33 @@ msgctxt "Elixir.Hygeia.CaseContext.Transmission.InfectionPlace Field"
msgid "Flight Information"
msgstr "Fluginformationen"

msgctxt "Auto Tracing Problem"
msgid "Flight Related"
msgstr "Flugbezogen"

msgctxt "Auto Tracing Resolve Problems"
msgid "Flight date"
msgstr "Flugdatum"

msgctxt "Elixir.Hygeia.AutoTracingContext.AutoTracing.Flight Field"
msgid "Flight date"
msgstr "Flugdatum"

msgid "Flight information"
msgstr "Fluginformationen"

msgctxt "Auto Tracing Step"
msgid "Flight information"
msgstr "Fluginformationen"

msgctxt "Auto Tracing Resolve Problems"
msgid "Flight number"
msgstr "Flugnummer"

msgctxt "Elixir.Hygeia.AutoTracingContext.AutoTracing.Flight Field"
msgid "Flight number"
msgstr "Flugnummer"

msgid "Found no results"
msgstr "Keine Ergebnisse gefunden"

Expand Down Expand Up @@ -1399,6 +1435,10 @@ msgstr "Authorisierungen"
msgid "Gym"
msgstr "Fitnessstudio"

msgctxt "Elixir.Hygeia.AutoTracingContext.AutoTracing.Flight Field"
msgid "Had mask"
msgstr "Hatte Maske"

msgctxt "Elixir.Hygeia.CaseContext.PrematureRelease Field"
msgid "Has Documentation"
msgstr "Dokumentation vorhanden"
Expand All @@ -1410,6 +1450,10 @@ msgctxt "Elixir.Hygeia.CaseContext.Case.Clinical Field"
msgid "Has Symptoms"
msgstr "Hat Symptome"

msgctxt "Elixir.HygeiaWeb.AutoTracingLive.Flights Field"
msgid "Has flown"
msgstr "Ist geflogen"

msgid "Have you been or are you in a hospital?"
msgstr "Waren Sie in einem Krankenhaus oder sind es noch?"

Expand Down Expand Up @@ -3117,6 +3161,14 @@ msgstr "Cohort Screening"
msgid "Search"
msgstr "Suche"

msgctxt "Auto Tracing Resolve Problems"
msgid "Seat number"
msgstr "Sitznummer"

msgctxt "Elixir.Hygeia.AutoTracingContext.AutoTracing.Flight Field"
msgid "Seat number"
msgstr "Sitznummer"

msgctxt "School Type"
msgid "Secondary school"
msgstr "Sekundarschule"
Expand Down Expand Up @@ -3698,6 +3750,10 @@ msgstr "Diese Person ist möglicherweise ein Duplikat von %{name_link}, überpr
msgid "This person is possibly a duplicate of %{name_link}, please check."
msgstr "Diese Person ist möglicherweise ein Duplikat von %{name_link}, überprüfen Sie dies bitte."

msgctxt "Auto Tracing Resolve Problems"
msgid "This person took the following flights"
msgstr "Diese Person hat die folgenden Flüge genommen"

msgctxt "Auto Tracing Resolve Problems"
msgid "This person visited the following educational institutions in the 48 hours before the onset of symptoms or 48 hours before the test"
msgstr "Diese Person hat eine Bildungseinrichtung besucht in den letzten 48 Stunden bevor Symptombeginn oder vor dem Test"
Expand Down Expand Up @@ -4026,6 +4082,10 @@ msgstr "Wo arbeitet %{first_name} %{last_name}?"
msgid "Who did you meet or who do you live with?"
msgstr "Wen haben Sie getroffen oder mit wem wohnen Sie zusammen?"

msgctxt "Auto Tracing Resolve Problems"
msgid "Wore a mask during the whole flight?"
msgstr "Während des gesamten Fluges eine Maske getragen? "

msgid "Work Place"
msgstr "Arbeitsplatz"

Expand Down Expand Up @@ -4221,7 +4281,10 @@ msgid "people"
msgstr "Personen"

msgid "please add at least one educational institution that you visited during the period in consideration"
msgstr "Bitte geben Sie mindestens eine Bildungseinrichtung ein, welche Sie währen dem Zeitraum besucht haben."
msgstr "Bitte geben Sie mindestens eine Bildungseinrichtung ein, welche Sie während dem Zeitraum besucht haben."

msgid "please add at least one flight that you took during the period in consideration"
msgstr "Erfassen Sie mindestens einen Flug im relevanten Zeitraum."

msgid "please add at least one occupation"
msgstr "bitte fügen Sie mindestens eine Beschäftigung hinzu"
Expand Down