Skip to main content
Frontiers in Psychiatry logoLink to Frontiers in Psychiatry
. 2026 Sep 15;17:1952612. doi: 10.3389/fpsyt.2026.1952612

An interpretable computational phenotyping pipeline for adult autism using routine electronic health records

Jordi Rodeiro-Boliart 1,2,3,*, Maria Nuñez-Jimenez 4, Beatriz Olaya 1,5,6, Elena Huerta-Ramos 4,5, Elisabet Golobardes 2
PMCID: PMC13619622  PMID: 42812347

Abstract

Introduction

Electronic health records (EHRs) provide new opportunities for computational phenotyping in mental health, but routinely collected diagnostic data are often sparse, heterogeneous, and challenging to interpret. While numerous computational approaches have been applied to identify patient subgroups, clinically useful phenotyping requires workflows capable of transforming routine diagnostic information into interpretable patient profiles. The goal of this work is to develop and evaluate an end-to-end computational phenotyping pipeline for routine ICD-10 diagnostic data and demonstrate its feasibility in adults with autism spectrum disorder (ASD).

Methods

A retrospective observational study was conducted using routine EHR data from adults with ASD receiving care at a specialized mental health service. ICD-10 diagnoses were extracted, aggregated into clinically meaningful diagnostic categories, and transformed into binary patient-level representations. A self-organizing map (SOM) was used to organize patients according to diagnostic similarity, followed by hierarchical clustering to identify phenotype groups. Cluster solutions were evaluated using internal validity metrics, cluster size distributions, and interpretability. The resulting phenotypes were identified through diagnostic prevalence profiles and SOM-based visualizations.

Results

The study included 927 adults with ASD, of whom 744 presented at least one comorbid diagnostic category and were included in the computational phenotyping analysis. The proposed pipeline identified four phenotypes characterized by distinct patterns of psychiatric and developmental comorbidity. The SOM structure provided an interpretable visualization of the diagnostic landscape, while hierarchical clustering enabled the identification of coherent phenotype groups. Internal validation metrics supported the selected solution while preserving informative subgroup sizes.

Discussion

This study presents an end-to-end computational phenotyping pipeline that transforms routinely collected psychiatric EHR data into interpretable patient phenotypes. By integrating diagnostic extraction, clinically informed aggregation, representation learning, clustering, visualization, and characterization, the workflow provides a practical framework for analyzing complex diagnostic data in real-world mental health settings. Future studies should evaluate its applicability across other psychiatric and neurodevelopmental populations.

Keywords: autism spectrum disorder, clustering, computational phenotyping, electronic health records, explainable AI, mental health, self-organizing map

1. Introduction

The increasing availability of electronic health records (EHRs) has created new opportunities to characterize clinical heterogeneity using routinely collected healthcare data (1). In mental health, where patients frequently present with multiple co-occurring conditions, EHRs provide a valuable source of information on diagnostic patterns, disease burden, and healthcare trajectories. Computational phenotyping approaches seek to transform these routinely collected clinical data into structured patient profiles that facilitate the identification of clinically meaningful subgroups and sources of heterogeneity (2, 3).

Despite their potential, routine diagnostic records present important challenges for computational analysis. Diagnostic information based on the International Classification of Diseases (ICD) (4) was originally developed for clinical documentation, epidemiological reporting, and administrative purposes rather than machine learning applications. Consequently, diagnostic datasets are often sparse, high-dimensional, and characterized by heterogeneous levels of granularity (5, 6). Furthermore, similarities between patient profiles are not always adequately captured by the hierarchical structure of diagnostic classifications, complicating the identification of meaningful patterns within large patient populations.

To address these challenges, a variety of computational phenotyping approaches have been applied to EHR data. While important advances have been achieved using supervised approaches based on predefined distinctions, increasing attention has been directed toward unsupervised methods capable of identifying previously unrecognized multivariate patterns (7). These include hierarchical clustering, latent class methods, tensor factorization techniques, and natural language processing (NLP)-based phenotype discovery (2, 8). These methods have demonstrated the potential of EHRs for identifying clinically relevant patient subgroups and advancing precision medicine. However, many approaches primarily focus on subgroup identification while providing limited insight into how patient groups relate to one another or how the resulting phenotypes can be interpreted by clinicians. In psychiatric research, where clinical adoption depends heavily on transparency and interpretability, there remains a need for computational phenotyping frameworks capable of transforming routine diagnostic information into clinically understandable representations of patient heterogeneity (9, 10).

Such frameworks should not only identify groups of patients with similar clinical characteristics but also provide an interpretable structure of the underlying diagnostic landscape, as the lack of interpretability remains a barrier to the translation of computational methods into routine mental health practice (10, 11). Visualization of patient similarities may facilitate exploration of continuous patterns of heterogeneity, inspection of relationships between phenotypes, and communication of findings to clinical experts (12, 13). Consequently, there is a need for end-to-end workflows that integrate data preprocessing, patient representation, phenotype identification, visualization, and clinical interpretation within a single reproducible pipeline.

To address this need, we developed a computational phenotyping pipeline for routine psychiatric EHR data. The proposed workflow combines clinically informed aggregation of ICD-10 diagnoses, construction of patient-level diagnostic profiles, topology-preserving organization of patients using a Self-Organizing Map (SOM) (14), phenotype identification through clustering, visualization of diagnostic patterns, and expert clinical interpretation of the resulting phenotypes. Within this framework, the SOM acts as an interpretable representation-learning component that preserves relationships between similar patient profiles while supporting visualization and exploration of complex diagnostic structures (15). SOM-based approaches have previously demonstrated utility for the analysis and visualization of high-dimensional healthcare data, making them particularly suitable for exploratory phenotyping tasks (16).

Adult autism spectrum disorder (ASD) provides a relevant context in which to evaluate such an approach. Adults with ASD frequently present diverse combinations of psychiatric and neurodevelopmental comorbidities, resulting in substantial clinical heterogeneity. Autism research has increasingly emphasized the importance of complementing supervised analyses based on predefined distinctions with unsupervised approaches capable of uncovering previously unrecognized patterns within heterogeneous populations. A more refined understanding of this diversity may ultimately support precision-oriented research and more individualized clinical care (7, 17). Previous EHR-based studies have demonstrated the existence of distinct patterns of co-occurring conditions within autistic populations, highlighting both the complexity of these patients and the need for methods capable of generating clinically interpretable structures of this heterogeneity (18).

The objective of this study was to develop and evaluate an interpretable computational phenotyping pipeline capable of transforming routinely collected ICD-10 diagnostic information into clinically meaningful patient phenotypes. Using adults with ASD as a real-world use case, we assessed whether routine psychiatric EHR data could be organized into coherent and interpretable phenotypic representations through the integration of diagnostic preprocessing, representation learning, clustering, visualization, and expert clinical review.

The remainder of this article is organized as follows. First, we describe the study population and the computational phenotyping workflow, including diagnostic preprocessing, patient representation, and phenotype generation procedures. We then present the resulting phenotype structure and robustness analyses. Finally, we discuss the methodological implications, strengths, limitations, and potential applications of the proposed framework.

2. Methods

2.1. Study design and population

We conducted a retrospective observational study using EHR data from Parc Sanitari Sant Joan de Déu in Sant Boi de Llobregat, Barcelona (Spain). The study population included adults (≥18 years) with a clinician-assigned ASD diagnosis (ICD-10 F84.x) who attended the service between May 9, 2017 and July 10, 2025.

This study was conducted in accordance with the ethical principles of the Declaration of Helsinki and current data protection regulations (EU GDPR 2016/679). The research protocol titled “Leveraging Artificial Intelligence for Enhanced Screening and Diagnosis of Autism Spectrum Disorder in Adults through Medical Records Analysis” was reviewed and approved by the Comité de Ética de la Investigación con Medicamentos (CEIm) of Parc Sanitari Sant Joan de Déu (Barcelona, Spain), under approval code PIC-194-24. The study involved the retrospective analysis of fully anonymized hospital data; therefore, the requirement for informed consent was waived in accordance with institutional and national ethical guidelines. Data anonymization was ensured from the outset, with no identifiable or re-identifiable information present, complying with current data protection standards.

Because the analysis was based exclusively on the presence or absence of aggregated diagnostic categories, the anonymization process did not remove information required for phenotype generation or alter the structure of the diagnostic representations used in the study.

2.2. Computational phenotyping pipeline

The analysis consisted of five consecutive steps (1): Diagnostic data extraction and preprocessing, (2) Construction of patient-level diagnostic representations, (3) Topology-preserving organization of patients using a Self-Organizing Map (4) Identification of phenotype groups through hierarchical clustering, and (5) Visualization and characterization of the resulting phenotypes (6) Clinical review of phenotype plausibility and interpretation.

Analyses were conducted in Python 3.11. Data manipulation was performed using pandas (v2.3.3) and NumPy (v1.23.5). Visualizations were generated using Matplotlib (v3.10.7) and Seaborn (v0.13.2). Hierarchical clustering analyses were performed using SciPy (v1.15.3). Self-Organizing Maps were implemented using MiniSom (v2.3.6).

2.3. Diagnostic data extraction and preprocessing

Diagnostic information was extracted from routinely recorded ICD-10 diagnoses. Diagnoses from Chapter F and selected neurodevelopmentally relevant diagnoses from Chapters G and Q were included.

To reduce sparsity while preserving clinical meaning, diagnoses were aggregated according to the hierarchical organization of ICD-10. Specifically, diagnoses were grouped at the block level within chapters, preserving clinically recognized diagnostic entities while avoiding excessive fragmentation associated with individual ICD-10 codes. Broader chapter-level aggregation was considered insufficiently specific for meaningful clinical interpretation.

Diagnostic categories with a prevalence below 1.5% of the cohort were excluded during preprocessing. In the study sample (N = 927), this corresponded to fewer than 14 individuals. This filtering step was applied to reduce data sparsity and limit the influence of very low-frequency diagnostic categories on subsequent analyses (Supplementary Figure S1).

ASD diagnoses (F84.x) were used to identify the study population but were removed from the clustering variables to avoid defining groups based on the inclusion criterion.

2.4. Construction of patient-level diagnostic representations

For each patient, each diagnostic category was encoded as present (1) or absent (0), generating a binary patient-by-diagnosis matrix representing the presence of lifetime comorbidities during the study period. Repeated occurrences of the same diagnosis for a patient were counted only once.

Patients without any recorded comorbid diagnoses were excluded from the clustering procedure because their feature vectors contained no information for distinguishing between diagnostic profiles. These individuals were analyzed separately as a clinically relevant subgroup.

2.5. Self-Organizing map representation

A Self-Organizing Map (SOM) (14) was selected as the representation-learning component. The selection of SOM was motivated by both methodological and practical reasons, considering that the objective of this study was not only dimensionality reduction but also the generation of an interpretable structure that could be visualized, inspected by clinicians, and used as the basis for clustering. SOMs provide a topology-preserving projection of high-dimensional patient profiles into a two-dimensional space, unlike methods such as principal component analysis (PCA), which primarily summarize variance. Furthermore, SOMs generate an explicit grid-based representation whose prototypes can be directly inspected, visualized, and clustered. In contrast, methods such as t-SNE and UMAP are typically used to construct low-dimensional embeddings and do not inherently provide this additional topological structure.

The SOM was trained on the binary diagnostic matrix to organize patients according to similarities in their diagnostic profiles.

SOM hyperparameters were determined through sensitivity analysis evaluating the impact of training iterations, map size, learning rate, and random initialization on SOM performance and clustering robustness. Alternative configurations were compared using quantization error, topographic error, cluster stability, and profile reproducibility.

Based on these analysis a SOM consisting of a 20 × 20 hexagonal lattice with a Gaussian neighborhood function (σ = 2.0) and an initial learning rate of 0.5 was selected. Weights were initialized using randomly selected observations from the dataset. Training was performed in two consecutive stages of 10,000 iterations each using random sample selection. Euclidean distance was used during SOM training and identification of best-matching units (BMUs). Following training, each participant was assigned to its BMU within the resulting map.

SOM quality was evaluated using quantization error and topographic error, which assess representation accuracy and preservation of neighborhood relationships, respectively. Quantization error measures the average discrepancy between observations and their corresponding BMUs, whereas topographic error reflects the extent to which topological relationships are preserved within the reduced representation. To support interpretation of the diagnostic landscape, U-matrix visualizations and component-plane representations were generated. In addition, BMU density maps were inspected to evaluate participant distribution across the SOM space.

Because the diagnostic representation consisted of binary variables, additional sensitivity analysis were conducted to assess the impact of distance-metric selection on the resulting phenotypic structure. Alongside the Euclidean distance used in the primary analysis, Cosine, Manhattan, Chebyshev, Hamming, and Jaccard distances were evaluated. Solutions were compared using internal clustering validity metrics, phenotype-profile agreement, and patient-level agreement to determine whether the identified phenotypes were dependent on a specific distance formulation.

2.6. Identification of phenotype groups

Hierarchical agglomerative clustering was applied to SOM codebook vectors (neuron prototypes) rather than directly to individual patients. Clustering neuron prototypes allowed neighboring regions of the SOM with similar diagnostic profiles to be merged into larger and more interpretable phenotype groups.

Agglomerative clustering was performed using Ward linkage and Euclidean distance, as implemented in the clustering procedure. Each patient was subsequently assigned to the phenotype corresponding to the cluster membership of its BMU.

To identify an appropriate number of phenotypes, solutions were evaluated using multiple complementary criteria, including the silhouette coefficient, Dunn index, Calinski-Harabasz index, cluster-size distributions, and cluster balance ratio. Because different validity measures capture different aspects of clustering quality, no single metric was used as the sole selection criterion. Instead, final selection considered the combined evidence from internal validity metrics, preservation of clinically meaningful subgroup sizes, and avoidance of excessive fragmentation of the diagnostic landscape.

2.7. Internal validation and robustness assessment

Several analyses were conducted to evaluate the robustness of the proposed computational phenotyping workflow.

First, the influence of clustering methodology was assessed by comparing the SOM-based pipeline with hierarchical agglomerative clustering applied directly to the patient-level diagnostic matrix and with K-means clustering. Internal validity was evaluated using the silhouette coefficient, Dunn index, Calinski-Harabasz index, and cluster balance ratio. Agreement between resulting phenotypes was quantified through Hungarian matching of phenotype prevalence profiles and patient-level Adjusted Rand Index (ARI).

Second, sensitivity to distance-metric selection was evaluated by repeating the clustering procedure using Euclidean, Cosine, Manhattan, Chebyshev, Hamming, and Jaccard distances. Internal validity metrics, phenotype-profile agreement, and patient-level agreement were compared across solutions.

Third, bootstrap resampling was performed to evaluate phenotype reproducibility. For each bootstrap iteration, participants were resampled with replacement and the phenotype-generation workflow was repeated. Phenotype profiles were matched to the reference solution using Hungarian matching, and stability was quantified using mean, minimum, and maximum profile correlations.

These analyses complemented the SOM sensitivity analysis examining training iterations, grid size, learning rate, and random initialization.

2.8. Selection and characterization of phenotypes

Candidate phenotype solutions were evaluated using multiple internal validation metrics and cluster-structure characteristics. Specifically, silhouette coefficient, Dunn index, Calinski-Harabasz index, cluster-size distributions, and cluster balance ratio were examined across solutions ranging from K = 2 to K = 14.

Because different metrics favored different numbers of clusters, a compromise solution was selected. Preference was given to solutions maintaining clinically interpretable subgroup sizes while avoiding excessive fragmentation of the cohort. The final four-phenotype solution was retained because it provided meaningful differentiation of diagnostic profiles while preserving adequate subgroup sizes and maintaining an interpretable representation of the diagnostic landscape.

Phenotypes were characterized by calculating diagnostic-category prevalence within each group. SOM component-plane visualizations and phenotype-specific prevalence distributions were used to support interpretation of the resulting phenotypic profiles.

2.9. Clinical review of phenotype plausibility and interpretation

Following computational phenotype generation, the resulting diagnostic profiles, prevalence patterns, and SOM visualizations were independently reviewed by two clinicians from the adult autism unit, each with a minimum of five years of clinical experience treating autistic individuals. Reviewers independently evaluated the clinical plausibility and interpretability of the identified phenotypes based on the diagnostic prevalence profiles and SOM component-plane visualizations, and reached concordant conclusions regarding the plausibility and interpretability of the four phenotypes. The review was intended to assess clinical plausibility and interpretability of the resulting phenotype representations. It was not designed as a formal validation procedure and did not influence phenotype generation, clustering, or model selection.

3. Results

3.1. Cohort characteristics

A total of 927 adults with ASD from a real-world psychiatric EHR cohort were included in the study. Among them, 183 individuals (19.7%) had no recorded comorbid diagnosis beyond ASD and were therefore excluded from the computational phenotyping process. These individuals were retained as a separate descriptive subgroup.

The remaining 744 participants (80.3%) presented at least one comorbid diagnostic category and were included in the computational analysis. Number of diagnoses per participant are summarized in Table 1.

Table 1.

Distribution of participants according to the number of recorded diagnostic categories.

0 1 2 3 4 5 6 7 8 9 10
Original Diagnoses 177 232 195 109 109 66 20 10 5 3 1
Diagnoses Filtered 183 231 206 109 105 62 20 6 4 1 0

Autism spectrum disorder diagnoses used for cohort selection were excluded from the analysis. Diagnostic categories were aggregated according to ICD-10 block groupings and coded as present (1) or absent (0). Categories recorded in fewer than 1.5% of participants (n < 14) were excluded during preprocessing.

Diagnostic aggregation categories are presented in Supplementary Table S1. After diagnostic aggregation and frequency filtering, the final matrix included 11 diagnostic categories.

3.2. Diagnostic structure of the cohort

Supplementary Figure 1 presents the frequency distribution of all aggregated diagnostic categories. Table 2 reports only those categories meeting the inclusion criterion of at least 1.5% prevalence in the cohort (n ≥ 14). The most frequently observed categories were anxiety-related disorders (44.1%), mood disorders (27.6%), personality disorders (25.8%), developmental disorders (23.5%), intellectual disability (22.4%), and psychotic disorders (21.7%). Most participants presented multiple diagnostic categories, supporting the presence of substantial multimorbidity and the use of multivariate phenotyping approaches.

Table 2.

Prevalence of diagnostic categories included in the computational phenotyping analysis.

F10-19 F20-29 F30-39 F40-48 F50-59 F60-69 F70-79 F80-89 F90-98 F99 G40-47
N 109 201 256 409 33 239 208 26 218 98 106
% 11,8 21,7 27,6 44,1 3,6 25,8 22,4 2,8 23,5 10,6 11,4

3.3. Phenotype identification

Candidate solutions ranging from K = 2 to K = 14 were evaluated using multiple clustering-validity metrics and cluster-size characteristics. Different indices favored different clustering solutions (Figure 1A). Silhouette values increased progressively with larger numbers of clusters, whereas Calinski-Harabasz values favored more parsimonious solutions. Dunn index values stabilized after intermediate cluster numbers. Examination of cluster-size distributions showed progressive fragmentation of the cohort as the number of clusters increased, resulting in increasingly small subgroup sizes (Figure 1B).

Figure 1.

Two-panel data visualization with panel A on the left showing internal validation metrics versus number of clusters, including Silhouette, Dunn, Balance, and CH metrics, with a vertical dotted line at four clusters labeled “Selected”. Panel B on the right presents a scatter plot of cluster size versus number of clusters, indicating size distributions as the cluster count increases.

Cluster solution evaluation. (A) Internal validation metrics, (B) Cluster size distributions. The vertical dashed line indicated the selected four-phenotype solution.

Considering the combined evidence from internal validity metrics, cluster-size distributions, and interpretability of the resulting diagnostic structures, the four-phenotype solution was retained for subsequent analyses. Notably, all identified phenotypes contained more than 10% of the clustered cohort, whereas solutions with larger numbers of phenotypes increasingly generated small clusters with limited clinical relevance.

3.4. Internal validation and robustness

Comparison of the SOM-based workflow with conventional clustering approaches demonstrated similar clustering quality across methods (Figure 2A). Internal validation metrics showed only modest differences between SOM, hierarchical clustering, and K-means solutions. Phenotype-level agreement was high across methods (correlations 0.82-0.9), whereas patient-level agreement was lower (ARI 0.22-0.36; Figure 2B). These findings indicate that similar phenotypic structures emerged across alternative clustering approaches despite differences in individual patient assignments.

Figure 2.

Panel A shows a line graph comparing clustering methods SOM, Hierarchical, and KMeans using Silhouette, Dunn, Balance ratio, and Calinski-Harabasz scores. Panel B presents a heatmap indicating method agreement, with higher values near the diagonal, especially between KMeans and Hierarchical, and lower agreement between SOM and others.

Comparison of clustering methods. (A) Method comparison across clustering metrics, (B) Agreement matrix showing phenotype-profile correlations (upper triangle) and patient-level Adjusted Rand Index values (lower triangle). Note. Methods compared include the SOM-based workflow, hierarchical clustering, and K-means clustering.

Distance-metric sensitivity analysis produced broadly similar clustering structures across Euclidean, Cosine, Manhattan, Hamming, and Jaccard formulations (Supplementary Figure S2A). Internal validity metrics showed relatively small differences across most distance measures, whereas Chebyshev distance produced a more distinct solution. Agreement between phenotype prevalence profiles remained high across distance formulations (correlations 0.79-0.98), although patient-level agreement was more variable (ARI 0.13-0.57; Supplementary Figure S2B).

Bootstrap resampling demonstrated substantial phenotype-level reproducibility (Supplementary Figure S3). Mean phenotype-profile correlations remained consistently high across bootstrap iterations, while maximum profile correlations approached unity in most resamples. Greater variability was observed for minimum profile correlations, suggesting that some phenotypes were reproduced more consistently than others.

3.5. Phenotype characterization

The identified phenotypes displayed distinct combinations of psychiatric and developmental comorbidity rather than differences driven by a single diagnostic category (Figure 3).

Figure 3.

Heatmap illustrating the prevalence percentages of diagnostic categories across four phenotypes. Phenotype 1 is characterized by mood, anxiety/stress, personality-related, and behavioral syndromes; Phenotype 2 by developmental disorders and intellectual disability; Phenotype 3 by psychotic and substance-related disorders; and Phenotype 4 by anxiety/stress and personality-related disorders. Phenotypes 1 and 4 share high anxiety prevalence, but Phenotype 1 shows substantially greater mood disorder prevalence and overall psychiatric comorbidity.

Prevalence of diagnostic categories across computational phenotypes. Values represent the percentage of participants within each phenotype presenting a given diagnostic category.

Phenotype 1 (n=215; 28.9%) was characterized by elevated prevalence of mood, anxiety, and personality-related disorders. Phenotype 2 (n=260; 34.9%) was characterized by developmental conditions and intellectual disability. Phenotype 3 (n=107; 14.4%) showed increased prevalence of psychotic and substance-related disorders. Phenotype 4 (n=162; 21.8%) was characterized primarily by anxiety and personality-related conditions. Phenotypes 1 and 4 shared a similarly high prevalence of anxiety-related disorders (89.0% and 85.0%), but diverged sharply in mood disorder prevalence (93.0% vs. 1.0%), with Phenotype 1 also showing higher personality-related, psychotic, and substance-related comorbidity.

Visualization of SOM component planes (Supplementary Figure S4) and phenotype prevalence profiles demonstrated clear differences in the contribution of diagnostic categories across phenotypes.

Participant distribution across the SOM space was assessed using a BMU density map (Supplementary Figure S5).

Independent review by two clinicians with expertise in adult autism concluded that the identified phenotypes were clinically plausible and interpretable representations of the observed diagnostic heterogeneity.

3.6. Sensitivity analysis and solution robustness

Sensitivity analysis were performed to evaluate the robustness of SOM parameter selection and phenotype identification.

Quantization error progressively decreased as the number of training iterations increased, while topographic error rapidly converged towards low values, indicating stabilization of the SOM representation after approximately 10,000 training iterations for each of the two rounds (Supplementary Figure S6).

Increasing SOM grid size improved representation accuracy, reducing both quantization and topographic errors. However, improvements became progressively smaller beyond the selected 20×20 configuration, supporting its use as a compromise between representation fidelity and model complexity (Supplementary Figure S7).

Learning-rate sensitivity analysis showed that a learning rate of 0.5 yielded the lowest quantization error among the evaluated values (Supplementary Figure S8).

Across 50 random initializations, patient-level cluster assignments showed moderate stability (ARI range 0.10–0.53). Nevertheless, phenotype-level diagnostic profiles exhibited substantially greater reproducibility, with profile correlations typically ranging between 0.6 and 1.0 (Supplementary Figure S9). This suggests that variability was primarily driven by reassignment of boundary cases rather than instability of the underlying phenotype structure.

Stability varied across diagnostic domains. Mood disorders, anxiety-related disorders, intellectual disability, and unspecified psychiatric diagnoses demonstrated the highest reproducibility, whereas low-prevalence categories such as neurodevelopmental and paroxysmal disorders showed substantially greater variability across repeated model initializations (Supplementary Figure S10).

The final SOM demonstrated low quantization error (0.183) and topographic error (0.013), indicating accurate representation of patient diagnostic profiles and preservation of neighborhood relationships.

4. Discussion

This study developed and evaluated an interpretable computational phenotyping workflow for routinely collected psychiatric EHR data. The proposed pipeline integrates clinically informed preprocessing, representation learning, clustering, visualization, and expert review to transform ICD-10 diagnostic information into structured and clinically interpretable structure of patient heterogeneity. Although phenotype groups were identified within the study cohort, the primary objective was to evaluate whether routine diagnostic data could be organized into stable, transparent, and clinically reviewable structures suitable for exploratory phenotyping and future clinical interpretation.

Previous EHR phenotyping studies have employed a variety of approaches including hierarchical clustering, latent class methods, tensor factorization, NLP-driven phenotype extraction, and dimensionality-reduction techniques (2, 8). These approaches have demonstrated the value of EHRs for identifying clinically relevant patient subgroups but often provide limited insight into relationships between phenotypes or the structure of the underlying diagnostic landscape. In contrast, the present pipeline combines clustering with a topology-preserving representation that enables simultaneous phenotype identification and visual exploration of patient similarity patterns.

Previous work has demonstrated the feasibility of identifying ASD subgroups from routine EHR data, although differences in population, diagnostic scope, and methodology make direct comparisons challenging (18). In the present study, we focused on adults with ASD and employed a structured workflow based on clinically aggregated psychiatric and neurodevelopmental diagnoses to support phenotype identification and interpretation.

An additional contribution of the proposed approach is the use of SOMs to provide a structured representation of the diagnostic landscape. The SOM revealed gradual transitions between phenotype regions and facilitated visualization of diagnostic-category distributions through component-plane representations. This is particularly relevant in psychiatry, where patient heterogeneity frequently exists on continua rather than as clearly separated groups. The ability to inspect neighboring regions of the map may therefore provide information that would not be captured by cluster assignments alone. Although four phenotypes were identified in the present cohort, the clinical interpretation of these specific diagnostic patterns is secondary to the methodological contribution of the study, since the principal objective was to evaluate the feasibility and interpretability of the proposed workflow.

From a clinical perspective, the identified phenotypes should not be interpreted as definitive ASD subtypes. Instead, they represent clinically interpretable patterns of co-occurring conditions that may support future investigations into heterogeneity within autistic populations. Such representations could enable cohort stratification, hypothesis generation, characterization of service needs, and identification of patient groups with similar psychiatric profiles (1). Importantly, inclusion of expert clinical review as a final stage of the workflow was intended to ensure that computationally derived patterns remained interpretable and clinically plausible before being considered for research or service-planning applications (19). The robustness analysis suggest that the proposed approach performs more consistently for common diagnostic categories that contribute substantially to the overall diagnostic structure. In contrast, lower-prevalence conditions displayed greater variability across model initializations, indicating that larger datasets or complementary clinical information may be required when the objective is to characterize rare diagnostic profiles.

An important aspect of the proposed workflow is that the resulting representations were considered interpretable and clinically plausible by clinicians with expertise in adult autism. This assessment should be interpreted as an expert plausibility review rather than as a formal external validation procedure. Nevertheless, the review provides preliminary evidence that the identified phenotype structures are understandable from a clinical perspective and may be useful for exploratory investigation of patient heterogeneity and hypothesis generation.

Several limitations should be considered. First, the study was conducted in a single healthcare setting, limiting the ability to evaluate generalizability. Second, routine diagnostic information is influenced by documentation practices and may not fully capture the complete clinical history of an individual (1). Third, methodological decisions related to diagnostic aggregation, feature selection, and phenotype identification may influence the final representations. Finally, the present analysis relied exclusively on diagnostic information and did not incorporate symptom severity, treatment response, functional outcomes, or longitudinal trajectories.

Although demonstrated in autistic adults, the workflow was designed around characteristics frequently observed across psychiatric EHR data, including multimorbidity, diagnostic sparsity, and heterogeneous clinical presentations. Future studies should evaluate whether similar computational phenotyping strategies can be applied successfully to other psychiatric and neurodevelopmental populations and across different healthcare systems.

5. Conclusions

This study presents an end-to-end computational phenotyping pipeline for routinely collected psychiatric EHR data. The proposed workflow successfully transformed sparse and heterogeneous ICD-10 diagnostic information into stable and interpretable patient profiles, enabling visualization of the diagnostic landscape and identification of coherent phenotype groups. Application of the pipeline in a real-world cohort of adults with ASD demonstrated the feasibility of deriving meaningful phenotypic representations from routine clinical data.

Beyond phenotype identification, the results highlight the value of combining representation learning, clustering, and visualization within a single interpretable framework. The SOM-based approach facilitated exploration of relationships between patient profiles and supported clinical review of the resulting structures. Robustness analysis further suggested that the workflow performs more consistently for common diagnostic categories, whereas less prevalent diagnoses may require larger samples or additional sources of clinical information to achieve stable characterization. Importantly, the resulting representations were considered clinically plausible and useful for exploring patient heterogeneity by clinicians with expertise in adult autism, supporting the practical interpretability of the proposed workflow.

Future work should evaluate the reproducibility of the pipeline across different healthcare settings and independent patient cohorts, as well as its applicability to other psychiatric and neurodevelopmental populations. Additional studies should also explore the integration of complementary clinical information beyond diagnoses, including symptom severity, functional outcomes, treatment history, and longitudinal trajectories. Finally, further expert-led investigation of the identified patterns will be necessary to extend interpretation beyond computational similarity and assess their potential clinical relevance.

Acknowledgments

The authors would like to thank the Smart Society Research Group from La Salle–Universitat Ramon Llull, and the Impact and Prevention of Mental Disorders Group from Institut de Recerca Sant Joan de Déu (IRSJD) for their support and collaboration.

Funding Statement

The author(s) declared that financial support was received for this work and/or its publication. Jordi Rodeiro-Boliart is supported by the Secretariat of Universities and Research of the Generalitat de Catalunya and the European Social Fund (2024 FI-2 00864).

Footnotes

Edited by: Alexandre Hudon, University of Montreal, Canada

Reviewed by: Yuvaraj S, Sri Eshwar College of Engineering, India

Jayanti Dansana, KIIT University, India

Data availability statement

The datasets presented in this article are not readily available because the data supporting the findings of this study are not publicly available due to ethical, legal, and institutional restrictions related to the use of clinical EHRs. Requests for access to de-identified data may be considered by the authors upon reasonable request and subject to approval by the appropriate institutional, ethical, and legal review processes. Access cannot be guaranteed and will depend on compliance with applicable data protection regulations and institutional policies. Requests to access the datasets should be directed to jordi.rodeiro@sjd.es.

Ethics statement

The studies involving humans were approved by Comité de Ética de la Investigación con Medicamentos (CEIm) of Parc Sanitari Sant Joan de Déu (Barcelona, Spain). The studies were conducted in accordance with the local legislation and institutional requirements. The ethics committee/institutional review board waived the requirement of written informed consent for participation from the participants or the participants’ legal guardians/next of kin because the study involved the retrospective analysis of fully anonymized hospital data; therefore, the requirement for informed consent was waived in accordance with institutional and national ethical guidelines. Data anonymization was ensured from the outset, with no identifiable or re-identifiable information present, complying with current data protection standards.

Author contributions

JR-B: Visualization, Writing – original draft, Data curation, Methodology, Formal analysis, Investigation, Software, Writing – review & editing, Conceptualization. MN-J: Investigation, Writing – original draft. BO: Writing – review & editing, Methodology. EH-R: Methodology, Supervision, Conceptualization, Writing – review & editing. EG: Writing – review & editing, Supervision, Methodology, Conceptualization.

Conflict of interest

The author(s) declared that this work was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.

Generative AI statement

The author(s) declared that generative AI was used in the creation of this manuscript. The author(s) declared that generative AI was used in the creation of this manuscript. Generative AI was used to improve the language and readability of portions of the manuscript. As English is not the first language of the authors, AI-assisted tools were used for grammar correction, language refinement, and editorial support. The authors reviewed, edited, and approved all generated content and take full responsibility for the accuracy, integrity, and originality of the manuscript.

Any alternative text (alt text) provided alongside figures in this article has been generated by Frontiers with the support of artificial intelligence and reasonable efforts have been made to ensure accuracy, including review by the authors wherever possible. If you identify any issues, please contact us.

Publisher’s note

All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors and the reviewers. Any product that may be evaluated in this article, or claim that may be made by its manufacturer, is not guaranteed or endorsed by the publisher.

Supplementary material

The Supplementary Material for this article can be found online at: https://www.frontiersin.org/articles/10.3389/fpsyt.2026.1952612/full#supplementary-material

SupplementaryFile1.docx (1.3MB, docx)

References

  • 1. Smoller JW. The use of electronic health records for psychiatric phenotyping and genomics. Am J Med Genet B Neuropsychiatr Genet. (2017) 177:601. doi:  10.1002/AJMG.B.32548 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 2. Marquand AF, Wolfers T, Mennes M, Buitelaar J, Beckmann CF. Beyond lumping and splitting: A review of computational approaches for stratifying psychiatric disorders. Biol Psychiatry. (2016) 1:433. doi:  10.1016/J.BPSC.2016.04.002 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 3. Tarpey T, Petkova E, Zhu L. Stratified psychiatry via convexity-based clustering with applications towards moderator analysis. Stat Interface. (2016) 9:255. doi:  10.4310/SII.2016.V9.N3.A1 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 4. World Health Organization . The ICD-10 classification of mental and behavioural disorders: Diagnostic criteria for research. Geneva: World Health Organization; (1993). [Google Scholar]
  • 5. Si Y, Du J, Li Z, Jiang X, Miller T, Wang F, et al. Deep representation learning of patient data from electronic health records (EHR): A systematic review. J BioMed Inform. (2021) 115:103671. doi:  10.1016/J.JBI.2020.103671 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 6. Finch A, Crowell A, Bhatia M, Parameshwarappa P, Chang YC, Martinez J, et al. Exploiting hierarchy in medical concept embedding*. JAMIA Open. (2021) 4. doi:  10.1093/JAMIAOPEN/OOAB022 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 7. Lombardo MV, Lai MC, Baron-Cohen S. Big data approaches to decomposing heterogeneity across the autism spectrum. Mol Psychiatry. (2019) 24:1435. doi:  10.1038/S41380-018-0321-0 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 8. Zeng Z, Deng Y, Li X, Naumann T, Luo Y. Natural language processing for EHR-based computational phenotyping. IEEE/ACM Trans Comput Biol Bioinform. (2018) 16:139. doi:  10.1109/TCBB.2018.2849968 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 9. Sheu YH. Illuminating the black box: Interpreting deep neural network models for psychiatric research. Front Psychiatry. (2020) 11:551299. doi:  10.3389/FPSYT.2020.551299 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 10. Joyce DW, Kormilitzin A, Smith KA, Cipriani A. Explainable artificial intelligence for mental health through transparency and interpretability for understandability. NPJ Digit Med. (2023) 6:6. doi:  10.1038/S41746-023-00751-9 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 11. Ferrante M, Gordon JA. Computational phenotyping and longitudinal dynamics to inform clinical decision-making in psychiatry. Neuropsychopharmacology. (2020) 46:243. doi:  10.1038/S41386-020-00852-Z [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 12. Hurley NC, Haimovich AD, Taylor RA, Mortazavi BJ. Visualization of emergency department clinical data for interpretable patient phenotyping. Smart Health. (2022) 25:100285. doi:  10.1016/J.SMHL.2022.10028542574925 [DOI] [Google Scholar]
  • 13. Fang HSA, Tan NC, Tan WY, Oei RW, Lee ML, Hsu W. Patient similarity analytics for explainable clinical risk prediction. BMC Med Inform Decis Mak. (2021) 21:207. doi:  10.1186/S12911-021-01566-Y [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 14. Kohonen T. Self-organized formation of topologically correct feature maps. Biol Cybern. (1982) 43:59–69. doi:  10.1007/BF00337288 [DOI] [Google Scholar]
  • 15. Aljohani A. Optimizing patient stratification in healthcare: A comparative analysis of clustering algorithms for EHR data. Int J Comput Intell Syst 2024 17:1. (2024) 17:173. doi:  10.1007/S44196-024-00568-830311153 [DOI] [Google Scholar]
  • 16. Chushig-Muzo D, Soguero-Ruiz C, Engelbrecht AP, De Miguel Bohoyo P, Mora-Jimenez I. Data-driven visual characterization of patient health-status using electronic health records and self-organizing maps. IEEE Access. (2020) 8:137019–31. doi:  10.1109/ACCESS.2020.301208225079929 [DOI] [Google Scholar]
  • 17. Carroll HM, Thom RP, McDougle CJ. The differential diagnosis of autism spectrum disorder in adults. Expert Rev Neurother. (2025) 25:635–48. doi:  10.1080/14737175.2025.2490533 [DOI] [PubMed] [Google Scholar]
  • 18. Doshi-Velez F, Ge Y, Kohane I. Comorbidity clusters in autism spectrum disorders: An electronic health record time-series analysis. Pediatrics. (2014) 133:e54. doi:  10.1542/PEDS.2013-0819 [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 19. Fahim YA, Hasani IW, Kabba S, Ragab WM. Artificial intelligence in healthcare and medicine: Clinical applications, therapeutic advances, and future perspectives. Eur J Med Res. (2025) 30:848. doi:  10.1186/S40001-025-03196-W [DOI] [PMC free article] [PubMed] [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Supplementary Materials

SupplementaryFile1.docx (1.3MB, docx)

Data Availability Statement

The datasets presented in this article are not readily available because the data supporting the findings of this study are not publicly available due to ethical, legal, and institutional restrictions related to the use of clinical EHRs. Requests for access to de-identified data may be considered by the authors upon reasonable request and subject to approval by the appropriate institutional, ethical, and legal review processes. Access cannot be guaranteed and will depend on compliance with applicable data protection regulations and institutional policies. Requests to access the datasets should be directed to jordi.rodeiro@sjd.es.


Articles from Frontiers in Psychiatry are provided here courtesy of Frontiers Media SA

RESOURCES