Class BasePatientObservation
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
-
JsonConverterBasePatientObservation
- Derived
- Inherited Members
-
JsonConverter.CanReadJsonConverter.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
ClinicalEpisode
public string? ClinicalEpisode { get; set; }
Property Value
Code
public string? Code { get; set; }
Property Value
CodingSystem
public string? CodingSystem { get; set; }
Property Value
CreateObservation
public List<ConfigObservation>? CreateObservation { get; set; }
Property Value
EndTime
public DateTime? EndTime { get; set; }
Property Value
Id
public ObjectId Id { get; set; }
Property Value
- ObjectId
Name
public string? Name { get; set; }
Property Value
ParentData
public ParentDataClass? ParentData { get; set; }
Property Value
Patient
public Patient? Patient { get; set; }
Property Value
PatientId
public ObjectId PatientId { get; set; }
Property Value
- ObjectId
SystemId
public string? SystemId { get; set; }
Property Value
Time
public DateTime Time { get; set; }
Property Value
Units
public string? Units { get; set; }
Property Value
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
objectTypeTypeThe type to evaluate for conversion support.
Returns
- bool
trueifobjectTypeis 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
readerJsonReaderThe reader used to parse the JSON content.
objectTypeTypeThe type of the object to deserialize.
existingValueobjectThe existing value of the object being deserialized.
serializerJsonSerializerThe 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 underlyingToString()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)