timgremore commited on
Commit
22ed69b
1 Parent(s): 3cf8d48

feat: Display user who assigned custom code

Browse files
lib/medical_transcription/transcriptions.ex CHANGED
@@ -140,10 +140,11 @@ defmodule MedicalTranscription.Transcriptions do
140
 
141
  """
142
  def list_transcription_chunk_code_vectors(chunk_id) do
143
- CodeVector
144
- |> join(:inner, [cv], chunk_vector in assoc(cv, :transcription_chunk_code_vectors))
145
- |> where([cv, chunk_vector], chunk_vector.transcription_chunk_id == ^chunk_id)
146
- |> order_by([cv, chunk_vector], desc: chunk_vector.cosine_similarity)
 
147
  |> Repo.all()
148
  end
149
 
 
140
 
141
  """
142
  def list_transcription_chunk_code_vectors(chunk_id) do
143
+ TranscriptionChunkCodeVector
144
+ |> join(:inner, [chunk_vector], code_vector in assoc(chunk_vector, :code_vector))
145
+ |> where([chunk_vector], chunk_vector.transcription_chunk_id == ^chunk_id)
146
+ |> order_by([chunk_vector], desc: chunk_vector.cosine_similarity)
147
+ |> preload([:assigned_by_user, :code_vector])
148
  |> Repo.all()
149
  end
150
 
lib/medical_transcription_web/components/transcription_chunk_codings_component.ex CHANGED
@@ -6,6 +6,7 @@ defmodule MedicalTranscriptionWeb.Components.TranscriptionTextCodingsComponent d
6
  use MedicalTranscriptionWeb, :live_component
7
  use MedicalTranscriptionWeb, :verified_routes
8
 
 
9
  alias MedicalTranscription.Utilities
10
 
11
  @impl Phoenix.LiveComponent
@@ -13,7 +14,12 @@ defmodule MedicalTranscriptionWeb.Components.TranscriptionTextCodingsComponent d
13
  ~H"""
14
  <div id={"chunk-#{@chunk_id}-codings"}>
15
  <.tag_result
16
- :for={{code_vector, feedback} <- @code_vectors_with_feedback}
 
 
 
 
 
17
  chunk_id={@chunk_id}
18
  code_vector={code_vector}
19
  score={1.0}
@@ -22,6 +28,7 @@ defmodule MedicalTranscriptionWeb.Components.TranscriptionTextCodingsComponent d
22
  current_user={@current_user}
23
  myself={@myself}
24
  code_feedback={feedback}
 
25
  />
26
  </div>
27
  """
@@ -57,6 +64,9 @@ defmodule MedicalTranscriptionWeb.Components.TranscriptionTextCodingsComponent d
57
  >
58
  <p class="text-lg font-bold leading-[22.97px]"><%= @code_vector.code %></p>
59
  <p class="text-base leading-[20.42px]"><%= @code_vector.description %></p>
 
 
 
60
  </div>
61
  </div>
62
  """
 
6
  use MedicalTranscriptionWeb, :live_component
7
  use MedicalTranscriptionWeb, :verified_routes
8
 
9
+ alias MedicalTranscription.Transcriptions.TranscriptionChunkCodeVector
10
  alias MedicalTranscription.Utilities
11
 
12
  @impl Phoenix.LiveComponent
 
14
  ~H"""
15
  <div id={"chunk-#{@chunk_id}-codings"}>
16
  <.tag_result
17
+ :for={
18
+ {%TranscriptionChunkCodeVector{
19
+ code_vector: code_vector,
20
+ assigned_by_user: assigned_by_user
21
+ }, feedback} <- @code_vectors_with_feedback
22
+ }
23
  chunk_id={@chunk_id}
24
  code_vector={code_vector}
25
  score={1.0}
 
28
  current_user={@current_user}
29
  myself={@myself}
30
  code_feedback={feedback}
31
+ assigned_by_user={assigned_by_user}
32
  />
33
  </div>
34
  """
 
64
  >
65
  <p class="text-lg font-bold leading-[22.97px]"><%= @code_vector.code %></p>
66
  <p class="text-base leading-[20.42px]"><%= @code_vector.description %></p>
67
+ <p :if={!is_nil(@assigned_by_user)} class="text-xs text-base leading-[20.42px]">
68
+ Assigned by: <%= @assigned_by_user.email %>
69
+ </p>
70
  </div>
71
  </div>
72
  """