# Class CacheKeyInspector

Namespace
  adas_core.Domain.Utils

Assembly
  adas-core.Domain.dll

Utilidad para extraer información estructurada útil para trazas. No usada por la lógica de caché, pero sí por logs y diagnósticos.

    public static class CacheKeyInspector

Inheritance
  object
  CacheKeyInspector

Inherited Members
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

## Methods

### ExtractAppointmentInfo(string)

Extracts appointment location and date information from the provided key by matching against a predefined appointment-day pattern. Returns a null location and null date if the key does not match the expected pattern, and returns the matched location with a null date if the date portion cannot be parsed using the `yyyyMMdd` format.

    public static (string? Location, DateTime? Date) ExtractAppointmentInfo(string key)

#### Parameters

`key` string

  The input string expected to contain a location and a date in `yyyyMMdd` format.

#### Returns

(string Location, DateTime? Date)

  A tuple containing the extracted `Location` string and the parsed `Date`; either value may be `null` when extraction or parsing fails.

### ExtractGroupedObservationInfo(string)

Extracts the observation field name and patient identifier from a grouped observation key using a regular expression pattern. Returns a tuple of `null` values when the key does not match the expected grouped format.

    public static (string? Field, string? PatientId) ExtractGroupedObservationInfo(string key)

#### Parameters

`key` string

  The grouped observation key to parse.

#### Returns

(string Field, string PatientId)

  A tuple containing the extracted field name and patient identifier, or `(null, null)` if the key does not match the pattern.

### ExtractPatientId(string)

Extracts the patient identifier from the given key using a regular expression pattern. Returns `null` if the key does not match the expected patient format.

    public static string? ExtractPatientId(string key)

#### Parameters

`key` string

  The input string from which to extract the patient identifier.

#### Returns

string

  The extracted patient identifier, or `null` if no match is found.