timgremore commited on
Commit
cf5a59c
1 Parent(s): 5bbeb93

chore: Formatting

Browse files
lib/medical_transcription/transcription_supervisor.ex CHANGED
@@ -14,7 +14,8 @@ defmodule MedicalTranscription.TranscriptionSupervisor do
14
  def start_transcription(transcription) do
15
  spec = %{
16
  id: MedicalTranscription.TranscriptionServer,
17
- start: {MedicalTranscription.TranscriptionServer, :start_link, [transcription: transcription]},
 
18
  restart: :transient,
19
  type: :worker
20
  }
 
14
  def start_transcription(transcription) do
15
  spec = %{
16
  id: MedicalTranscription.TranscriptionServer,
17
+ start:
18
+ {MedicalTranscription.TranscriptionServer, :start_link, [transcription: transcription]},
19
  restart: :transient,
20
  type: :worker
21
  }
lib/medical_transcription/transcriptions.ex CHANGED
@@ -6,7 +6,11 @@ defmodule MedicalTranscription.Transcriptions do
6
  import Ecto.Query, warn: false
7
  alias MedicalTranscription.Repo
8
 
9
- alias MedicalTranscription.Transcriptions.{Transcription, TranscriptionChunk}
 
 
 
 
10
 
11
  @doc """
12
  Create transcription record and begin transcribing
 
6
  import Ecto.Query, warn: false
7
  alias MedicalTranscription.Repo
8
 
9
+ alias MedicalTranscription.Transcriptions.{
10
+ Transcription,
11
+ TranscriptionChunk,
12
+ TranscriptionChunkKeyword
13
+ }
14
 
15
  @doc """
16
  Create transcription record and begin transcribing
lib/medical_transcription/transcriptions/transcription.ex CHANGED
@@ -11,7 +11,9 @@ defmodule MedicalTranscription.Transcriptions.Transcription do
11
  schema "transcriptions" do
12
  field :filename, :string
13
  field :recording_length_in_seconds, :integer
14
- field :status, Ecto.Enum, values: [new: 0, waiting: 1, transcribing: 2, finished: 3, failed: 4]
 
 
15
 
16
  belongs_to :user, MedicalTranscription.Accounts.User
17
 
 
11
  schema "transcriptions" do
12
  field :filename, :string
13
  field :recording_length_in_seconds, :integer
14
+
15
+ field :status, Ecto.Enum,
16
+ values: [new: 0, waiting: 1, transcribing: 2, finished: 3, failed: 4]
17
 
18
  belongs_to :user, MedicalTranscription.Accounts.User
19
 
lib/medical_transcription_web/components/components.ex CHANGED
@@ -83,8 +83,18 @@ defmodule MedicalTranscriptionWeb.Components do
83
  ~H"""
84
  <div class="flex justify-between">
85
  <div class="flex items-center">
86
- <img :if={@transcription.status == :waiting} src={~p"/images/loading.svg"} width="36" class="mr-6 animate-spin" />
87
- <img :if={@transcription.status == :finished} src={~p"/images/checkmark.svg"} width="46" class="mr-[17px]" />
 
 
 
 
 
 
 
 
 
 
88
 
89
  <.record_button_in_heading status={@transcription.status} />
90
 
 
83
  ~H"""
84
  <div class="flex justify-between">
85
  <div class="flex items-center">
86
+ <img
87
+ :if={@transcription.status == :waiting}
88
+ src={~p"/images/loading.svg"}
89
+ width="36"
90
+ class="mr-6 animate-spin"
91
+ />
92
+ <img
93
+ :if={@transcription.status == :finished}
94
+ src={~p"/images/checkmark.svg"}
95
+ width="46"
96
+ class="mr-[17px]"
97
+ />
98
 
99
  <.record_button_in_heading status={@transcription.status} />
100
 
lib/medical_transcription_web/components/sidebar_component.ex CHANGED
@@ -30,7 +30,11 @@ defmodule MedicalTranscriptionWeb.Components.SidebarComponent do
30
  </.link>
31
  <p class="text-xs leading-normal tracking-[0.2em] font-semibold uppercase">Today</p>
32
  <div class="flex flex-col gap-4">
33
- <.link :for={transcription <- @transcriptions} navigate={~p"/transcriptions/#{transcription.id}"} class="font-semibold text-lg leading-normal">
 
 
 
 
34
  <%= transcription.filename %>
35
  </.link>
36
  </div>
 
30
  </.link>
31
  <p class="text-xs leading-normal tracking-[0.2em] font-semibold uppercase">Today</p>
32
  <div class="flex flex-col gap-4">
33
+ <.link
34
+ :for={transcription <- @transcriptions}
35
+ navigate={~p"/transcriptions/#{transcription.id}"}
36
+ class="font-semibold text-lg leading-normal"
37
+ >
38
  <%= transcription.filename %>
39
  </.link>
40
  </div>
lib/medical_transcription_web/components/transcription_text_component.ex CHANGED
@@ -42,7 +42,10 @@ defmodule MedicalTranscriptionWeb.Components.TranscriptionTextComponent do
42
  ~H"""
43
  <div id={@id} class="flex gap-12 pb-10 border-b border-[#444444]/20">
44
  <div class="flex-1 flex flex-col gap-4">
45
- <p :if={!is_nil(@start_mark) && !is_nil(@end_mark)} class="px-2 text-[32px] leading-normal font-semibold">
 
 
 
46
  <%= @start_mark %> - <%= @end_mark %>
47
  </p>
48
 
 
42
  ~H"""
43
  <div id={@id} class="flex gap-12 pb-10 border-b border-[#444444]/20">
44
  <div class="flex-1 flex flex-col gap-4">
45
+ <p
46
+ :if={!is_nil(@start_mark) && !is_nil(@end_mark)}
47
+ class="px-2 text-[32px] leading-normal font-semibold"
48
+ >
49
  <%= @start_mark %> - <%= @end_mark %>
50
  </p>
51
 
lib/medical_transcription_web/controllers/error_html/404.html.heex CHANGED
@@ -15,4 +15,3 @@
15
  <h1>Not Found</h1>
16
  </body>
17
  </html>
18
-
 
15
  <h1>Not Found</h1>
16
  </body>
17
  </html>
 
lib/medical_transcription_web/live/transcriptions_live/show.ex CHANGED
@@ -12,7 +12,7 @@ defmodule MedicalTranscriptionWeb.TranscriptionsLive.Show do
12
  def mount(params, session, socket) do
13
  transcription = get_transcription(params["id"])
14
 
15
- if is_nil(transcription), do: raise MedicalTranscription.Fallback
16
 
17
  if connected?(socket),
18
  do: Phoenix.PubSub.subscribe(:medicode_pubsub, "transcriptions:#{transcription.id}")
@@ -50,10 +50,7 @@ defmodule MedicalTranscriptionWeb.TranscriptionsLive.Show do
50
 
51
  <main class="flex-1 pl-16 pr-16 pt-[25px]">
52
  <div class="flex flex-col h-full mx-auto max-w-5xl">
53
- <.result_heading
54
- transcription={@transcription}
55
- summary_keywords={@summary_keywords}
56
- />
57
 
58
  <div id="result_list" class="flex flex flex-col gap-14" phx-update="stream">
59
  <.live_component
 
12
  def mount(params, session, socket) do
13
  transcription = get_transcription(params["id"])
14
 
15
+ if is_nil(transcription), do: raise(MedicalTranscription.Fallback)
16
 
17
  if connected?(socket),
18
  do: Phoenix.PubSub.subscribe(:medicode_pubsub, "transcriptions:#{transcription.id}")
 
50
 
51
  <main class="flex-1 pl-16 pr-16 pt-[25px]">
52
  <div class="flex flex-col h-full mx-auto max-w-5xl">
53
+ <.result_heading transcription={@transcription} summary_keywords={@summary_keywords} />
 
 
 
54
 
55
  <div id="result_list" class="flex flex flex-col gap-14" phx-update="stream">
56
  <.live_component
priv/repo/migrations/20240208193759_create_transcription_chunks.exs CHANGED
@@ -7,7 +7,10 @@ defmodule MedicalTranscription.Repo.Migrations.CreateTranscriptionChunks do
7
  add :text, :string
8
  add :start_mark, :string
9
  add :end_mark, :string
10
- add :transcription_id, references(:transcriptions, type: :binary_id, on_delete: :delete_all), null: false
 
 
 
11
 
12
  timestamps(type: :utc_datetime)
13
  end
 
7
  add :text, :string
8
  add :start_mark, :string
9
  add :end_mark, :string
10
+
11
+ add :transcription_id,
12
+ references(:transcriptions, type: :binary_id, on_delete: :delete_all),
13
+ null: false
14
 
15
  timestamps(type: :utc_datetime)
16
  end
test/medical_transcription_web/live/home_live_test.exs CHANGED
@@ -58,7 +58,7 @@ defmodule MedicalTranscriptionWeb.HomeLiveTest do
58
  |> limit(1)
59
  |> Repo.one()
60
 
61
- assert_redirected view, ~p"/transcriptions/#{transcription.id}"
62
  end
63
  end
64
  end
 
58
  |> limit(1)
59
  |> Repo.one()
60
 
61
+ assert_redirected(view, ~p"/transcriptions/#{transcription.id}")
62
  end
63
  end
64
  end
test/medical_transcription_web/live/transcriptions_live_show_test.exs CHANGED
@@ -2,7 +2,12 @@ defmodule MedicalTranscriptionWeb.TranscriptionsLive.ShowTest do
2
  use MedicalTranscriptionWeb.ConnCase, async: true
3
 
4
  import Phoenix.LiveViewTest
5
- import MedicalTranscription.{AccountsFixtures, TranscriptionsFixtures, TranscriptionChunksFixtures}
 
 
 
 
 
6
 
7
  setup %{conn: conn} do
8
  password = valid_user_password()
 
2
  use MedicalTranscriptionWeb.ConnCase, async: true
3
 
4
  import Phoenix.LiveViewTest
5
+
6
+ import MedicalTranscription.{
7
+ AccountsFixtures,
8
+ TranscriptionsFixtures,
9
+ TranscriptionChunksFixtures
10
+ }
11
 
12
  setup %{conn: conn} do
13
  password = valid_user_password()