Table of Contents

Class BasePatientObservation

Namespace
adas_core.Domain.Models
Assembly
adas-core.Domain.dll

Serves as a base class for JSON converters that handle patient observation data, providing shared conversion behavior derived from Newtonsoft.Json.JsonConverter.

public class BasePatientObservation : JsonConverter
Inheritance
JsonConverter
BasePatientObservation
Derived
Inherited Members
JsonConverter.CanRead
JsonConverter.CanWrite
Extension Methods

Remarks

This type is intended to be subclassed by concrete converters that implement specific serialization and deserialization logic for patient observation types.

Properties

CheckObservations

public bool CheckObservations { get; set; }

Property Value

bool

ClinicalEpisode

public string? ClinicalEpisode { get; set; }

Property Value

string

Code

public string? Code { get; set; }

Property Value

string

CodingSystem

public string? CodingSystem { get; set; }

Property Value

string

CreateObservation

public List<ConfigObservation>? CreateObservation { get; set; }

Property Value

List<ConfigObservation>

EndTime

public DateTime? EndTime { get; set; }

Property Value

DateTime?

Id

public ObjectId Id { get; set; }

Property Value

ObjectId

Name

public string? Name { get; set; }

Property Value

string

ParentData

public ParentDataClass? ParentData { get; set; }

Property Value

ParentDataClass

Patient

public Patient? Patient { get; set; }

Property Value

Patient

PatientId

public ObjectId PatientId { get; set; }

Property Value

ObjectId

SystemId

public string? SystemId { get; set; }

Property Value

string

Time

public DateTime Time { get; set; }

Property Value

DateTime

Units

public string? Units { get; set; }

Property Value

string

UserId

public ObjectId? UserId { get; set; }

Property Value

ObjectId?

Methods

CanConvert(Type)

Determines whether the converter can handle the specified type by checking if it matches BasePatientObservation.

public override bool CanConvert(Type objectType)

Parameters

objectType Type

The type to evaluate for conversion support.

Returns

bool

true if objectType is BasePatientObservation; otherwise, false.

ReadJson(JsonReader, Type, object?, JsonSerializer)

Reads the JSON representation of an object. The current implementation is not provided and will always throw a NotImplementedException.

public override object ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)

Parameters

reader JsonReader

The reader used to parse the JSON content.

objectType Type

The type of the object to deserialize.

existingValue object

The existing value of the object being deserialized.

serializer JsonSerializer

The serializer instance performing the deserialization.

Returns

object

An object instance built from the JSON data.

Exceptions

NotImplementedException

Always thrown because the method has not been implemented.

ToJsonString()

Serializes the current object to a JSON string representation. Falls back to the base ToString() implementation if JSON serialization fails.

public string? ToJsonString()

Returns

string

A JSON-formatted string of the object, or the result of base.ToString() if serialization throws an exception; may be null only if the underlying ToString() returns null.

ToListString()

Converts the current object's properties into a list of formatted key-value strings, including core identifiers and timestamp, and conditionally appending optional fields only when they contain values.

public List<string> ToListString()

Returns

List<string>

A list of strings where each entry is formatted as "key: value" representing the object's properties.

ToString()

Returns a string representation of the patient observation, including its identifier, patient identifier, timestamp, and conditionally included optional fields (such as system identifier, code, coding system, end time, name, and units) when they have values. Any child creation observations are also appended to the output.

public override string ToString()

Returns

string

A formatted string that lists the patient observation properties prefixed with BasePatientObservation[ and suffixed with ].

WriteJson(JsonWriter, object?, JsonSerializer)

Serializes the specified object to JSON, excluding the Id and Patient properties from the output. If the value is null, the method returns without writing anything.

public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)

Parameters

writer JsonWriter

The Newtonsoft.Json.JsonWriter to which the filtered JSON will be written.

value object

The object to serialize. If null, nothing is written.

serializer JsonSerializer

The Newtonsoft.Json.JsonSerializer used during the conversion process.