defmodule MedicalTranscriptionWeb.Components do @moduledoc """ Functional UI components for the main transcription and coding view. """ use Phoenix.Component import MedicalTranscriptionWeb.CoreComponents alias MedicalTranscriptionWeb.Components.TranscriptionTextComponent use MedicalTranscriptionWeb, :verified_routes def upload_form(assigns) do ~H"""
<.live_file_input class="flex-1 cursor-pointer file:hidden file:font-secondary file:text-sm file:rounded-full file:px-4 file:py-2 file:border-0 file:bg-brand file:hover:bg-brand-active file:text-white" upload={@audio_upload} />

Audio file can be .mp3

""" end def loading_message(assigns) do ~H""" <%= if @visible do %>
<.icon name="hero-arrow-path" class="w-4 h-4 animate-spin" />

Transcribing and tagging audio file...

<% end %> """ end def result_heading(assigns) do if Enum.member?([:loading, :success], assigns.status) do ~H"""
<%= if @status == :loading do %> <% end %> <%= if @status == :success do %> <% end %>
<%= @filename %>
<%= Calendar.strftime(DateTime.now!("Etc/UTC"), "%a, %b %d, %Y, %I:%M %p") %>

Summary Keywords

<%= for keyword <- format_keywords(@summary_keywords) do %> <%= keyword.label %>, <% end %>

""" else ~H"" end end def format_keywords(keyword_predictions) do keyword_predictions |> List.flatten() |> Enum.sort_by(& &1.score, :desc) |> Enum.take(7) end def result_list(assigns) do ~H"""
<%= for {dom_id, row} <- @rows do %> <.live_component module={TranscriptionTextComponent} id={dom_id} row={row} /> <% end %>
""" end def tag_result(assigns) do ~H"""
<.feedback_button code={@code} text={@text} label={@label} response="true" /> <.feedback_button code={@code} text={@text} label={@label} response="false" class="" />

<%= @code %>

<%= @label %>

""" end defp feedback_button(assigns) do ~H""" """ end end