Skip to content
Closed
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion app/Modules/Group/Events/GroupEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ public function getTopic(): string
*/
public function shouldPublish(): bool
{
return $this->group->isEp;

return $this->group->isEp || $this->group->isWg || $this->group->isCdwg;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the reason this is not sufficient is elucidated by tracing the code path of what happens when a member is added to a group (regardless of whether EP, WG, CDWG):

A POST is made to /api/groups/{group:uuid}/members, which you can see in app/Modules/Group/routes/api.php (or perhaps more easily by looking at the output of php artisan route:list) is associated to App\Modules\Group\Actions\MemberAdd.

handle of that controller dispatches a MemberAdded event. This ultimately inherits from the GroupEvent you've modified here, but through GroupMemberEvent which overrides shouldPublish to include conjunction with $this->group->expertPanel->definitionIsApproved;

So even though you've modified GroupEvent to produce events for groups that are not EPs, but the subclass GroupMemberEvents that aren't from EPs cannot satisfy this conjunction, so do not end up being published to the data exchange.



}

abstract public function getLogEntry() :string;
Expand Down
5 changes: 5 additions & 0 deletions app/Modules/Group/Events/GroupStatusUpdated.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, 5])) {
return;
}
}

public function getLogEntry(): string
Expand Down
30 changes: 20 additions & 10 deletions app/Modules/Group/Events/Traits/IsPublishableApplicationEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,26 @@ public function getEventType(): string
}

public function getPublishableMessage(): array
{
return [
'expert_panel' => [
'id' => $this->group->uuid,
'name' => $this->group->displayName,
'type' => $this->group->fullType->name,
'affiliation_id' => $this->group->expertPanel->affiliation_id
],
];
}
{
return [
'expert_panel' => array_merge([
'id' => $this->group->uuid,
'long_name' => $this->group->name,
'short_name' => $this->group->expertPanel->short_base_name,
'status' => optional($this->group->groupStatus)->name, // Retrieve the status name
'parent_group' => optional($this->group->parentGroup)->name,
'type' => $this->group->fullType->name,
'affiliation_id' => $this->group->expertPanel->affiliation_id,
],
// 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] : [],
$this->group->fullType->name === 'vcep' ? ['vspec_web_address' => null] : [],
)
];
}


public function mapGeneForMessage($gene): array
{
Expand Down
7 changes: 7 additions & 0 deletions app/Modules/Group/Models/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,11 @@ protected static function newFactory()
{
return new GroupFactory();
}

public function parentGroup(): BelongsTo
{
return $this->belongsTo(Group::class, 'parent_id', 'id');
}


}
4 changes: 1 addition & 3 deletions app/Modules/Person/Events/Traits/PublishesEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function shouldPublish(): bool
return true;
}


public function getPublishableMessage(): array
{
return [
Expand All @@ -46,9 +47,6 @@ public function getPublishableMessage(): array
];
}




private function getInstitutionMessage(): ?array
{
if (!$this->person->institution_id) {
Expand Down
4 changes: 2 additions & 2 deletions config/dx.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
* The current schema version of messsages sent to a particular topic.
*/
'schema_versions' => [
'gpm-general-events' => '1.1.0',
'gpm-person-events' => '1.1.0'
'gpm-general-events' => '1.2.0',
'gpm-person-events' => '1.2.0'
]

];