Packages

Elixir client for Medplum's FHIR API with resource and workflow helpers.

Current section

Files

Jump to
medplum_elixir lib medplum resources organization.ex
Raw

lib/medplum/resources/organization.ex

defmodule Medplum.Resources.Organization do
@moduledoc """
Convenience helpers for the FHIR `Organization` resource.
## Examples
alias Medplum.Resources.Organization
{:ok, orgs} = Organization.search(client, %{"name" => "Acme Clinic"})
{:ok, org} = Organization.get(client, "org-123")
"""
alias Medplum.Client
alias Medplum.ResourceUpsert
@resource_type "Organization"
@spec get(Client.t(), String.t()) :: Medplum.result()
def get(%Client{} = client, id), do: Medplum.read(client, @resource_type, id)
@spec create(Client.t(), map()) :: Medplum.result()
def create(%Client{} = client, attrs), do: Medplum.create(client, @resource_type, attrs)
@spec upsert(Client.t(), map()) :: Medplum.result()
def upsert(%Client{} = client, attrs),
do: ResourceUpsert.upsert_from_first_identifier(client, @resource_type, attrs)
@spec upsert_by_identifier(Client.t(), String.t(), String.t(), map()) :: Medplum.result()
def upsert_by_identifier(%Client{} = client, system, value, attrs) do
ResourceUpsert.upsert_by_identifier(client, @resource_type, system, value, attrs)
end
@spec update(Client.t(), String.t(), map()) :: Medplum.result()
def update(%Client{} = client, id, attrs), do: Medplum.update(client, @resource_type, id, attrs)
@spec delete(Client.t(), String.t()) :: Medplum.result()
def delete(%Client{} = client, id), do: Medplum.delete(client, @resource_type, id)
@spec search(Client.t(), map()) :: Medplum.result()
def search(%Client{} = client, params \\ %{}),
do: Medplum.search(client, @resource_type, params)
end