Class ObservationController
- Namespace
- adas_core.Controllers
- Assembly
- adas-core.dll
[Route("observations")]
[ApiController]
public class ObservationController : ControllerBase
- Inheritance
-
ObservationController
- Inherited Members
- Extension Methods
Constructors
ObservationController(IObservationService, IPatientService)
public ObservationController(IObservationService observationService, IPatientService patientService)
Parameters
observationServiceIObservationServicepatientServiceIPatientService
Methods
ExpireAllExpired()
Expires all observations by invoking the observation service's expiration process.
[HttpPost("expired")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public IActionResult ExpireAllExpired()
Returns
- IActionResult
An IActionResult representing the HTTP 200 OK response indicating a successful expiration operation.
ForceNews(string, string)
Forcefully records a NEWS (National Early Warning Score) observation for a patient with a specified value.
[HttpPost("{patientId}/force-news/{value}")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> ForceNews(string patientid, string value)
Parameters
patientidstringThe unique identifier of the patient for whom the observation is being recorded.
valuestringThe NEWS score value to associate with the observation.
Returns
Exceptions
- BadRequestException
Thrown when the
patientidis not a valid ObjectId format or when thevalueis not a valid integer.
GetObservations(ObservationsRequest)
Retrieves observations for a patient within a specified time range, falling back to archived records when the patient is not found in the active set.
[HttpGet]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> GetObservations(ObservationsRequest request)
Parameters
requestObservationsRequestThe request payload containing the patient number, optional start and end times, and optional observation names to filter by.
Returns
- Task<IActionResult>
An IActionResult containing the observations found between the specified dates for the resolved patient.
Exceptions
- BadRequestException
Thrown when the request does not include a patient number.
- NotFoundException
Thrown when no patient matching the supplied patient number exists in either the active or archived records.
GetPaginatedObservations(PaginationFilter)
Retrieves a paginated list of observations based on the supplied pagination filter.
[HttpPost("paginated")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthSome)]
[PermissionAuthorize("Source", "DisplayId")]
public Task<IActionResult> GetPaginatedObservations(PaginationFilter request)
Parameters
requestPaginationFilterThe pagination filter containing the paging criteria sent in the request body.
Returns
- Task<IActionResult>
An IActionResult containing the paginated observations returned by the observation service.
Exceptions
- BadRequestException
Thrown when the
requestis null.
ProcessRequest(ApiRequest)
Processes an incoming API request, persisting it either synchronously or asynchronously based on the WaitResult flag. Requires the caller to have the AuthAdmin role.
[HttpPost]
[Route("apiRequest")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)]
public IActionResult ProcessRequest(ApiRequest apiRequest)
Parameters
apiRequestApiRequestThe API request payload received from the request body. When
WaitResultistrue, the request is saved synchronously; otherwise it is saved asynchronously.
Returns
- IActionResult
An IActionResult representing an HTTP 200 OK response.
ProcessRequest(ObservationDto)
Processes an incoming observation request by mapping the observation DTO to an API request and persisting it either synchronously or asynchronously based on the wait result flag.
[HttpPost]
[Route("")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)]
public IActionResult ProcessRequest(ObservationDto observationDto)
Parameters
observationDtoObservationDtoThe observation data transfer object containing the patient number, location, observation data, observations, message time, and wait result used to build the API request.
Returns
- IActionResult
An IActionResult representing an HTTP 204 No Content response after the request is handled.
ProcessRequestObsNurse(ObservationDto)
Processes nurse observations by constructing an API request and persisting it asynchronously.
[HttpPost]
[Route("NurseObservations")]
[AuthorizeRoles(PermissionEnum.RolesType.AuthAdmin)]
public IActionResult ProcessRequestObsNurse(ObservationDto observationDto)
Parameters
observationDtoObservationDtoThe observation data received in the request body, including patient, location, and measurement details.
Returns
- IActionResult
An IActionResult representing a 204 No Content response after the request is queued for saving.