View Source Kindling.Schema.Resource (kindling v1.0.0)
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.
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.
@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.
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).
@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.
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.