View Source Kindling.Schema.Resource (kindling v1.0.2)

Functions for working on entries of the definitions section of the FHIR schema, which define the Resources available in FHIR.

Summary

Types

A string-keyed map that represents one resource in the definitions section of the FHIR schema.

An Ecto.Schema struct representing a FHIR Resource.

t()

A module representing a given FHIR resource, generated by mix kindling.generate_schemas.

Functions

Given the definition df return a list of all the properties which are "simple values", i.e. arrays, enum values, or base value types like integer or string.

Convert from a FHIR spec resource type name ("Encounter_patient") to the corresponding Elixir-style module name as a string ("Encounter.Patient").

Return true if the resource type name matches the convention for resource type names (i.e. they start with a capital letter).

Given the definition df and a list of root resource types, return a struct which contains all the properties of df, grouped by the type of field that should be used to represent them ( :array, :const, :embeds_one, :embeds_many, :has_one, :has_many, :enum, :value).

Return the property fields of a given definition map.

Convert from a definition reference in the FHIR spec (i.e. a string like "#/definitions/ResourceName") to the corresponding Elixir-style module name (i.e. ResourceName) as a string.

Return all properties of df that are references to other resource (i.e. are not simple value types).

Return a map of all properties (simple or reference) that are required under the FHIR spec.

Return true if key is required in the definition df, else return false.

Given the definition df return a list of all the properties which are "simple values", i.e. arrays, enum values, or base value types like integer or string AND are required by the FHIR spec.

Types

@type definition() :: map()

A string-keyed map that represents one resource in the definitions section of the FHIR schema.

Link to this type

grouped_properties_struct()

View Source
@type grouped_properties_struct() :: %Kindling.Schema.Resource{
  array: term(),
  const: term(),
  embeds_many: term(),
  embeds_one: term(),
  enum: term(),
  has_many: term(),
  has_one: term(),
  value: term()
}
@type schema() :: Ecto.Schema.t()

An Ecto.Schema struct representing a FHIR Resource.

@type t() :: atom()

A module representing a given FHIR resource, generated by mix kindling.generate_schemas.

Functions

@spec all_fields(definition()) :: [String.t()]

Given the definition df return a list of all the properties which are "simple values", i.e. arrays, enum values, or base value types like integer or string.

@spec class_name(String.t()) :: String.t()

Convert from a FHIR spec resource type name ("Encounter_patient") to the corresponding Elixir-style module name as a string ("Encounter.Patient").

@spec class_name?(binary()) :: boolean()

Return true if the resource type name matches the convention for resource type names (i.e. they start with a capital letter).

Link to this function

grouped_properties(df, roots)

View Source
@spec grouped_properties(definition(), [String.t()]) :: grouped_properties_struct()

Given the definition df and a list of root resource types, return a struct which contains all the properties of df, grouped by the type of field that should be used to represent them ( :array, :const, :embeds_one, :embeds_many, :has_one, :has_many, :enum, :value).

@spec properties(definition()) :: map()

Return the property fields of a given definition map.

@spec ref_to_class_name(String.t()) :: String.t()

Convert from a definition reference in the FHIR spec (i.e. a string like "#/definitions/ResourceName") to the corresponding Elixir-style module name (i.e. ResourceName) as a string.

@spec refs(definition()) :: MapSet.t()

Return all properties of df that are references to other resource (i.e. are not simple value types).

@spec required(definition()) :: map()

Return a map of all properties (simple or reference) that are required under the FHIR spec.

@spec required?(definition(), any()) :: boolean()

Return true if key is required in the definition df, else return false.

@spec required_fields(definition()) :: [String.t()]

Given the definition df return a list of all the properties which are "simple values", i.e. arrays, enum values, or base value types like integer or string AND are required by the FHIR spec.