Dicom.SR.ContextGroup (Dicom v0.9.1)

Copy Markdown View Source

CID validation for coded concepts.

Validates whether a Dicom.SR.Code is a member of a DICOM Context Group (CID). Non-extensible CIDs reject codes not in the defined set; extensible CIDs accept any code but signal it via {:ok, :extensible}.

Summary

Functions

Returns whether a context group is extensible.

Returns the name of a context group.

Returns the number of context groups in the registry.

Returns true if the code is valid for the given CID.

Validates a code against a context group.

Types

validation_result()

@type validation_result() ::
  :ok | {:ok, :extensible} | {:error, :not_in_cid} | {:error, :unknown_cid}

Functions

extensible?(cid)

@spec extensible?(non_neg_integer()) :: boolean() | :error

Returns whether a context group is extensible.

name(cid)

@spec name(non_neg_integer()) :: {:ok, String.t()} | :error

Returns the name of a context group.

size()

@spec size() :: non_neg_integer()

Returns the number of context groups in the registry.

valid?(code, cid)

@spec valid?(Dicom.SR.Code.t(), non_neg_integer()) :: boolean()

Returns true if the code is valid for the given CID.

A code is valid if it is a defined member or the CID is extensible.

validate(code, cid)

Validates a code against a context group.

Returns:

  • :ok — code is a defined member of the CID
  • {:ok, :extensible} — code is not in the CID but the CID is extensible
  • {:error, :not_in_cid} — code is not in a non-extensible CID
  • {:error, :unknown_cid} — CID does not exist in the registry