enhance group events DEX message for additional fields such as scope description#86
enhance group events DEX message for additional fields such as scope description#86
Conversation
|
Configs.json shouldn't be part of this change request. It's related to the roles change. |
bf608b2 to
aa3dbff
Compare
I'm guessing that is probably true for Since I have needed to rebase to current main, anyway, I will amend this commit to not include |
aa3dbff to
d5846e8
Compare
|
Modified commit to just include the files relevant to this change. Older version of the commit is in branch |
| return [ | ||
| 'expert_panel' => array_merge([ | ||
| 'id' => $this->group->uuid, | ||
| 'long_name' => $this->group->name, |
There was a problem hiding this comment.
As we discussed earlier today, it may be helpful to review the call. I thought the website team was OK with receiving things labelled as either long_name or name, as long as we are consistent, and there are many other messages where the group name is sent as name. Personally, I lean towards name since that's also what it is called in the underlying db model.
There was a problem hiding this comment.
Yes, I understood from the call that other messages use name. The code is in good enough shape to send to gpm demo and revise later. There was only one example of name given on the call.
app/Modules/Group/Events/Traits/IsPublishableApplicationEvent.php
Outdated
Show resolved
Hide resolved
app/Modules/Group/Events/Traits/IsPublishableApplicationEvent.php
Outdated
Show resolved
Hide resolved
| // Conditionally add vcep fields below if type is 'vcep' | ||
| $this->group->fullType->name === 'vcep' ? ['clinvar_id' => null] : [], | ||
| $this->group->fullType->name === 'vcep' ? ['clinvar_url' => null] : [], | ||
| $this->group->fullType->name === 'vcep' ? ['cspec_url' => $this->group->expertPanel->affiliation_id] : [], |
There was a problem hiding this comment.
This is just an affiliation id, not a URL, so the field should probably have a different name. I thought we had talked about the website team generating this url from the affiliation ID, right?
app/Modules/Group/Events/Traits/IsPublishableApplicationEvent.php
Outdated
Show resolved
Hide resolved
app/Modules/Group/Events/Traits/IsPublishableApplicationEvent.php
Outdated
Show resolved
Hide resolved
|
|
||
| // Only process the event if the status is 2 or 5 | ||
| if (!in_array($this->group->group_status_id, [2, 3, 4, 5])) { | ||
| return; |
There was a problem hiding this comment.
Does this even do anything different? It looks to just be returning from the constructor "early", but it would also return right after this statement.
|
I added the filter by status, as the original requirement was to send active and the other. It works. I’ll remove the magic numbers. What is your suggestion for a better filter location?
…On Tue, Nov 5, 2024 at 2:41 PM, Bradford Powell ***@***.***(mailto:On Tue, Nov 5, 2024 at 2:41 PM, Bradford Powell <<a href=)> wrote:
@bpow commented on this pull request.
---------------------------------------------------------------
In [app/Modules/Group/Events/GroupStatusUpdated.php](#86 (comment)):
> @@ -23,6 +23,11 @@ class GroupStatusUpdated extends GroupEvent
*/
public function __construct(public Group $group, public GroupStatus $newStatus, public GroupStatus $oldStatus)
{
+
+ // Only process the event if the status is 2 or 5
+ if (!in_array($this->group->group_status_id, [2, 3, 4, 5])) {
+ return;
Does this even do anything different? It looks to just be returning from the constructor "early", but it would also return right after this statement.
—
Reply to this email directly, [view it on GitHub](#86 (review)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/ANJDPNN6YJTJA6VHX5KMDPLZ7ENNZAVCNFSM6AAAAABRG34KCKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDIMJWGU2DAOBVGQ).
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Did you test that this actually filters by status as you intended, because I don't think that placing a guard in the constructor like this (with just a return) would do so. There are several places I've mentioned this that may be relevant:
Although as mentioned in another CGSP-505 comment, it doesn't look like GroupEvent ever implements PublishableEvent, so maybe something is handled differently. This should definitely be a topic for additional documentation when you are able to identify the process (and again, I have suggested that the entirety of which messages are published at which events should be better documented). |
| if (!in_array($this->group->group_status_id, [2, 3, 4, 5])) { | ||
| return; | ||
| } | ||
| if ($this->group->group_status_id != config('groups.statuses.applying.id')) { |
There was a problem hiding this comment.
You need to test locally to see if having this here really prevents the message from being sent when a group is in status of applying. I do not think it does, so this is blocking merge into main.
| 'scope_description' => $this->group->expertPanel->scope_description, | ||
| ], | ||
| // Conditionally add vcep fields below if type is 'vcep' | ||
| $this->group->fullType->name === 'vcep' ? ['clinvar_id' => null] : [], |
There was a problem hiding this comment.
I am hesitant to merge to main while these vcep fields (clinvar_id and clinvar_url) remain null as placeholders.
|
I tested locally last week and said in our status meeting that it didn’t work. I’ll remove this guard.
…On Tue, Nov 19, 2024 at 1:06 PM, Bradford Powell ***@***.***(mailto:On Tue, Nov 19, 2024 at 1:06 PM, Bradford Powell <<a href=)> wrote:
@bpow commented on this pull request.
---------------------------------------------------------------
In [app/Modules/Group/Events/GroupStatusUpdated.php](#86 (comment)):
> public function __construct(public Group $group, public GroupStatus $newStatus, public GroupStatus $oldStatus)
{
- // Only process the event if the status is 2 or 5
- if (!in_array($this->group->group_status_id, [2, 3, 4, 5])) {
- return;
- }
+ if ($this->group->group_status_id != config('groups.statuses.applying.id')) {
You need to test locally to see if having this here really prevents the message from being sent when a group is in status of applying. I do not think it does, so this is blocking merge into main.
—
Reply to this email directly, [view it on GitHub](#86 (review)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/ANJDPNOJLKGSKYGIAVKZX7D2BN43ZAVCNFSM6AAAAABRG34KCKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDINBWGIZTQNZXGM).
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
6641429 to
f465254
Compare
…description original commit was modified by bpow to remove extraneous file changes in configs.json and groups.php
This should not been needed since the GroupEvent is in the file's namespace. Furthermore, it had been added to the previous commit spuriously (not related to the other parts of the commit. This should probably be a "fixup" to prior commit before eventual merge to main, but keeping in history for now for tracking purposes
changing this to 2.0.0 should be one of the last things we do before moving to production as protection against the possibility of accidentally publishing messages with a different format under the eventual 2.0.0 version number
* not needed for status since group_status is specified as NOT NULL and foreign key, so should always be present. I'd rather see an error than have it silently produce an empty value * use null-safe dereference rather than optional for parent_group. This is considered by many to be easier to read, and as it was written (with "->name" outside of the parentheses, I don't think it would have worked for all of the null-possible cases as it was written, anyway (if there was no parent group, then `optional($this->group->parentGroup)` would give an optional with null value, so we'd get an error when trying to access ->name from that
a270f5d to
95e765b
Compare
|
Replacing with #96 |
Opening pull request as @tmbattey-2021 indicated this is ready for review.