History of veteran_comorbidity
The changes to the source code of this entry in the repository, newest first, each with the differences it made to the entry's files. They are also listed on GitLab.
[entries] Remove superfluous details of the upstream distribution from the descriptions dc07aa0
The descriptions mentioned incidental details of how the upstream data are made available: the file formats (CSV, JSON, XML, GEXF, SBML, HIF, Pajek, UCINET, ...), file names, where the files were published or obtained from (Zenodo, figshare, Kaggle, the Pajek datasets page, the Internet Archive), and that some networks are only available in the gt format. These are left out; caveats about the data themselves are kept, referring to "the data" instead of "the file". The description of sp_baboons now lists its properties instead of the upstream columns, and says that events without a recipient are left out.
diff --git a/entries/veteran_comorbidity/__init__.py b/entries/veteran_comorbidity/__init__.py
index 7b643e8..fcbe06d 100644
--- a/entries/veteran_comorbidity/__init__.py
+++ b/entries/veteran_comorbidity/__init__.py
@@ -22,7 +22,7 @@ from .. import *
title = "Co-morbidity network of US military veterans (2001-2017)"
description = """A dense, directed and weighted network of co-morbidity among 95 physical and mental health conditions, derived from the longitudinal health records of approximately one million United States military veterans. The records come from the VA (Department of Veterans Affairs) National Corporate Data Warehouse, which holds the coded diagnoses of all VA inpatient and outpatient encounters, for veterans who served in the Operation Enduring Freedom, Operation Iraqi Freedom or Operation New Dawn (OEF/OIF/OND), enrolled in VA healthcare after 1 October 2001, and had at least one VA primary care visit before the end of the study period, on 1 October 2017. The conditions are diagnostic categories with a prevalence of at least 0.1%: categories of the AHRQ (Agency for Healthcare Research and Quality) Clinical Classifications Software, psychiatric diagnoses as categorized by the VA's Northeast Program Evaluation Center (NEPEC: alcohol use disorder, drug use disorder, schizophrenia, major depressive disorder, bipolar disorder, PTSD, other depression, unspecified and generalized anxiety), and diabetes, neoplasms, congenital anomalies and genital disorders. For each ordered pair of conditions, the association was estimated with a logistic regression of the odds of one condition given the other.
-Nodes are conditions, and a directed edge from condition j to condition i carries the increase in the log odds of condition i given condition j (the logistic regression coefficient; negative values indicate a decreased odds), so that the out-edges of a node describe the conditions that it predicts. All 95 x 94 ordered pairs are present, and the network is complete. This edge direction follows the authors' sample code (which builds the network from the transpose of the matrix of log odds, whose rows are the predicted conditions). The upstream repository also includes matrices for the interaction effect of sex and its p-values, but in the available files these contain only zeros, and they are not included.
+Nodes are conditions, and a directed edge from condition j to condition i carries the increase in the log odds of condition i given condition j (the logistic regression coefficient; negative values indicate a decreased odds), so that the out-edges of a node describe the conditions that it predicts. All 95 x 94 ordered pairs are present, and the network is complete. This edge direction follows the authors' sample code (which builds the network from the transpose of the matrix of log odds, whose rows are the predicted conditions). The upstream data also include matrices for the interaction effect of sex and its p-values, but these contain only zeros, and they are not included.
Node properties: `name`, the variable name of the condition in the source (with prefix "AHRQ_" for the AHRQ categories and "NEPEC_" for the NEPEC psychiatric categories; e.g. "AHRQ_Asthma_DT", "NEPEC_PTSD_DT", "dmdxDT" for diabetes); `short_name`, the abbreviated label used in the authors' sample code; `psychiatric`, whether the condition is psychiatric, as marked in the authors' sample code. Edge properties: `log_odds`, the increase in log odds described above; `pvalue`, its p-value from the logistic regression (values below the floating point precision are reported as 0)."""
tags = ['Biological', 'Public Health', 'Weighted', 'Metadata']
[entries] Add the date when each entry was added, and remove icon_hash beff7c9
The dates are those of the commits that first added the entries' files (2020-08-11 for the entries of the initial commit); renamed entries keep the date of their first name. Changed: none
diff --git a/entries/veteran_comorbidity/__init__.py b/entries/veteran_comorbidity/__init__.py
index 2af4cd0..7b643e8 100644
--- a/entries/veteran_comorbidity/__init__.py
+++ b/entries/veteran_comorbidity/__init__.py
@@ -28,7 +28,7 @@ Node properties: `name`, the variable name of the condition in the source (with
tags = ['Biological', 'Public Health', 'Weighted', 'Metadata']
url = 'https://github.com/aaronab/comorbidity_networks'
citation = [('A. F. Alexander-Bloch, A. Raznahan, R. T. Shinohara, S. R. Mathias, H. Bathulapalli, I. P. Bhalla, J. L. Goulet, T. D. Satterthwaite, D. S. Bassett, D. C. Glahn, C. A. Brandt, "The architecture of co-morbidity networks of physical and mental health conditions in military veterans." Proceedings of the Royal Society A 476(2239), 20190790 (2020)', 'https://doi.org/10.1098/rspa.2019.0790')]
-icon_hash = '5f01392028ef47780245b314'
+date_added = '2026-10-25'
upstream_license = None
upstream_prefix = 'https://raw.githubusercontent.com/aaronab/comorbidity_networks/ef1d58cf0a5b62c590c71cc44475f046c8ae65a8'
files = [(('comorbidity_odds_matrix.csv', 'comorbidity_pmat_matrix.csv'), None,
[entries] Remove unneeded code from the entries 2c69f19
Unneeded "global files" statements, unused imports and variables, f-strings without placeholders, duplicate keys in foodweb_little_rock (keeping the order and the values used), and the second definition of get_lines() in twitter_higgs. Nothing changes in the networks or descriptions. Changed: none
diff --git a/entries/veteran_comorbidity/__init__.py b/entries/veteran_comorbidity/__init__.py
index f0d8e65..2af4cd0 100644
--- a/entries/veteran_comorbidity/__init__.py
+++ b/entries/veteran_comorbidity/__init__.py
@@ -67,7 +67,6 @@ def read_matrix(f):
@coerce_props()
@annotate()
def parse(alts=None):
- global files
name = __name__.split(".")[-1]
for fnames, alt, fmt in files:
if alts is not None and alt not in alts:
[entries] New entry: veteran_comorbidity b243415
diff --git a/entries/veteran_comorbidity/__init__.py b/entries/veteran_comorbidity/__init__.py
new file mode 100644
index 0000000..f0d8e65
--- /dev/null
+++ b/entries/veteran_comorbidity/__init__.py
@@ -0,0 +1,97 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2020-2026 Tiago de Paula Peixoto <tiago@skewed.de>
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import csv
+from .. import *
+
+title = "Co-morbidity network of US military veterans (2001-2017)"
+description = """A dense, directed and weighted network of co-morbidity among 95 physical and mental health conditions, derived from the longitudinal health records of approximately one million United States military veterans. The records come from the VA (Department of Veterans Affairs) National Corporate Data Warehouse, which holds the coded diagnoses of all VA inpatient and outpatient encounters, for veterans who served in the Operation Enduring Freedom, Operation Iraqi Freedom or Operation New Dawn (OEF/OIF/OND), enrolled in VA healthcare after 1 October 2001, and had at least one VA primary care visit before the end of the study period, on 1 October 2017. The conditions are diagnostic categories with a prevalence of at least 0.1%: categories of the AHRQ (Agency for Healthcare Research and Quality) Clinical Classifications Software, psychiatric diagnoses as categorized by the VA's Northeast Program Evaluation Center (NEPEC: alcohol use disorder, drug use disorder, schizophrenia, major depressive disorder, bipolar disorder, PTSD, other depression, unspecified and generalized anxiety), and diabetes, neoplasms, congenital anomalies and genital disorders. For each ordered pair of conditions, the association was estimated with a logistic regression of the odds of one condition given the other.
+
+Nodes are conditions, and a directed edge from condition j to condition i carries the increase in the log odds of condition i given condition j (the logistic regression coefficient; negative values indicate a decreased odds), so that the out-edges of a node describe the conditions that it predicts. All 95 x 94 ordered pairs are present, and the network is complete. This edge direction follows the authors' sample code (which builds the network from the transpose of the matrix of log odds, whose rows are the predicted conditions). The upstream repository also includes matrices for the interaction effect of sex and its p-values, but in the available files these contain only zeros, and they are not included.
+
+Node properties: `name`, the variable name of the condition in the source (with prefix "AHRQ_" for the AHRQ categories and "NEPEC_" for the NEPEC psychiatric categories; e.g. "AHRQ_Asthma_DT", "NEPEC_PTSD_DT", "dmdxDT" for diabetes); `short_name`, the abbreviated label used in the authors' sample code; `psychiatric`, whether the condition is psychiatric, as marked in the authors' sample code. Edge properties: `log_odds`, the increase in log odds described above; `pvalue`, its p-value from the logistic regression (values below the floating point precision are reported as 0)."""
+tags = ['Biological', 'Public Health', 'Weighted', 'Metadata']
+url = 'https://github.com/aaronab/comorbidity_networks'
+citation = [('A. F. Alexander-Bloch, A. Raznahan, R. T. Shinohara, S. R. Mathias, H. Bathulapalli, I. P. Bhalla, J. L. Goulet, T. D. Satterthwaite, D. S. Bassett, D. C. Glahn, C. A. Brandt, "The architecture of co-morbidity networks of physical and mental health conditions in military veterans." Proceedings of the Royal Society A 476(2239), 20190790 (2020)', 'https://doi.org/10.1098/rspa.2019.0790')]
+icon_hash = '5f01392028ef47780245b314'
+upstream_license = None
+upstream_prefix = 'https://raw.githubusercontent.com/aaronab/comorbidity_networks/ef1d58cf0a5b62c590c71cc44475f046c8ae65a8'
+files = [(('comorbidity_odds_matrix.csv', 'comorbidity_pmat_matrix.csv'), None,
+ None)]
+
+# Short labels of the conditions, in the order of the matrices, and the
+# (1-based) indices of the psychiatric conditions, from the authors'
+# sample_code.R
+short_names = ["Her","Def","Adj","Ane","Ast","ADHD","Bac","Bil","Bur",
+ "NIn","CVD","COPD","Ulc","Coag","Coma","CIj",
+ "Dem","Dev","Art","Mou","Hea","Uri","Vei","WBC",
+ "Lip","Jaw","Ch","Ear","Ep","Eye","Ele",
+ "Fr","GIH","Gou","HA","NSC","HTN","Imm","Imp",
+ "ArI","IIn","BIj","TJ","Liv","LGI","Myc",
+ "NTJ","Gas","Nut","Wou","Ost","Bone","Con","End",
+ "GIO","HeO","InO","SInf","IjO","LRO","NSO",
+ "NuO","SkO","URO","Pan","Par","PFr","Per","Ple",
+ "Poi","RF","RIn","SIn","Spi","Bac","Spr","Sui",
+ "SuIj","Lup","Thy","UGI","Vir","Alc","Drg","Sch","MDD",
+ "BPD","PTSD","DepO","AnxO","GAD","DM","Neo","Con","Gen"]
+psychiatric = [3, 6, 17, 18, 27, 39, 68, 77, 83, 84, 85, 86, 87, 88, 89, 90, 91]
+
+def fetch_upstream(force=False):
+ return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+ force)
+
+def read_matrix(f):
+ rows = list(csv.reader(f))
+ header = rows[0][1:]
+ names = [r[0] for r in rows[1:]]
+ assert names == header
+ A = numpy.array([[float(x) for x in r[1:]] for r in rows[1:]])
+ return names, A
+
+@cache_network()
+@coerce_props()
+@annotate()
+def parse(alts=None):
+ global files
+ name = __name__.split(".")[-1]
+ for fnames, alt, fmt in files:
+ if alts is not None and alt not in alts:
+ continue
+ with ExitStack() as stack:
+ fo, fp = [stack.enter_context(open_upstream_file(name, fn, "r"))
+ for fn in fnames]
+ names, O = read_matrix(fo)
+ pnames, P = read_matrix(fp)
+ assert names == pnames and len(names) == len(short_names)
+
+ N = len(names)
+ g = Graph(N, directed=True)
+ g.vp.name = g.new_vp("string", vals=names)
+ g.vp.short_name = g.new_vp("string", vals=short_names)
+ g.vp.psychiatric = g.new_vp("bool")
+ for i in psychiatric:
+ g.vp.psychiatric[i - 1] = True
+
+ # Entry (i, j) is the log odds of condition i given condition j; the
+ # edge goes from j to i.
+ i, j = numpy.nonzero(~numpy.eye(N, dtype=bool))
+ g.ep.log_odds = g.new_ep("double")
+ g.ep.pvalue = g.new_ep("double")
+ g.add_edge_list(numpy.array([j, i, O[i, j], P[i, j]]).T,
+ eprops=[g.ep.log_odds, g.ep.pvalue])
+ yield alt, g