History of mexican_drug_trafficking
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/mexican_drug_trafficking/__init__.py b/entries/mexican_drug_trafficking/__init__.py
index 7187ee9..8e668d6 100644
--- a/entries/mexican_drug_trafficking/__init__.py
+++ b/entries/mexican_drug_trafficking/__init__.py
@@ -33,7 +33,7 @@ The network has the following properties:
tags = ['Social', 'Offline', 'Unweighted', 'Metadata', 'Temporal', 'Multigraph']
url = 'https://www.michelecoscia.com/?page_id=1032'
citation = [('M. Coscia, V. Rios, "Knowing where and how criminal organizations operate using web content." Proceedings of the 21st ACM International Conference on Information and Knowledge Management (CIKM), 1412-1421 (2012)', 'https://doi.org/10.1145/2396761.2398446')]
-icon_hash = '575f419bbd3e93b53c695698'
+date_added = '2026-10-25'
upstream_license = None
upstream_prefix = 'https://www.michelecoscia.com/wp-content/uploads/2015/07'
files = [('CosciaRios2012_DataBase.zip:CosciaRios2012_DataBase.csv', None, None)]
[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/mexican_drug_trafficking/__init__.py b/entries/mexican_drug_trafficking/__init__.py
index 513be5e..7187ee9 100644
--- a/entries/mexican_drug_trafficking/__init__.py
+++ b/entries/mexican_drug_trafficking/__init__.py
@@ -24,8 +24,10 @@ description = """Temporal bipartite network of the presence of drug trafficking
The network has the following properties:
-- Nodes: `is_organization`, whether the node is a DTO (otherwise it is a municipality); `name`, the name of the DTO, as in the source (e.g. "Sinaloa", "Zetas", "Golfo"), or the INEGI code of the municipality (as a five-digit string with leading zero, e.g. "01001"); `state`, the INEGI code of the state of the municipality (-1 for DTOs).
-- Edges: `year`, the year of the activity.[^icon]
+- (Node) `is_organization`: whether the node is a DTO (otherwise it is a municipality).
+- (Node) `name`: the name of the DTO, as in the source (e.g. "Sinaloa", "Zetas", "Golfo"), or the INEGI code of the municipality (as a five-digit string with leading zero, e.g. "01001").
+- (Node) `state`: the INEGI code of the state of the municipality (-1 for DTOs).
+- (Edge) `year`: the year of the activity.[^icon].
[^icon]: Description obtained in part from the [ICON](https://icon.colorado.edu) project."""
tags = ['Social', 'Offline', 'Unweighted', 'Metadata', 'Temporal', 'Multigraph']
[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/mexican_drug_trafficking/__init__.py b/entries/mexican_drug_trafficking/__init__.py
index 1e4e70a..513be5e 100644
--- a/entries/mexican_drug_trafficking/__init__.py
+++ b/entries/mexican_drug_trafficking/__init__.py
@@ -44,7 +44,6 @@ def fetch_upstream(force=False):
@coerce_props()
@annotate()
def parse(alts=None):
- global files
name = __name__.split(".")[-1]
for fname, alt, fmt in files:
if alts is not None and alt not in alts:
[entries] New entry: mexican_drug_trafficking d60498f
diff --git a/entries/mexican_drug_trafficking/__init__.py b/entries/mexican_drug_trafficking/__init__.py
new file mode 100644
index 0000000..1e4e70a
--- /dev/null
+++ b/entries/mexican_drug_trafficking/__init__.py
@@ -0,0 +1,80 @@
+#! /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 = "Mexican drug trafficking organizations and municipalities (1990-2010)"
+description = """Temporal bipartite network of the presence of drug trafficking organizations (DTOs) in the municipalities of Mexico, for each year from 1990 to 2010, from M. Coscia and V. Rios. The data were extracted automatically from web content (Google News articles and other online sources), by detecting, for each year, which DTOs were mentioned together with which municipalities a significant number of times. Nodes are the 2,457 Mexican municipalities and 10 DTOs (the nine largest organizations, plus "Otros", which groups all other DTOs), and an edge with year $t$ connects a DTO to a municipality if the organization was found to operate in the municipality in year $t$; the same pair may be connected by several edges, one for each year. Data before 2004 are less reliable than later data, according to the authors. Municipalities without any detected DTO activity are included as isolated nodes.
+
+The network has the following properties:
+
+- Nodes: `is_organization`, whether the node is a DTO (otherwise it is a municipality); `name`, the name of the DTO, as in the source (e.g. "Sinaloa", "Zetas", "Golfo"), or the INEGI code of the municipality (as a five-digit string with leading zero, e.g. "01001"); `state`, the INEGI code of the state of the municipality (-1 for DTOs).
+- Edges: `year`, the year of the activity.[^icon]
+
+[^icon]: Description obtained in part from the [ICON](https://icon.colorado.edu) project."""
+tags = ['Social', 'Offline', 'Unweighted', 'Metadata', 'Temporal', 'Multigraph']
+url = 'https://www.michelecoscia.com/?page_id=1032'
+citation = [('M. Coscia, V. Rios, "Knowing where and how criminal organizations operate using web content." Proceedings of the 21st ACM International Conference on Information and Knowledge Management (CIKM), 1412-1421 (2012)', 'https://doi.org/10.1145/2396761.2398446')]
+icon_hash = '575f419bbd3e93b53c695698'
+upstream_license = None
+upstream_prefix = 'https://www.michelecoscia.com/wp-content/uploads/2015/07'
+files = [('CosciaRios2012_DataBase.zip:CosciaRios2012_DataBase.csv', None, 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 fname, alt, fmt in files:
+ if alts is not None and alt not in alts:
+ continue
+ with open_upstream_file(name, fname, "r") as f:
+ rows = list(csv.reader(f))
+ header = rows[0]
+ dtos = header[3:]
+ munis = {}
+ edges = []
+ for row in rows[1:]:
+ code = row[0].zfill(5)
+ if code not in munis:
+ munis[code] = (len(dtos) + len(munis), int(row[1]))
+ v = munis[code][0]
+ year = int(row[2])
+ for k, x in enumerate(row[3:]):
+ if int(x) != 0:
+ edges.append((k, v, year))
+ g = Graph(directed=False)
+ g.add_vertex(len(dtos) + len(munis))
+ g.vp.is_organization = g.new_vp("bool")
+ g.vp.name = g.new_vp("string")
+ g.vp.state = g.new_vp("int", val=-1)
+ for k, d in enumerate(dtos):
+ g.vp.is_organization[k] = True
+ g.vp.name[k] = d
+ for code, (v, state) in munis.items():
+ g.vp.name[v] = code
+ g.vp.state[v] = state
+ g.ep.year = g.new_ep("int")
+ g.add_edge_list(edges, eprops=[g.ep.year])
+ yield alt, g