Object Types
Last updated
Last updated
Sub-classing objects
In your data modeling, you may find that you want to define an object class that inherits all properties from another. For example, you might have a generic c_assessment
class with properties like c_patient
and more specific classes like c_blood_test
that has all the properties of c_assessment
but also a set of more specific properties like c_blood_type
.
To create an object type, you simply add the object type definitions into the objectTypes
array of an object's definition. These types will inherit all the properties from the super-class (or super-type).
The properties that define an object type are as follows:
Once an object type is defined, the type
property becomes required when creating instances of the object. The type
property is populated with the name of the object type you are creating.
In this example, we've created the object class c_assessment
and set the proper ACL's. We've also added a property to this object that all of this object's types will share: c_patient
. This is because all assessments will be made on a particular patient, no matter what kind of assessment it is.
You'll notice that the objectTypes
value in the JSON result above is an empty array. We're going to add a c_blood_test
object type to this array.
Now, the objectTypes array contains the c_blood_test
definition we just created.
We can now create a c_assessment
object instance of type c_blood_test
:
The resulting instance of c_assessment
is of type: c_blood_test
and contains both the base property of c_patient
and the c_blood_test
type property c_blood_type
.Request
Name
Type
Description
name
String
The API name for the object type
label
String
The human readable label for the object type
properties
Property Definition Array
The array of property definitions for properties specific to this object type