Standard Modelling of Resource Relationship Types

NOTE: A consequence of this is that collections may be directly created but not edited
NOTE: All subresources can be created along with resources in flat style

Example: Concept : ConceptName

Model: Parent is a resource; Child is a sub-resource of Parent

  • Parent contains an uneditable collection of children

  • Child contains an uneditable reference to parent

  • Creates are POSTs to Parent/<parent uuid>/Child

  • Updates are POSTs to Parent/<parent uuid>/Child/<child uuid>

Example: Location

Model: Object is a resource

  • Object contains an uneditable collection of children

  • Object contains an editable reference to parent uuid.

  • Hierarchical relation is created/updated with POST to object setting parent uuid (validate an object not self)

  • Hierarchical relation is deleted with POST to object setting parent to null

Example: Patient : PatientAttribute : PatientAttributeType

Model: Primary is a resource; Mapping is a sub-resource of Primary; Secondary is a resource

  • Parent contains a createable, uneditable collection of mappings

  • Mapping contains an uneditable reference to primary

  • Mapping contains a creatable, potentially editable reference to secondary (whether relationships can be updated is an open question)

  • Secondary does not contain a reference to primary or mapping

  • Primary resource has a special query whose parameter is a secondary uuid which returns all primaries related to the secondary; this query is identified by the name of the secondary (as there may be several such relationships)

  • Mapping subresource has a special query whose parameter is a secondary uuid which returns all mappings related to the secondary

  • Relationships are created by creating a mapping subresource with the proper secondary reference

  • Relationships are deleted by deleting the mapping

  • Mapping data is editable
    NOTE: There can only be one collection of mappings or counterparty objects because of caching issues.

Example: Concept : ConceptSet : Concept

Model: Object is a resource; Mapping is a sub-resource of Object

  • Object as primary contains a createable, uneditable collection of child mappings

  • Mapping contains a uneditable reference to object as primary

  • Mapping contains a createable, potentially editable reference to object as secondary (whether relationships can be updated is an open question)

  • Object does not contain a reference to object as primary or mapping

  • Primary resource has a special query whose parameter is a secondary uuid which returns all primaries related to the secondary; this query is identified by the name of the secondary (as there may be several such relationships)

  • Mapping subresource has a special query whose parameter is a secondary uuid which returns all mappings related to the secondary

  • Relationships are created by creating a mapping subresource with the proper object as secondary reference

  • Whether relationships can be edited or merely create and deleted is an open question

  • Relationships are deleted by deleting the mapping

  • Mapping data is editable
    NOTE: There can only be one collection of mappings or counterparty objects because of caching issues.

Example: Location : LocationTagMap : LocationTag

Model: Primary is a resource; Mapping is a sub-resource of Primary; Secondary is a resource

  • Primary contains a createable, uneditable collection of secondaries

  • Mapping contains an uneditable reference to primary

  • Mapping contains a creatable, non-editable reference to secondary

  • Secondary does not contain a reference to primary or mapping

  • Primary resource has a special query whose parameter is a secondary uuid which returns all primaries related to the secondary; this query is identified by the name of the secondary (as there may be several such relationships)

  • Relationships are created by creating a mapping subresource with the proper secondary reference

  • Relationships are deleted by deleting the mapping
    NOTE: The direction in which the relationship is broken is arbitrary, but there can only be one collection of counterparty objects because of caching issues.