defmodule MedicalTranscription.Coding.CodeVector do | |
@moduledoc """ | |
Represents a code and its description, along with a vector embedding for its description. | |
""" | |
use Ecto.Schema | |
alias Ecto.Changeset | |
schema "code_vectors" do | |
field :code, :string | |
field :description, :string | |
field :description_vector, Pgvector.Ecto.Vector | |
timestamps() | |
end | |
def changeset(code_vector, params \\ %{}) do | |
code_vector | |
|> Changeset.cast(params, [:code, :description, :description_vector]) | |
|> Changeset.validate_required([:code, :description, :description_vector]) | |
end | |
end | |