Abstract
Electronic health records(EHRs) capture longitudinal multi-visit patient journeys but are difficult to analyze due to temporal irregularity, multimorbidity, and heterogeneous coding. Thisstudy introduces a temporal and comorbidity-aware trajectory representation thatrestructures admissions into ordered symbolic visitstateswhile preserving diagnostic progression,secondary comorbidities, procedure categories, demographics, outcomes, and inter-visit intervals. These symbolic states are subsequently encoded as fixed-length numerical vectorssuitable for computational analysis. Validationwas conducted in two stages: Stage I assessed construction fidelity using coverage metrics, comorbidity preservation, diagnostic transition structures, and exact inter-visit gap encoding and Stage II assessed analytical utility through clustering experiments using different clustering approacheslike sequence similarity, Gaussian Mixture Models(GMM), and a temporal LSTM autoencoder(TS-LSTM). Proof of conceptwas done by encoding subset of patient cohortsfrom the MIMIC-IVdatabase consisting of 2,280 patientswith 8,849 admissions having complete primary diagnosis coverage and near-complete secondary coverage. Stage 1 assessment consisting of cohortlevel coverage metrics confirmed that the transformation preserved essential clinical information and key properties of longitudinal EHRs.In Stage 2, clustering experiments validated the analytical utility of the representation acrosssequence-based, Gaussian mixture, and temporal LSTM autoencoder approaches. Ablation studiesfurther demonstrated that both multimorbidity depth and inter-visit gap encoding are critical to maintaining clusterseparability and temporal fidelity. The findingsshowthat explicit encoding of comorbidity and timing improvesinterpretability and subgroup coherence.Although evaluated on a single dataset, the use ofstandardised ICD-10 EHR structure supportsthe assumption that the framework can generalise across healthcare settings; futureworkwill incorporate multimodal data and external validation.