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

Don't insert lab member when creating lab team #983

Merged
merged 36 commits into from
May 29, 2024

Conversation

khl02007
Copy link
Collaborator

@khl02007 khl02007 commented May 20, 2024

Description

Related to #979. See also khl02007/spyglass#1, #304 and #822.

This is the logic of creating lab member and lab team upon NWB ingestion:

  1. Read experimenter field from the nwb file, which contains names in last, first format (can be a list of multiple experimenters)
  2. For each experimenter, insert a row in LabMember by converting the last, first format to first last format (line 62 of common_lab.py)
  3. In addition, for each experimenter, insert a row in LabTeam, again with first last as the team_name (line 68 of common_lab.py)
  4. During this, insert the lab member with first last into LabMember again (line 195 of common_lab.py)

Step 4 throws an error for me because the name Lee, Kyu Hyun has been converted to Kyu Hyun Lee and then passed to decompose_name, which throws an error. So this change comments out that step.

Checklist:

  • No. This PR should be accompanied by a release: (yes/no/unsure)
  • N/A. If release, I have updated the CITATION.cff
  • No. This PR makes edits to table definitions: (yes/no)
  • N/A. If table edits, I have included an alter snippet for release notes.
  • I have updated the CHANGELOG.md with PR number and description.
  • N/A. I have added/edited docs/notebooks to reflect the changes

Edited by @CBroz1

khl02007 and others added 30 commits May 9, 2023 23:56
@khl02007 khl02007 mentioned this pull request May 20, 2024
6 tasks
@khl02007 khl02007 requested review from CBroz1 and edeno May 20, 2024 21:13
@CBroz1
Copy link
Member

CBroz1 commented May 21, 2024

Yeah, I can see how the file ingestion process has some redundancies adding the members, and then adding them again when the team is added. We could change that by either...

  1. Removing the redundant add during team add, as done here, which would also change process of creating a new team independent of file ingestion. Going this route should probably involve some edits to the notebooks to highlight the need to add members individually before creating a team
  2. Somehow editing file ingestion to either (a) skip this step, or (b) 'recompose' full name using last, first format.

I think I like the last option the best. On L67-68, instead of feeding fullname to create_new_team, if could easily feed with [f"{last}, {first}"] - it'll still get redundantly decomposed, but without multi-space formatting issues

@edeno
Copy link
Collaborator

edeno commented May 21, 2024

I think my expectation as a user of how this would work (in a more general sense) is that:

  1. If I add a file, I should be able to work on it (i.e. I am automatically added to a team that only has myself).
  2. If I want other people to be able to work on the file, then I need to add them to my team.

@khl02007
Copy link
Collaborator Author

@CBroz1 I looked into your second suggestion, but it's not obvious to me how to do this (please let me know if you do). I assume you are saying that we should be able to pass both last, first and first last to LabTeam.create_new_team, check what type the input is, and transform it appropriately (so that we preserve functionality for passing first last while handling this case arising from NWB file ingestion). But LabTeam.create_new_team calls LabMember.insert_from_name (the line I commented out), which has the decompose_name step, so if we retain it, then a name like Kyu Hyun Lee will always throw an error. In other words, you can never add a name like Kyu Hyun Lee to LabMember if using insert_from_name. So this would need to change, or it should make clear that the input should be last, first and not first last.

How about instead of commenting it out, we just check if the name is in LabMember, and if not, provide an error message telling the user to do so? And then we can ask them to use a function that takes last name and first name explicitly. This may require changing notebooks but given that we have no way to add a name like mine I think it's OK.

@khl02007
Copy link
Collaborator Author

Anything else I need to do before we merge this?

@CBroz1
Copy link
Member

CBroz1 commented May 22, 2024

@khl02007 Just a changelog edit with PR number would be required. Revising the initial PR description with the checklist is a nice-to-have for posterity

@edeno edeno removed their request for review May 29, 2024 17:16
@edeno edeno requested review from CBroz1 and removed request for CBroz1 May 29, 2024 17:17
@edeno edeno merged commit 00ce118 into LorenFrankLab:master May 29, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants