Skip to content

Commit 71be033

Browse files
committed
fix: handled data extraction workflow if no composition-data is present as text
1 parent 263a1b8 commit 71be033

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/comproscanner/comproscanner.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,25 @@ def _has_composition_data(comp_data):
419419

420420
try:
421421
try:
422+
if paper_data["comp_prop_text"].strip() == "":
423+
logger.warning(
424+
f"No composition-property text data for DOI: {paper_data['doi']}. Skipping..."
425+
)
426+
# add the DOI to checked DOIs file
427+
try:
428+
dir_path = os.path.dirname(checked_doi_list_file)
429+
if dir_path:
430+
os.makedirs(dir_path, exist_ok=True)
431+
with open(checked_doi_list_file, "a") as f:
432+
logger.info(
433+
f"Adding DOI to checked list: {paper_data['doi']}"
434+
)
435+
f.write(f"{paper_data['doi']}\n")
436+
except Exception as e:
437+
logger.error(
438+
f"Error writing to checked DOIs file {checked_doi_list_file}: {str(e)}"
439+
)
440+
continue
422441
flow = DataExtractionFlow(
423442
doi=paper_data["doi"],
424443
main_extraction_keyword=main_extraction_keyword,

0 commit comments

Comments
 (0)