History of dawn
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] 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/dawn/__init__.py b/entries/dawn/__init__.py
index a52ac52..53195cf 100644
--- a/entries/dawn/__init__.py
+++ b/entries/dawn/__init__.py
@@ -37,7 +37,7 @@ url = ['https://www.cs.cornell.edu/~arb/data/DAWN/',
'https://www.cs.cornell.edu/~arb/data/cat-edge-DAWN/']
citation = [('A. R. Benson, R. Abebe, M. T. Schaub, A. Jadbabaie, J. Kleinberg, "Simplicial closure and higher-order link prediction." Proceedings of the National Academy of Sciences 115(48), E11221-E11230 (2018)', 'https://doi.org/10.1073/pnas.1800683115'),
('I. Amburg, N. Veldt, A. R. Benson, "Clustering in graphs and hypergraphs with categorical edge labels." Proceedings of The Web Conference 2020, 706-717 (2020)', 'https://doi.org/10.1145/3366423.3380152')]
-icon_hash = None
+date_added = '2026-10-25'
upstream_license = None
upstream_prefix = 'gdrive://'
files = [(('1wGwoG7oBWnNN7J9TEpjqNpODbsYfMxp4:tar.gz:DAWN/DAWN-nverts.txt',
[entries] Prefix the properties in the descriptions with (Node), (Edge) or (Graph) bc3dbbd
The lists of properties at the end of the descriptions marked edge properties with "Edge" but left node properties unmarked, or grouped them in "Nodes: `a`, ...; `b`, ..." items, so the kind of a property was often unclear. Every item now starts with (Node), (Edge) or (Graph), followed by the property names, a colon and the explanation, one item per property or group of properties; qualifications (kinds of nodes, networks) follow the names in parentheses. Properties that were only named got a short explanation, and a few items that named the wrong kind of property were corrected.
diff --git a/entries/dawn/__init__.py b/entries/dawn/__init__.py
index 2291bf6..a52ac52 100644
--- a/entries/dawn/__init__.py
+++ b/entries/dawn/__init__.py
@@ -26,9 +26,12 @@ description = """Bipartite networks of drugs and the hospital emergency departme
The networks have the following properties:
-- Drug nodes: `name`, the name of the drug; `code`, the DAWN drug code (`visits` only).
-- `visits`: `is_visit`, whether the node is a visit (otherwise it is a drug); `year` and `quarter` (1 to 4) of the visit.
-- `dispositions`: `is_combination`, whether the node is a drug combination (otherwise it is a drug); `disposition`, the disposition category, numbered 1 to 10. The names of the categories are not included in the source data (its file of category names lists drug names instead), and the 375 combinations with a category number larger than 10 have `disposition` set to -1."""
+- (Node) `name` (drugs): the name of the drug.
+- (Node) `code` (drugs, `visits` only): the DAWN drug code.
+- (Node) `is_visit` (`visits`): whether the node is a visit (otherwise it is a drug).
+- (Node) `year` and `quarter` (`visits`): the year and quarter (1 to 4) of the visit.
+- (Node) `is_combination` (`dispositions`): whether the node is a drug combination (otherwise it is a drug).
+- (Node) `disposition` (`dispositions`): the disposition category, numbered 1 to 10. The names of the categories are not included in the source data (its file of category names lists drug names instead), and the 375 combinations with a category number larger than 10 have `disposition` set to -1."""
tags = ['Public Health', 'Unweighted', 'Timestamps', 'Metadata']
url = ['https://www.cs.cornell.edu/~arb/data/DAWN/',
'https://www.cs.cornell.edu/~arb/data/cat-edge-DAWN/']
[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/dawn/__init__.py b/entries/dawn/__init__.py
index 062ee0a..2291bf6 100644
--- a/entries/dawn/__init__.py
+++ b/entries/dawn/__init__.py
@@ -55,7 +55,6 @@ def fetch_upstream(force=False):
@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: dawn 9158e1c
diff --git a/entries/dawn/__init__.py b/entries/dawn/__init__.py
new file mode 100644
index 0000000..062ee0a
--- /dev/null
+++ b/entries/dawn/__init__.py
@@ -0,0 +1,105 @@
+#! /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/>.
+
+from .. import *
+
+title = "Drug Abuse Warning Network emergency visits (2004-2011)"
+description = """Bipartite networks of drugs and the hospital emergency department visits in which they were reported, from the Drug Abuse Warning Network (DAWN). DAWN was a public health surveillance system of the U.S. Substance Abuse and Mental Health Services Administration (SAMHSA) that collected, from a national sample of hospitals, records of emergency department visits related to drug use. For each visit, the data list the drugs the patient reported having used, which include illicit substances, prescription and over-the-counter medication, and dietary supplements. The data were assembled by A. R. Benson and collaborators from the public DAWN files, and cover the years 2004 to 2011.
+
+- `visits`: each visit is a node connected to the drugs reported in it. Visits are dated at the resolution of quarter-years. Distinct visits with the same drugs are kept as separate nodes.
+- `dispositions`: each distinct combination of drugs reported in some visit is a node connected to its drugs, and annotated with the most common patient disposition (where the patient went after the visit, e.g. sent home, surgery, or released to detox) among the visits with that combination.
+
+The networks have the following properties:
+
+- Drug nodes: `name`, the name of the drug; `code`, the DAWN drug code (`visits` only).
+- `visits`: `is_visit`, whether the node is a visit (otherwise it is a drug); `year` and `quarter` (1 to 4) of the visit.
+- `dispositions`: `is_combination`, whether the node is a drug combination (otherwise it is a drug); `disposition`, the disposition category, numbered 1 to 10. The names of the categories are not included in the source data (its file of category names lists drug names instead), and the 375 combinations with a category number larger than 10 have `disposition` set to -1."""
+tags = ['Public Health', 'Unweighted', 'Timestamps', 'Metadata']
+url = ['https://www.cs.cornell.edu/~arb/data/DAWN/',
+ 'https://www.cs.cornell.edu/~arb/data/cat-edge-DAWN/']
+citation = [('A. R. Benson, R. Abebe, M. T. Schaub, A. Jadbabaie, J. Kleinberg, "Simplicial closure and higher-order link prediction." Proceedings of the National Academy of Sciences 115(48), E11221-E11230 (2018)', 'https://doi.org/10.1073/pnas.1800683115'),
+ ('I. Amburg, N. Veldt, A. R. Benson, "Clustering in graphs and hypergraphs with categorical edge labels." Proceedings of The Web Conference 2020, 706-717 (2020)', 'https://doi.org/10.1145/3366423.3380152')]
+icon_hash = None
+upstream_license = None
+upstream_prefix = 'gdrive://'
+files = [(('1wGwoG7oBWnNN7J9TEpjqNpODbsYfMxp4:tar.gz:DAWN/DAWN-nverts.txt',
+ '1wGwoG7oBWnNN7J9TEpjqNpODbsYfMxp4:tar.gz:DAWN/DAWN-simplices.txt',
+ '1wGwoG7oBWnNN7J9TEpjqNpODbsYfMxp4:tar.gz:DAWN/DAWN-times.txt',
+ '1wGwoG7oBWnNN7J9TEpjqNpODbsYfMxp4:tar.gz:DAWN/DAWN-node-labels.txt'),
+ 'visits', None),
+ (('1FDcmfzpgBTyJJVbMRRBLfUxI0OdsK9VQ:zip:cat-edge-DAWN/hyperedges.txt',
+ '1FDcmfzpgBTyJJVbMRRBLfUxI0OdsK9VQ:zip:cat-edge-DAWN/hyperedge-labels.txt',
+ '1FDcmfzpgBTyJJVbMRRBLfUxI0OdsK9VQ:zip:cat-edge-DAWN/node-labels.txt'),
+ 'dispositions', None)]
+
+def fetch_upstream(force=False):
+ return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+ force)
+
+@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
+ if isinstance(fnames, str):
+ fnames = [fnames]
+ with ExitStack() as stack:
+ fs = [stack.enter_context(open_upstream_file(name, fn, "r")) for fn in fnames]
+
+ if alt == "visits":
+ groups, members = read_simplices(fs[0], fs[1])
+ times = read_ints(fs[2])
+ # Drug labels: "<id> <code> <name>"
+ labels = {}
+ for line in fs[3]:
+ vid, code, dname = line.rstrip("\n").split(" ", 2)
+ labels[int(vid) - 1] = (code, dname)
+ N = max(max(labels) + 1, members.max() + 1)
+ g = bipartite_graph(groups, members, len(times), N, "is_visit")
+ g.vp.name = g.new_vp("string")
+ g.vp.code = g.new_vp("string")
+ for v, (code, dname) in labels.items():
+ g.vp.code[v] = code
+ g.vp.name[v] = dname
+ # Times are year * 4 + quarter, with quarter in 1..4
+ g.vp.year = g.new_vp("int")
+ g.vp.quarter = g.new_vp("int")
+ g.vp.year.a[N:] = (times - 1) // 4
+ g.vp.quarter.a[N:] = (times - 1) % 4 + 1
+ else:
+ groups, members, n = read_hyperedges(fs[0], sep="\t")
+ disp = read_ints(fs[1])
+ labels = {}
+ next(fs[2]) # header: node_id, name
+ for line in fs[2]:
+ vid, dname = line.rstrip("\r\n").split("\t", 1)
+ labels[int(vid) - 1] = dname
+ # Only the drugs that occur in some combination
+ used, members = numpy.unique(members, return_inverse=True)
+ g = bipartite_graph(groups, members, n, len(used),
+ "is_combination")
+ g.vp.name = g.new_vp("string")
+ for v, vid in enumerate(used):
+ g.vp.name[v] = labels.get(int(vid), "")
+ g.vp.disposition = g.new_vp("int")
+ g.vp.disposition.a[len(used):] = numpy.where(disp <= 10, disp, -1)
+ yield alt, g