aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-06-30 18:39:48 -0700
committerBryan Newbold <bnewbold@archive.org>2021-06-30 18:39:48 -0700
commit8a34f3747a6881eab66775388a9b6d7878c00a6c (patch)
treef5e3a97b3a4e7ca2a9d59f56e51e82abb49500a3
parente9b9abb51d03f8d8dc0b324a5c97e3758e0d2ec9 (diff)
downloadfatcat-scholar-8a34f3747a6881eab66775388a9b6d7878c00a6c.tar.gz
fatcat-scholar-8a34f3747a6881eab66775388a9b6d7878c00a6c.zip
refs: include (source) release_stage in output
-rw-r--r--fatcat_scholar/schema.py1
-rw-r--r--fatcat_scholar/transform.py1
-rw-r--r--tests/test_refs_transform.py27
3 files changed, 20 insertions, 9 deletions
diff --git a/fatcat_scholar/schema.py b/fatcat_scholar/schema.py
index b8a1923..e6d0422 100644
--- a/fatcat_scholar/schema.py
+++ b/fatcat_scholar/schema.py
@@ -282,6 +282,7 @@ class RefStructured(BaseModel):
biblio: RefBiblio
release_ident: Optional[str]
work_ident: Optional[str]
+ release_stage: Optional[str]
release_year: Optional[int]
index: Optional[int]
key: Optional[str]
diff --git a/fatcat_scholar/transform.py b/fatcat_scholar/transform.py
index 409e7a2..6904770 100644
--- a/fatcat_scholar/transform.py
+++ b/fatcat_scholar/transform.py
@@ -639,6 +639,7 @@ def refs_from_grobid(release: ReleaseEntity, tei_dict: dict) -> List[RefStructur
),
release_ident=release.ident,
work_ident=release.work_id,
+ release_stage=release.release_stage,
release_year=release.release_year,
index=ref.get("index"),
key=ref.get("id"),
diff --git a/tests/test_refs_transform.py b/tests/test_refs_transform.py
index c26ee1e..3fa490b 100644
--- a/tests/test_refs_transform.py
+++ b/tests/test_refs_transform.py
@@ -13,21 +13,30 @@ def test_transform_refs_grobid() -> None:
ident="releasedummy22222222222222",
work_id="workdummy22222222222222222",
release_year=1234,
+ release_stage="accepted",
ext_ids={},
)
tei_dict = teixml2json(blob, True)
refs = refs_from_grobid(dummy_release, tei_dict)
- ref = refs[12].biblio
- assert ref.contrib_raw_names is not None
- assert ref.contrib_raw_names[0] == "K Tasa"
- assert ref.container_name == "Quality Management in Health Care"
- assert ref.title == "Using patient feedback for quality improvement"
- assert ref.year == 1996
- assert ref.pages == "206-225"
- assert ref.volume == "8"
+ ref = refs[12]
+ assert ref.release_ident == "releasedummy22222222222222"
+ assert ref.work_ident == "workdummy22222222222222222"
+ assert ref.release_stage == "accepted"
+ assert ref.release_year == 1234
+ assert ref.ref_source == "grobid"
+ assert ref.key == "b12"
+ assert ref.index == 12
+ assert ref.locator == None
+ assert ref.biblio.contrib_raw_names is not None
+ assert ref.biblio.contrib_raw_names[0] == "K Tasa"
+ assert ref.biblio.container_name == "Quality Management in Health Care"
+ assert ref.biblio.title == "Using patient feedback for quality improvement"
+ assert ref.biblio.year == 1996
+ assert ref.biblio.pages == "206-225"
+ assert ref.biblio.volume == "8"
assert (
- ref.unstructured
+ ref.biblio.unstructured
== "Tasa K, Baker R, Murray M. Using patient feedback for qua- lity improvement. Quality Management in Health Care 1996;8:206-19."
)