History of uk_prison_transfers
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/uk_prison_transfers/__init__.py b/entries/uk_prison_transfers/__init__.py
index f8651c2..53680fe 100644
--- a/entries/uk_prison_transfers/__init__.py
+++ b/entries/uk_prison_transfers/__init__.py
@@ -36,7 +36,7 @@ The network has the following properties:
tags = ['Social', 'Offline', 'Travel', 'Spatial', 'Weighted', 'Metadata']
url = 'https://git.skewed.de/count0/netzschleuder/-/issues/8'
citation = [('G. Xiu, J. Turner, T. Gross, "Spatialising \'carceral mobilities\': extracting census data for analysis of prisoner inflow, transfer and release." Journal of Computational Social Science 7, 2505-2533 (2024)', 'https://doi.org/10.1007/s42001-024-00318-y')]
-icon_hash = None
+date_added = '2026-10-25'
upstream_license = None
upstream_prefix = 'https://git.skewed.de/-/project/263/uploads'
files = [(['315d538d667b280b33267b69b613d6b2/prison_info.csv',
[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/uk_prison_transfers/__init__.py b/entries/uk_prison_transfers/__init__.py
index 8cb7811..f8651c2 100644
--- a/entries/uk_prison_transfers/__init__.py
+++ b/entries/uk_prison_transfers/__init__.py
@@ -25,8 +25,14 @@ description = """A network of movements of individuals between prisons in Englan
The network has the following properties:
-- Nodes: `oa_code`, the 2011 Census Output Area code; `prisons`, the list of names of the prisons in the OA; `functions`, the predominant function of each of these prisons (e.g. "Reception", "Cat C Trainer", "Open", "Female", "High Security", "YOI" for young offender institutions, "YJB" for Youth Justice Board establishments); `operators`, the operator of each of these prisons ("PSP" for the public sector prison service, or the private company operating it); `category`, the security category of the prison(s) in the OA, "Category A" (highest security) to "Category D" (open prisons), or "Undetermined" when no single category applies (e.g. women's prisons, institutions for young offenders, or OAs containing prisons of different categories); `sex`, the sex of the prisoners held ("Male", "Female", or "Undetermined" for OAs containing prisons for both sexes); `region`, the region of England, or Wales, where the OA is located.
-- Edges: `weight`, the number of individuals that moved from the source OA (residence one year before the census) to the target OA (residence on census day)."""
+- (Node) `oa_code`: the 2011 Census Output Area code.
+- (Node) `prisons`: the list of names of the prisons in the OA.
+- (Node) `functions`: the predominant function of each of these prisons (e.g. "Reception", "Cat C Trainer", "Open", "Female", "High Security", "YOI" for young offender institutions, "YJB" for Youth Justice Board establishments).
+- (Node) `operators`: the operator of each of these prisons ("PSP" for the public sector prison service, or the private company operating it).
+- (Node) `category`: the security category of the prison(s) in the OA, "Category A" (highest security) to "Category D" (open prisons), or "Undetermined" when no single category applies (e.g. women's prisons, institutions for young offenders, or OAs containing prisons of different categories).
+- (Node) `sex`: the sex of the prisoners held ("Male", "Female", or "Undetermined" for OAs containing prisons for both sexes).
+- (Node) `region`: the region of England, or Wales, where the OA is located.
+- (Edge) `weight`: the number of individuals that moved from the source OA (residence one year before the census) to the target OA (residence on census day)."""
tags = ['Social', 'Offline', 'Travel', 'Spatial', 'Weighted', 'Metadata']
url = 'https://git.skewed.de/count0/netzschleuder/-/issues/8'
citation = [('G. Xiu, J. Turner, T. Gross, "Spatialising \'carceral mobilities\': extracting census data for analysis of prisoner inflow, transfer and release." Journal of Computational Social Science 7, 2505-2533 (2024)', 'https://doi.org/10.1007/s42001-024-00318-y')]
[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/uk_prison_transfers/__init__.py b/entries/uk_prison_transfers/__init__.py
index 2671a3e..8cb7811 100644
--- a/entries/uk_prison_transfers/__init__.py
+++ b/entries/uk_prison_transfers/__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 fnames, alt, fmt in files:
if alts is not None and alt not in alts:
[entries] New entry: uk_prison_transfers d9df43f
Prisoner transfers between prisons in England and Wales, extracted from the 2011 Census (Xiu, Turner & Gross 2024), hosted from the files submitted with the request. Fixes #8
diff --git a/entries/uk_prison_transfers/__init__.py b/entries/uk_prison_transfers/__init__.py
new file mode 100644
index 0000000..2671a3e
--- /dev/null
+++ b/entries/uk_prison_transfers/__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/>.
+
+
+from .. import *
+from collections import defaultdict
+
+title = "Prisoner transfers in England and Wales (2010-2011)"
+description = """A network of movements of individuals between prisons in England and Wales, extracted by Xiu, Turner and Gross from the 2011 Census of England and Wales. The census recorded, for each usual resident, the address of usual residence one year before the census (27 March 2011); each flow counts the individuals whose usual residence one year before the census was in a census Output Area (OA) containing a prison, and whose usual residence on census day was in another OA containing a prison, as extracted by the authors. Since the flows are only resolved at the level of OAs, and some OAs contain more than one prison (10 OAs contain two or three prisons), the nodes are OAs containing prisons, not individual prisons. The list of prisons, and their attributes, is a contemporary list of prisons in England and Wales provided by the authors, and includes a few prisons that opened after 2011 (e.g. Oakwood and Berwyn); 8 of the OAs have no recorded flows, and appear as isolated nodes. The dataset was contributed to this repository by Gezhi Xiu.
+
+The network has the following properties:
+
+- Nodes: `oa_code`, the 2011 Census Output Area code; `prisons`, the list of names of the prisons in the OA; `functions`, the predominant function of each of these prisons (e.g. "Reception", "Cat C Trainer", "Open", "Female", "High Security", "YOI" for young offender institutions, "YJB" for Youth Justice Board establishments); `operators`, the operator of each of these prisons ("PSP" for the public sector prison service, or the private company operating it); `category`, the security category of the prison(s) in the OA, "Category A" (highest security) to "Category D" (open prisons), or "Undetermined" when no single category applies (e.g. women's prisons, institutions for young offenders, or OAs containing prisons of different categories); `sex`, the sex of the prisoners held ("Male", "Female", or "Undetermined" for OAs containing prisons for both sexes); `region`, the region of England, or Wales, where the OA is located.
+- Edges: `weight`, the number of individuals that moved from the source OA (residence one year before the census) to the target OA (residence on census day)."""
+tags = ['Social', 'Offline', 'Travel', 'Spatial', 'Weighted', 'Metadata']
+url = 'https://git.skewed.de/count0/netzschleuder/-/issues/8'
+citation = [('G. Xiu, J. Turner, T. Gross, "Spatialising \'carceral mobilities\': extracting census data for analysis of prisoner inflow, transfer and release." Journal of Computational Social Science 7, 2505-2533 (2024)', 'https://doi.org/10.1007/s42001-024-00318-y')]
+icon_hash = None
+upstream_license = None
+upstream_prefix = 'https://git.skewed.de/-/project/263/uploads'
+files = [(['315d538d667b280b33267b69b613d6b2/prison_info.csv',
+ '62ca11b8a1443312a61aa5c6f56b1581/prison_flow.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 fnames, alt, fmt in files:
+ if alts is not None and alt not in alts:
+ continue
+ with ExitStack() as stack:
+ f_info, f_flow = [stack.enter_context(open_upstream_file(name, fn, "r"))
+ for fn in fnames]
+
+ # One row per prison, with the OA code in the `geo_code` column;
+ # `Category`, `Sex` and `Region` are given per OA
+ oas = {}
+ prisons = defaultdict(list)
+ functions = defaultdict(list)
+ operators = defaultdict(list)
+ oa_props = {}
+ for row in csv.DictReader(f_info):
+ oa = row["geo_code"].strip()
+ v = oas.setdefault(oa, len(oas))
+ prisons[v].append(row["Prison"].strip())
+ functions[v].append(row["Predominan"].strip())
+ operators[v].append(row["Operator"].strip())
+ props = (row["Category"].strip(), row["Sex"].strip(),
+ row["Region"].strip())
+ if oa_props.setdefault(v, props) != props:
+ raise ValueError(f"inconsistent attributes for OA {oa}")
+
+ g = Graph(directed=True)
+ g.add_vertex(len(oas))
+ g.vp.oa_code = g.new_vp("string")
+ g.vp.prisons = g.new_vp("vector<string>")
+ g.vp.functions = g.new_vp("vector<string>")
+ g.vp.operators = g.new_vp("vector<string>")
+ g.vp.category = g.new_vp("string")
+ g.vp.sex = g.new_vp("string")
+ g.vp.region = g.new_vp("string")
+ for oa, v in oas.items():
+ g.vp.oa_code[v] = oa
+ g.vp.prisons[v] = prisons[v]
+ g.vp.functions[v] = functions[v]
+ g.vp.operators[v] = operators[v]
+ (g.vp.category[v], g.vp.sex[v],
+ g.vp.region[v]) = oa_props[v]
+
+ # Columns: index, origin OA, destination OA, flow
+ g.ep.weight = g.new_ep("int")
+ edges = []
+ for row in csv.DictReader(f_flow):
+ edges.append((oas[row["o"]], oas[row["d"]], int(row["flow"])))
+ g.add_edge_list(edges, eprops=[g.ep.weight])
+ yield alt, g