aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2020-02-26 11:38:51 -0800
committerBryan Newbold <bnewbold@robocracy.org>2020-02-26 11:38:51 -0800
commitc57a743cb8b774750c99c6f079438666a87f6476 (patch)
tree0adace2adf58c40b4baa977e02bbf204e109842b
parent4e6bc246d01183f4c7ffad7d0d474e683f04c07f (diff)
downloadfatcat-c57a743cb8b774750c99c6f079438666a87f6476.tar.gz
fatcat-c57a743cb8b774750c99c6f079438666a87f6476.zip
bulk ES transform: skip non-active entities
-rwxr-xr-xpython/fatcat_transform.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/python/fatcat_transform.py b/python/fatcat_transform.py
index 42d2ea99..9ddbaa4d 100755
--- a/python/fatcat_transform.py
+++ b/python/fatcat_transform.py
@@ -30,6 +30,8 @@ def run_elasticsearch_releases(args):
if not line:
continue
entity = entity_from_json(line, ReleaseEntity, api_client=args.api.api_client)
+ if entity['state'] != 'active':
+ continue
args.json_output.write(
json.dumps(release_to_elasticsearch(entity)) + '\n')
@@ -39,6 +41,8 @@ def run_elasticsearch_containers(args):
if not line:
continue
entity = entity_from_json(line, ContainerEntity, api_client=args.api.api_client)
+ if entity['state'] != 'active':
+ continue
args.json_output.write(
json.dumps(container_to_elasticsearch(entity)) + '\n')
@@ -48,6 +52,8 @@ def run_elasticsearch_files(args):
if not line:
continue
entity = entity_from_json(line, FileEntity, api_client=args.api.api_client)
+ if entity['state'] != 'active':
+ continue
args.json_output.write(
json.dumps(file_to_elasticsearch(entity)) + '\n')
@@ -66,6 +72,8 @@ def run_citeproc_releases(args):
if not line:
continue
entity = entity_from_json(line, ReleaseEntity, api_client=args.api.api_client)
+ if entity['state'] != 'active':
+ continue
csl_json = release_to_csl(entity)
csl_json['id'] = "release:" + (entity.ident or "unknown")
out = citeproc_csl(csl_json, args.style, args.html)