Polymorphic Types
The Prima REST API has many resource sets that take advantage of polymorphism and inheritance to include extra data about some entities. Often, there is a base resource collection that includes data that is common to some entities as well as a typeName
field to indicate the actual type of the entity.
Example: Cases
As described in the Prima Model Structure page, every Prima case will be either a ClinicalCase
, HumanResearchCase
or VeterinaryResearchCase
. All of these cases have many data fields in common, which can be viewed and queried using the case endpoint.
Example Case Endpoint Response
{
"@odata.context": "https://localhost:5001/api/v1/$metadata#Case",
"value": [
{
"surgicalWheelId": 2,
"pathologistId": null,
"priorityLevelId": 1,
"residentPathologistId": null,
"differentialDiagnosisId": null,
"status": "InProcess",
"savedIdentifier": "S20-0002",
"surgeryDate": null,
"typeName": "VeterinaryResearchCase",
"id": 3
},
{
"surgicalWheelId": 2,
"pathologistId": null,
"priorityLevelId": 1,
"residentPathologistId": null,
"differentialDiagnosisId": null,
"status": "InProcess",
"savedIdentifier": "S20-0001",
"surgeryDate": null,
"typeName": "ClinicalCase",
"id": 1
},
{
"surgicalWheelId": 4,
"pathologistId": null,
"priorityLevelId": 1,
"residentPathologistId": null,
"differentialDiagnosisId": null,
"status": "InProcess",
"savedIdentifier": "AP20-0001",
"surgeryDate": null,
"typeName": "HumanResearchCase",
"id": 2
}
]
}
In this response we can see the typeName
field on each case. So, to get some VeterinaryResearchCase
specific information about the the item with 3
, we can use the VeterinaryResearchCase endpoint and see a response like:
{
"@odata.context": "https://localhost:5001/api/v1/$metadata#VeterinaryResearchCase",
"value": [
{
"animalId": 1,
"billingId": 1,
"studyId": null,
"cohortId": null,
"researcherId": null,
"studyPhaseId": null,
"surgicalWheelId": 2,
"pathologistId": null,
"priorityLevelId": 1,
"residentPathologistId": null,
"differentialDiagnosisId": null,
"status": "InProcess",
"savedIdentifier": "S20-0002",
"surgeryDate": null,
"typeName": "VeterinaryResearchCase",
"id": 3
}
]
}
This response now shows some VeterinaryResearchCase
-specific data such as the animalId
field.
Other examples
The same concept as the Case example also applies to many other entity endpoints such as Specimens
(SurgicalSpecimens
, FrozenSections
, CytoSpecimens
, HemoSpecimens
) Slides
, StainTestPanels
, etc.