Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 49: Update ingestor to add dummy email if dataset has bad email #50

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions orchestration/flows/bl832/ingest_tomo832.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
Severity
)

DEFAULT_USER = "8.3.2" # In case there's not proposal number
UNKNWON_EMAIL = "[email protected]"
DEFAULT_USER = "8.3.2" # In case there's not proposal number
UNKNOWN_EMAIL = "[email protected]"
ingest_spec = "als832_dx_3"

logger = logging.getLogger("scicat_ingest")
Expand Down Expand Up @@ -102,7 +102,7 @@ def ingest(
upload_data_block(
scicat_client,
file_path,
dataset_id,
dataset_id,
INGEST_STORAGE_ROOT_PATH,
INGEST_SOURCE_ROOT_PATH)

Expand Down Expand Up @@ -134,7 +134,7 @@ def upload_raw_dataset(
dataset = RawDataset(
owner=scicat_metadata.get("/measurement/sample/experiment/pi") or "Unknown",
contactEmail=clean_email(scicat_metadata.get("/measurement/sample/experimenter/email"))
or "Unknown",
or "[email protected]",
creationLocation=scicat_metadata.get("/measurement/instrument/instrument_name")
or "Unknown",
datasetName=file_name,
Expand Down Expand Up @@ -192,7 +192,6 @@ def upload_data_block(
return scicat_client.upload_dataset_origdatablock(dataset_id, datablock)



def upload_attachment(
scicat_client: ScicatClient,
encoded_thumnbnail: str,
Expand Down Expand Up @@ -272,7 +271,7 @@ def clean_email(email: str):
if not email or email.upper() == "NONE":
# this is a brutal case, but the beamline sometimes puts in "None" and
# the new scicat backend hates that.
return UNKNWON_EMAIL
return UNKNOWN_EMAIL
return email.replace(" ", "").replace(",", "").replace("'", "")
return None

Expand Down
Loading