Skip to content

Commit 9a09e40

Browse files
committed
refactor: log that shows amount of not recieved DOIs from BASE
1 parent 4889ec1 commit 9a09e40

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

server/workers/orcid/src/orcid_service.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,7 @@ def request_base_metadata(self, dois: List[str], params: Dict[str, str]) -> pd.D
203203
base_response: str = get_nested_value(result, ["input_data", "metadata"], '[]') # type: ignore
204204

205205
batch_df = pd.DataFrame(json.loads(base_response))
206-
if len(batch_df) < len(batch):
207-
self.logger.warning(
208-
f"BASE response shortfall: requested {len(batch)} DOIs, received {len(batch_df)} rows (limit or missing records?)"
209-
)
206+
self._log_is_base_response_missing_dois(batch, batch_df)
210207

211208
base_metadata = pd.concat([
212209
base_metadata,
@@ -679,4 +676,11 @@ def _handle_insufficient_results(self, params: Dict[str, str], orcid_id: str) ->
679676
def _handle_error(self, params: Dict[str, str], reason: str, exception: Exception) -> ErrorResult:
680677
self.logger.debug(f"Error processing ORCID: {exception}. Params: {params}")
681678
self.logger.debug(exception.__traceback__)
682-
return {"status": "error", "reason": [reason]}
679+
return {"status": "error", "reason": [reason]}
680+
681+
def _log_is_base_response_missing_dois(self, batch: List[str], batch_df: pd.DataFrame):
682+
is_some_dois_missing = len(batch_df) < len(batch)
683+
if is_some_dois_missing:
684+
self.logger.debug(
685+
f"BASE response statistics: requested {len(batch)} DOIs, received {len(batch_df)} rows"
686+
)

0 commit comments

Comments
 (0)