noahsettersten commited on
Commit
b20fcc2
1 Parent(s): 65843fa

chore: Remove unused code for highlighting previous feedback responses

Browse files

Instead of highlighting feedback that was previously submitted for a
given text + code vector pair, the codes are now highlighted based on
whether the code was affected by weighting from previous feedback.

This code removed here is no longer used.

lib/medical_transcription/feedback.ex CHANGED
@@ -25,20 +25,6 @@ defmodule MedicalTranscription.Feedback do
25
  "Successfully #{action} code"
26
  end
27
 
28
- @doc """
29
- Retrieves previous feedback for a given text and code_vector pair.
30
- Used to show users which feedback was previously entered for codes on a portion of transcribed text.
31
- """
32
- def lookup_feedback_for_vector(text, code_vector_id) do
33
- query =
34
- from f in CodeFeedback,
35
- where: f.code_vector_id == ^code_vector_id and f.text == ^text,
36
- order_by: [desc: f.updated_at],
37
- limit: 1
38
-
39
- Repo.one(query)
40
- end
41
-
42
  @doc """
43
  Given a portion of transcribed text, finds the most-relevant previous feedback for that transcribed text.
44
 
 
25
  "Successfully #{action} code"
26
  end
27
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  @doc """
29
  Given a portion of transcribed text, finds the most-relevant previous feedback for that transcribed text.
30
 
lib/medical_transcription_web/components/transcription_text_component.ex CHANGED
@@ -22,7 +22,6 @@ defmodule MedicalTranscriptionWeb.Components.TranscriptionTextComponent do
22
  socket
23
  |> assign(:row, row)
24
  |> assign_async(:keywords, fn -> find_keywords(self_pid, row.text) end)
25
- |> assign(:feedbacks, lookup_feedback(row))
26
  end
27
 
28
  defp assign_for_row(_assigns, socket), do: socket
@@ -71,28 +70,6 @@ defmodule MedicalTranscriptionWeb.Components.TranscriptionTextComponent do
71
  """
72
  end
73
 
74
- # At the moment, this highlights a code result iff it's for the same pair of text + code_vector.
75
- # TODO: In the future, we may want this to instead highlight vectors that have been modified by the weighting in
76
- # `Coding.weight_code_vectors/2`.
77
- defp response_for_code_vector(feedbacks, code_vector_id) do
78
- feedback = Enum.find(feedbacks, &(&1.code_vector_id == code_vector_id))
79
-
80
- if feedback do
81
- Map.get(feedback, :response)
82
- else
83
- nil
84
- end
85
- end
86
-
87
- defp lookup_feedback(%{text: text, tags: tags}) do
88
- tags
89
- |> Enum.map(& &1.id)
90
- |> Enum.map(fn code_vector_id ->
91
- MedicalTranscription.Feedback.lookup_feedback_for_vector(text, code_vector_id)
92
- end)
93
- |> Enum.filter(& &1)
94
- end
95
-
96
  defp find_keywords(_live_view_pid, ""), do: {:ok, %{keywords: []}}
97
 
98
  defp find_keywords(live_view_pid, text) do
 
22
  socket
23
  |> assign(:row, row)
24
  |> assign_async(:keywords, fn -> find_keywords(self_pid, row.text) end)
 
25
  end
26
 
27
  defp assign_for_row(_assigns, socket), do: socket
 
70
  """
71
  end
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  defp find_keywords(_live_view_pid, ""), do: {:ok, %{keywords: []}}
74
 
75
  defp find_keywords(live_view_pid, text) do