logo Netzschleuder network catalog, repository, and centrifuge

History of us_patents

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 by Tiago de Paula Peixoto 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/us_patents/__init__.py b/entries/us_patents/__init__.py
index e54cbb6..97a276b 100644
--- a/entries/us_patents/__init__.py
+++ b/entries/us_patents/__init__.py
@@ -44,7 +44,7 @@ Graph properties hold the auxiliary tables of the data file: `aconame` (the name
 tags = ['Informational', 'Citation', 'Unweighted', 'Temporal', 'Metadata']
 url = 'https://data.nber.org/patents/'
 citation = [('B. H. Hall, A. B. Jaffe, & M. Trajtenberg, "The NBER patent citations data file: Lessons, insights and methodological tools." National Bureau of Economic Research, NBER Working Paper No. 8498 (2001)', 'https://doi.org/10.3386/w8498')]
-icon_hash = '56a85c8e26855e083a2f78b8'
+date_added = '2020-08-11'
 upstream_license = None
 upstream_prefix = 'https://data.nber.org/patents/'
 files = [(('acite75_99.zip:cite75_99.txt', 'apat63_99.zip:apat63_99.txt',
[entries] Prefix the properties in the descriptions with (Node), (Edge) or (Graph) by Tiago de Paula Peixoto 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/us_patents/__init__.py b/entries/us_patents/__init__.py
index aeff5f6..e54cbb6 100644
--- a/entries/us_patents/__init__.py
+++ b/entries/us_patents/__init__.py
@@ -26,19 +26,19 @@ description = """Network of citations among utility patents granted in the Unite
 
 The patents granted between 1963 and 1999 are annotated with the variables of the NBER patent data file; for the other nodes these properties take the value $-1$ (or are empty). The network has the following properties:
 
-- `patent_id`: the patent number.
-- `GYEAR`, `GDATE`: the grant year, and the grant date (in days since 1 January 1960).
-- `APPYEAR`: the application year.
-- `COUNTRY`, `POSTATE`: the country of the first inventor, and the state if the country is the U.S.
-- `ASSIGNEE`: the identifier of the assignee (see the graph property `aconame`); `ASSCODE`: the type of assignee (1: unassigned, 2: U.S. non-government organization, 3: non-U.S. non-government organization, 4: U.S. individual, 5: non-U.S. individual, 6: U.S. government, 7: non-U.S. government).
-- `CLAIMS`: the number of claims.
-- `NCLASS`: the main U.S. patent class; `CAT` and `SUBCAT`: the technological category and sub-category of Hall, Jaffe and Trajtenberg.
-- `CMADE`, `CRECEIVE`: the number of citations made and received (up to 1999).
-- `RATIOCIT`: the fraction of the citations made that refer to patents granted since 1963.
-- `GENERAL`, `ORIGINAL`: the generality and originality indices, measuring the dispersion of the citations received and made over technology classes.
-- `FWDAPLAG`, `BCKGTLAG`: the mean forward citation lag and the mean backward citation lag, in years.
-- `SELFCTUB`, `SELFCTLB`: upper and lower bounds of the share of self-citations made (citations to patents of the same assignee); `SECDUPBD`, `SECDLWBD`: upper and lower bounds of the share of self-citations received.
-- `inventor`: the inventors of the patent, as a list with one dictionary per inventor holding the name and address of the inventor (`LASTNAM`, `FIRSTNAM`, `MIDNAM`, `MODIFNAM`, `STREET`, `CITY`, `POSTATE`, `COUNTRY`, `ZIP`) and its position in the list of inventors (`INVSEQ`).
+- (Node) `patent_id`: the patent number.
+- (Node) `GYEAR`, `GDATE`: the grant year, and the grant date (in days since 1 January 1960).
+- (Node) `APPYEAR`: the application year.
+- (Node) `COUNTRY`, `POSTATE`: the country of the first inventor, and the state if the country is the U.S.
+- (Node) `ASSIGNEE`: the identifier of the assignee (see the graph property `aconame`); `ASSCODE`: the type of assignee (1: unassigned, 2: U.S. non-government organization, 3: non-U.S. non-government organization, 4: U.S. individual, 5: non-U.S. individual, 6: U.S. government, 7: non-U.S. government).
+- (Node) `CLAIMS`: the number of claims.
+- (Node) `NCLASS`: the main U.S. patent class; `CAT` and `SUBCAT`: the technological category and sub-category of Hall, Jaffe and Trajtenberg.
+- (Node) `CMADE`, `CRECEIVE`: the number of citations made and received (up to 1999).
+- (Node) `RATIOCIT`: the fraction of the citations made that refer to patents granted since 1963.
+- (Node) `GENERAL`, `ORIGINAL`: the generality and originality indices, measuring the dispersion of the citations received and made over technology classes.
+- (Node) `FWDAPLAG`, `BCKGTLAG`: the mean forward citation lag and the mean backward citation lag, in years.
+- (Node) `SELFCTUB`, `SELFCTLB`: upper and lower bounds of the share of self-citations made (citations to patents of the same assignee); `SECDUPBD`, `SECDLWBD`: upper and lower bounds of the share of self-citations received.
+- (Node) `inventor`: the inventors of the patent, as a list with one dictionary per inventor holding the name and address of the inventor (`LASTNAM`, `FIRSTNAM`, `MIDNAM`, `MODIFNAM`, `STREET`, `CITY`, `POSTATE`, `COUNTRY`, `ZIP`) and its position in the list of inventors (`INVSEQ`).
 
 Graph properties hold the auxiliary tables of the data file: `aconame` (the names of the assignees), `amatch` (the match of assignees to Compustat companies), `classes` (the names of the patent classes), `states` and `countries` (codes of states and countries), `class_cat` (the category and sub-category of each patent class), and `cat_names` (the names of the categories and sub-categories)."""
 tags = ['Informational', 'Citation', 'Unweighted', 'Temporal', 'Metadata']
[entries] Remove unneeded code from the entries by Tiago de Paula Peixoto 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/us_patents/__init__.py b/entries/us_patents/__init__.py
index bf447b9..aeff5f6 100644
--- a/entries/us_patents/__init__.py
+++ b/entries/us_patents/__init__.py
@@ -18,10 +18,8 @@
 
 from .. import *
 import csv
-import tempfile
 import zipfile
 import subprocess
-import shutil
 
 title = "U.S. patent citation network (1975-1999)"
 description = """Network of citations among utility patents granted in the United States, from the NBER U.S. Patent Citations Data File compiled by B. H. Hall, A. B. Jaffe and M. Trajtenberg from the records of the U.S. Patent and Trademark Office. The network contains all citations made by patents granted between 1975 and 1999 (16,522,438 citations), and includes the citing patents as well as the patents they cite (3,774,768 nodes). Nodes are patents and a directed edge points from a citing patent to a cited patent.
@@ -82,7 +80,6 @@ def open_file(name, fn):
 @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] Fix parse bugs and improve descriptions and metadata by Tiago de Paula Peixoto 6bb6851
- parse fixes from the review of the descriptions, e.g. us_patents
  (directed), celegans_2019 (synapse direction), ecoli_transcription and
  yeast_transcription (regulator to target), bitcoin (direction, phantom
  node), ego_social (Google+ features and circles), scotus_majority,
  arxiv_authors and social_location (as in SNAP), caida_as, dnc, dom,
  mist, reuters and bibsonomy (names on the right nodes), uci_zoo
- every description now states explicitly what the nodes and edges
  represent; corrected titles, years, tags, citations and licences
- the "Hypergraph" tag is removed; very large entries are marked
  `huge = True` (see --skip-huge)
- ICON ids of partial duplicates added (hiv_transmission, congress_bills,
  openflights, dutch_school)
diff --git a/entries/us_patents/__init__.py b/entries/us_patents/__init__.py
index 6f0f7dc..bf447b9 100644
--- a/entries/us_patents/__init__.py
+++ b/entries/us_patents/__init__.py
@@ -24,13 +24,30 @@ import subprocess
 import shutil
 
 title = "U.S. patent citation network (1975-1999)"
-description = """Citations among patents in the United States, as found in the National Bureau of Economic Research (NBER) database, from 1975 to 1999. In addition to the citation graph, metadata on the patents themselves is available.[^icon]
-[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
+description = """Network of citations among utility patents granted in the United States, from the NBER U.S. Patent Citations Data File compiled by B. H. Hall, A. B. Jaffe and M. Trajtenberg from the records of the U.S. Patent and Trademark Office. The network contains all citations made by patents granted between 1975 and 1999 (16,522,438 citations), and includes the citing patents as well as the patents they cite (3,774,768 nodes). Nodes are patents and a directed edge points from a citing patent to a cited patent.
+
+The patents granted between 1963 and 1999 are annotated with the variables of the NBER patent data file; for the other nodes these properties take the value $-1$ (or are empty). The network has the following properties:
+
+- `patent_id`: the patent number.
+- `GYEAR`, `GDATE`: the grant year, and the grant date (in days since 1 January 1960).
+- `APPYEAR`: the application year.
+- `COUNTRY`, `POSTATE`: the country of the first inventor, and the state if the country is the U.S.
+- `ASSIGNEE`: the identifier of the assignee (see the graph property `aconame`); `ASSCODE`: the type of assignee (1: unassigned, 2: U.S. non-government organization, 3: non-U.S. non-government organization, 4: U.S. individual, 5: non-U.S. individual, 6: U.S. government, 7: non-U.S. government).
+- `CLAIMS`: the number of claims.
+- `NCLASS`: the main U.S. patent class; `CAT` and `SUBCAT`: the technological category and sub-category of Hall, Jaffe and Trajtenberg.
+- `CMADE`, `CRECEIVE`: the number of citations made and received (up to 1999).
+- `RATIOCIT`: the fraction of the citations made that refer to patents granted since 1963.
+- `GENERAL`, `ORIGINAL`: the generality and originality indices, measuring the dispersion of the citations received and made over technology classes.
+- `FWDAPLAG`, `BCKGTLAG`: the mean forward citation lag and the mean backward citation lag, in years.
+- `SELFCTUB`, `SELFCTLB`: upper and lower bounds of the share of self-citations made (citations to patents of the same assignee); `SECDUPBD`, `SECDLWBD`: upper and lower bounds of the share of self-citations received.
+- `inventor`: the inventors of the patent, as a list with one dictionary per inventor holding the name and address of the inventor (`LASTNAM`, `FIRSTNAM`, `MIDNAM`, `MODIFNAM`, `STREET`, `CITY`, `POSTATE`, `COUNTRY`, `ZIP`) and its position in the list of inventors (`INVSEQ`).
+
+Graph properties hold the auxiliary tables of the data file: `aconame` (the names of the assignees), `amatch` (the match of assignees to Compustat companies), `classes` (the names of the patent classes), `states` and `countries` (codes of states and countries), `class_cat` (the category and sub-category of each patent class), and `cat_names` (the names of the categories and sub-categories)."""
 tags = ['Informational', 'Citation', 'Unweighted', 'Temporal', 'Metadata']
 url = 'https://data.nber.org/patents/'
 citation = [('B. H. Hall, A. B. Jaffe, & M. Trajtenberg, "The NBER patent citations data file: Lessons, insights and methodological tools." National Bureau of Economic Research, NBER Working Paper No. 8498 (2001)', 'https://doi.org/10.3386/w8498')]
 icon_hash = '56a85c8e26855e083a2f78b8'
-ustream_license = None
+upstream_license = None
 upstream_prefix = 'https://data.nber.org/patents/'
 files = [(('acite75_99.zip:cite75_99.txt', 'apat63_99.zip:apat63_99.txt',
            "aconame.zip:aconame.txt", "amatch.zip:match.csv",
@@ -48,15 +65,17 @@ def open_file(name, fn):
         with open_upstream_file(name, fn, "r") as f:
             yield f
     except zipfile.BadZipFile:
-        # upstream zip files are actually invalid...
-        with tempfile.TemporaryDirectory(dir="cache/temp") as d:
-            with open_upstream_file(name, fn.split(".zip")[0] + ".zip", "rb",
-                                    autocompress=False) as f:
-                with open(d + "/tmp.zip", "wb") as of:
-                    shutil.copyfileobj(f, of)
-            subprocess.run(["unzip", "tmp.zip"], cwd=d, check=True)
-            with open(d + "/" + fn.split(".zip:")[1], "r") as f:
+        # upstream zip files are actually invalid for Python's zipfile, but
+        # can be read with unzip
+        archive, member = fn.split(".zip:")
+        with subprocess.Popen(["unzip", "-p",
+                               f"cache/upstream/{name}/{archive}.zip",
+                               member], stdout=subprocess.PIPE) as p:
+            with io.TextIOWrapper(p.stdout, "utf8") as f:
                 yield f
+            p.stdout.close()
+        if p.returncode != 0:
+            raise RuntimeError(f"unzip failed for {fn}")
 
 
 @cache_network()
@@ -73,6 +92,7 @@ def parse(alts=None):
         with ExitStack() as stack:
             fs = [stack.enter_context(open_file(name, fn)) for fn in fnames]
             g = load_graph_from_csv(fs[0],
+                                    directed=True,
                                     hashed=True,
                                     hash_type="string",
                                     skip_first=True)
@@ -127,7 +147,9 @@ def parse(alts=None):
                 except KeyError:
                     continue
                 p = {k:v for k, v in zip(keys,row[1:])}
-                g.vp.inventor[v] = p
+                if g.vp.inventor[v] is None:
+                    g.vp.inventor[v] = []
+                g.vp.inventor[v].append(p)
 
             g.gp.classes = g.new_gp("object", val={})
             for i, line in enumerate(fs[5]):
@@ -136,23 +158,19 @@ def parse(alts=None):
                 vals = line.split()
                 g.gp.classes[int(vals[0])] = " ".join(vals[1:])
 
+            # the file contains two tables (states and countries), each
+            # starting with a "Code ..." header line
             g.gp.states = g.new_gp("object", val={})
-            for i, line in enumerate(fs[6]):
-                if i < 9:
-                    continue
-                if line.startswith("--"):
-                    break
-                vals = line.split()
-                if len(vals) < 2:
-                    continue
-                g.gp.states[vals[0]] = " ".join(vals[1:])
-
             g.gp.countries = g.new_gp("object", val={})
-            for i, line in enumerate(fs[6]):
+            table = None
+            for line in fs[6]:
+                if line.startswith("Code"):
+                    table = g.gp.states if "State" in line else g.gp.countries
+                    continue
                 vals = line.split()
-                if len(vals) < 2:
+                if table is None or line.startswith("--") or len(vals) < 2:
                     continue
-                g.gp.countries[vals[0]] = " ".join(vals[1:])
+                table[vals[0]] = " ".join(vals[1:])
 
             g.gp.class_cat = g.new_gp("object", val={})
             keys = ["SubCat", "Cat"]
Update copyright information by Tiago de Paula Peixoto 73a4f0d
diff --git a/entries/us_patents/__init__.py b/entries/us_patents/__init__.py
index 46a27fa..6f0f7dc 100644
--- a/entries/us_patents/__init__.py
+++ b/entries/us_patents/__init__.py
@@ -1,7 +1,7 @@
 #! /usr/bin/env python
 # -*- coding: utf-8 -*-
 #
-# Copyright (C) 2020-2024 Tiago de Paula Peixoto <tiago@skewed.de>
+# 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
Update copyright information by Tiago de Paula Peixoto 3d288ea
diff --git a/entries/us_patents/__init__.py b/entries/us_patents/__init__.py
index 931131e..46a27fa 100644
--- a/entries/us_patents/__init__.py
+++ b/entries/us_patents/__init__.py
@@ -1,7 +1,7 @@
 #! /usr/bin/env python
 # -*- coding: utf-8 -*-
 #
-# Copyright (C) 2020-2023 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2020-2024 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
Update copyright information by Tiago de Paula Peixoto 8d005ae
diff --git a/entries/us_patents/__init__.py b/entries/us_patents/__init__.py
index c7e1ddb..931131e 100644
--- a/entries/us_patents/__init__.py
+++ b/entries/us_patents/__init__.py
@@ -1,7 +1,7 @@
 #! /usr/bin/env python
 # -*- coding: utf-8 -*-
 #
-# Copyright (C) 2021 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2020-2023 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
Update copyright info by Tiago de Paula Peixoto db2efcc
diff --git a/entries/us_patents/__init__.py b/entries/us_patents/__init__.py
index 9a04d10..c7e1ddb 100644
--- a/entries/us_patents/__init__.py
+++ b/entries/us_patents/__init__.py
@@ -1,7 +1,7 @@
 #! /usr/bin/env python
 # -*- coding: utf-8 -*-
 #
-# Copyright (C) 2020 Tiago de Paula Peixoto <tiago@skewed.de>
+# Copyright (C) 2021 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
Update citations to use DOIs by Tiago de Paula Peixoto e878874
diff --git a/entries/us_patents/__init__.py b/entries/us_patents/__init__.py
index 5db5942..9a04d10 100644
--- a/entries/us_patents/__init__.py
+++ b/entries/us_patents/__init__.py
@@ -28,7 +28,7 @@ description = """Citations among patents in the United States, as found in the N
 [^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
 tags = ['Informational', 'Citation', 'Unweighted', 'Temporal', 'Metadata']
 url = 'https://data.nber.org/patents/'
-citation = [('B. H. Hall, A. B. Jaffe, & M. Trajtenberg, "The NBER patent citations data file: Lessons, insights and methodological tools." National Bureau of Economic Research, NBER Working Paper No. 8498 (2001)', 'http://users.nber.org/~edegan/w/images/0/03/Hall_Jaffe_Tratjenberg_(2000)_-_The_NBER_Patent_Citations_Data_File.pdf')]
+citation = [('B. H. Hall, A. B. Jaffe, & M. Trajtenberg, "The NBER patent citations data file: Lessons, insights and methodological tools." National Bureau of Economic Research, NBER Working Paper No. 8498 (2001)', 'https://doi.org/10.3386/w8498')]
 icon_hash = '56a85c8e26855e083a2f78b8'
 ustream_license = None
 upstream_prefix = 'https://data.nber.org/patents/'
Change license from GPLv3 to AGPLv3 by Tiago de Paula Peixoto d754be5
diff --git a/entries/us_patents/__init__.py b/entries/us_patents/__init__.py
index 5f5b870..5db5942 100644
--- a/entries/us_patents/__init__.py
+++ b/entries/us_patents/__init__.py
@@ -3,18 +3,18 @@
 #
 # Copyright (C) 2020 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 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 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 General Public License for more details.
+# 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 General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# 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 *
 import csv
Add explicit attribution to descriptions obtained from ICON by Tiago de Paula Peixoto 1645314
diff --git a/entries/us_patents/__init__.py b/entries/us_patents/__init__.py
index fc4e16b..5f5b870 100644
--- a/entries/us_patents/__init__.py
+++ b/entries/us_patents/__init__.py
@@ -24,7 +24,8 @@ import subprocess
 import shutil
 
 title = "U.S. patent citation network (1975-1999)"
-description = "Citations among patents in the United States, as found in the National Bureau of Economic Research (NBER) database, from 1975 to 1999. In addition to the citation graph, metadata on the patents themselves is available."
+description = """Citations among patents in the United States, as found in the National Bureau of Economic Research (NBER) database, from 1975 to 1999. In addition to the citation graph, metadata on the patents themselves is available.[^icon]
+[^icon]: Description obtained from the [ICON](https://icon.colorado.edu) project."""
 tags = ['Informational', 'Citation', 'Unweighted', 'Temporal', 'Metadata']
 url = 'https://data.nber.org/patents/'
 citation = [('B. H. Hall, A. B. Jaffe, & M. Trajtenberg, "The NBER patent citations data file: Lessons, insights and methodological tools." National Bureau of Economic Research, NBER Working Paper No. 8498 (2001)', 'http://users.nber.org/~edegan/w/images/0/03/Hall_Jaffe_Tratjenberg_(2000)_-_The_NBER_Patent_Citations_Data_File.pdf')]
Initial commit by Tiago de Paula Peixoto cc85872
diff --git a/entries/us_patents/__init__.py b/entries/us_patents/__init__.py
new file mode 100644
index 0000000..fc4e16b
--- /dev/null
+++ b/entries/us_patents/__init__.py
@@ -0,0 +1,170 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2020 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 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+from .. import *
+import csv
+import tempfile
+import zipfile
+import subprocess
+import shutil
+
+title = "U.S. patent citation network (1975-1999)"
+description = "Citations among patents in the United States, as found in the National Bureau of Economic Research (NBER) database, from 1975 to 1999. In addition to the citation graph, metadata on the patents themselves is available."
+tags = ['Informational', 'Citation', 'Unweighted', 'Temporal', 'Metadata']
+url = 'https://data.nber.org/patents/'
+citation = [('B. H. Hall, A. B. Jaffe, & M. Trajtenberg, "The NBER patent citations data file: Lessons, insights and methodological tools." National Bureau of Economic Research, NBER Working Paper No. 8498 (2001)', 'http://users.nber.org/~edegan/w/images/0/03/Hall_Jaffe_Tratjenberg_(2000)_-_The_NBER_Patent_Citations_Data_File.pdf')]
+icon_hash = '56a85c8e26855e083a2f78b8'
+ustream_license = None
+upstream_prefix = 'https://data.nber.org/patents/'
+files = [(('acite75_99.zip:cite75_99.txt', 'apat63_99.zip:apat63_99.txt',
+           "aconame.zip:aconame.txt", "amatch.zip:match.csv",
+           "ainventor.zip:ainventor.txt", "list_of_classes.txt",
+           "list_of_countries.txt", "class_match.txt", "subcategories.csv"),
+          None, None)]
+
+def fetch_upstream(force=False):
+    return fetch_upstream_files(__name__.split(".")[-1], upstream_prefix, files,
+                                force)
+
+@contextmanager
+def open_file(name, fn):
+    try:
+        with open_upstream_file(name, fn, "r") as f:
+            yield f
+    except zipfile.BadZipFile:
+        # upstream zip files are actually invalid...
+        with tempfile.TemporaryDirectory(dir="cache/temp") as d:
+            with open_upstream_file(name, fn.split(".zip")[0] + ".zip", "rb",
+                                    autocompress=False) as f:
+                with open(d + "/tmp.zip", "wb") as of:
+                    shutil.copyfileobj(f, of)
+            subprocess.run(["unzip", "tmp.zip"], cwd=d, check=True)
+            with open(d + "/" + fn.split(".zip:")[1], "r") as f:
+                yield f
+
+
+@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_file(name, fn)) for fn in fnames]
+            g = load_graph_from_csv(fs[0],
+                                    hashed=True,
+                                    hash_type="string",
+                                    skip_first=True)
+            g.vp.patent_id = pid = g.vp.name.copy("int")
+            del g.vp["name"]
+            vs = {pid[v] : v for v in g.vertices()}
+
+            props = ["GYEAR", "GDATE", "APPYEAR", "COUNTRY", "POSTATE",
+                     "ASSIGNEE", "ASSCODE", "CLAIMS", "NCLASS", "CAT", "SUBCAT",
+                     "CMADE", "CRECEIVE", "RATIOCIT", "GENERAL", "ORIGINAL",
+                     "FWDAPLAG", "BCKGTLAG", "SELFCTUB", "SELFCTLB", "SECDUPBD",
+                     "SECDLWBD"]
+            for p in props:
+                if p not in ["COUNTRY", "POSTATE"]:
+                    g.vp[p] = g.new_vp("double", val=-1)
+                else:
+                    g.vp[p] = g.new_vp("string")
+            props = [g.vp[p] for p in props]
+            next(fs[1])
+            reader = csv.reader(fs[1], delimiter=',', quotechar='"')
+            for row in reader:
+                try:
+                    v = vs[int(row[0])]
+                except KeyError:
+                    continue
+                for p, val in zip(props, row[1:]):
+                    if val != "":
+                        p[v] = val
+
+            g.gp.aconame = g.new_gp("object", val={})
+            next(fs[2])
+            reader = csv.reader(fs[2], delimiter=',', quotechar='"')
+            for row in reader:
+                g.gp.aconame[int(row[0])] = row[1]
+
+            g.gp.amatch = g.new_gp("object", val={})
+            keys = ["assname", "cname", "cusip", "own", "pname", "sname"]
+            next(fs[3])
+            reader = csv.reader(fs[3], delimiter=',', quotechar='"')
+            for row in reader:
+                g.gp.amatch[int(row[0])] = {k: v for k, v in
+                                            zip(keys, row[1:])}
+
+            g.vp.inventor = g.new_vp("object")
+            keys = ["LASTNAM", "FIRSTNAM", "MIDNAM", "MODIFNAM", "STREET",
+                    "CITY", "POSTATE", "COUNTRY", "ZIP", "INVSEQ"]
+            reader = csv.reader(fs[4], delimiter=',', quotechar='"')
+            next(fs[4])
+            for row in reader:
+                try:
+                    v = vs[int(row[0])]
+                except KeyError:
+                    continue
+                p = {k:v for k, v in zip(keys,row[1:])}
+                g.vp.inventor[v] = p
+
+            g.gp.classes = g.new_gp("object", val={})
+            for i, line in enumerate(fs[5]):
+                if i < 9:
+                    continue
+                vals = line.split()
+                g.gp.classes[int(vals[0])] = " ".join(vals[1:])
+
+            g.gp.states = g.new_gp("object", val={})
+            for i, line in enumerate(fs[6]):
+                if i < 9:
+                    continue
+                if line.startswith("--"):
+                    break
+                vals = line.split()
+                if len(vals) < 2:
+                    continue
+                g.gp.states[vals[0]] = " ".join(vals[1:])
+
+            g.gp.countries = g.new_gp("object", val={})
+            for i, line in enumerate(fs[6]):
+                vals = line.split()
+                if len(vals) < 2:
+                    continue
+                g.gp.countries[vals[0]] = " ".join(vals[1:])
+
+            g.gp.class_cat = g.new_gp("object", val={})
+            keys = ["SubCat", "Cat"]
+            next(fs[7])
+            for i, line in enumerate(fs[7]):
+                vals = [int(x) for x in line.split()]
+                g.gp.class_cat[vals[0]] = {k:v for k,v in zip(keys,vals[1:])}
+
+            g.gp.cat_names = g.new_gp("object", val={})
+            keys = ["SubCatName", "CatNameShort", "CatNameLong"]
+
+            next(fs[8])
+            reader = csv.reader(fs[8], delimiter=',', quotechar='"')
+            for row in reader:
+                g.gp.cat_names[(int(row[0]), int(row[1]))] = {k:v for k,v in zip(keys, row[2:])}
+        yield alt, g