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

Add revisable MolecularProfile common name #719

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@
deprecated: c.deprecated
}"></cvc-molecular-profile-tag>
</span>
<span *ngSwitchCase="'SOURCE'">
<cvc-source-tag
[source]="{
id: c.entityId,
displayName:
c.displayName,
link: c.link}">
</cvc-source-tag>
</span>
<span *ngSwitchCase="'ROLE'">
<nz-tag
><i
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { CvcOrganizationTagModule } from '@app/components/organizations/organiza
import { NzTagModule } from 'ng-zorro-antd/tag'
import { NzIconModule } from 'ng-zorro-antd/icon'
import { CvcMolecularProfileTagModule } from '@app/components/molecular-profiles/molecular-profile-tag/molecular-profile-tag.module'
import { CvcSourceTagModule } from '@app/components/sources/source-tag/source-tag.module';

@NgModule({
declarations: [CvcCommentBodyComponent],
Expand All @@ -28,6 +29,7 @@ import { CvcMolecularProfileTagModule } from '@app/components/molecular-profiles
CvcUserTagModule,
CvcOrganizationTagModule,
CvcMolecularProfileTagModule,
CvcSourceTagModule,
],
exports: [CvcCommentBodyComponent],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export class IconNameForSubscribableEntity implements PipeTransform {
case 'MOLECULAR_PROFILE':
case 'MolecularProfile':
return 'civic-molecularprofile'
case 'SOURCE':
case 'Source':
return 'civic-source';
default:
console.log('String No icon name found for ' + e)
return 'border-outer'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ export class CvcCommentInputForm implements OnDestroy, OnChanges {
return `RID${id}`
case TaggableEntity.MolecularProfile:
return `MPID${id}`
case TaggableEntity.Source:
return `SID${id}`
case TaggableEntity.Role:
return Object.keys(UserRole)[id]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
query AssertionRevisableFields($assertionId: Int!) {
assertion(id: $assertionId) {
...RevisableAssertionFields
}
}

fragment RevisableAssertionFields on Assertion {
id
summary
description
molecularProfile {
id
name
link
}
variantOrigin
significance
disease {
id
doid
name
displayName
link
}
therapies {
id
ncitId
name
link
}
therapyInteractionType
assertionDirection
assertionType
phenotypes {
id
hpoId
name
}
ampLevel
acmgCodes {
id
name
code
description
tooltip
}
clingenCodes {
id
code
description
name
tooltip
exclusive
}
nccnGuideline {
id
name
}
nccnGuidelineVersion
regulatoryApproval
fdaCompanionTest
evidenceItems {
id
name
link
status
}
}

mutation SuggestAssertionRevision($input: SuggestAssertionRevisionInput!) {
suggestAssertionRevision(input: $input) {
clientMutationId
assertion {
id
}
results {
newlyCreated
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
mutation SubmitAssertion($input: SubmitAssertionInput!) {
submitAssertion(input: $input) {
clientMutationId
assertion {
id
}
}
}
35 changes: 17 additions & 18 deletions client/src/app/forms/config/evidence-revise/evidence-revise.form.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
import {
AfterViewInit,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
Input,
OnDestroy,
OnInit
AfterViewInit,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
Input,
OnDestroy,
OnInit,
} from '@angular/core'
import { UntypedFormGroup } from '@angular/forms'
import { NetworkErrorsService } from '@app/core/services/network-errors.service'
import {
MutationState,
MutatorWithState
MutationState,
MutatorWithState,
} from '@app/core/utilities/mutation-state-wrapper'
import { EvidenceReviseModel } from '@app/forms/models/evidence-revise.model'
import { EvidenceState } from '@app/forms/states/evidence.state'
import {
evidenceFormModelToReviseInput,
evidenceToModelFields
evidenceFormModelToReviseInput,
evidenceToModelFields,
} from '@app/forms/utilities/evidence-to-model-fields'
import {
EvidenceItemRevisableFields2GQL,
SuggestEvidenceItemRevision2GQL,
SuggestEvidenceItemRevisionGQL,
SuggestEvidenceItemRevisionMutation,
SuggestEvidenceItemRevisionMutationVariables
EvidenceItemRevisableFieldsGQL,
SuggestEvidenceItemRevisionGQL,
SuggestEvidenceItemRevisionMutation,
SuggestEvidenceItemRevisionMutationVariables,
} from '@app/generated/civic.apollo'
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'
import { FormlyFieldConfig, FormlyFormOptions } from '@ngx-formly/core'
Expand Down Expand Up @@ -55,8 +54,8 @@ export class CvcEvidenceReviseForm implements OnInit, AfterViewInit, OnDestroy {
mutationState?: MutationState

constructor(
private revisableFieldsGQL: EvidenceItemRevisableFields2GQL,
private submitRevisionsGQL: SuggestEvidenceItemRevision2GQL,
private revisableFieldsGQL: EvidenceItemRevisableFieldsGQL,
private submitRevisionsGQL: SuggestEvidenceItemRevisionGQL,
private networkErrorService: NetworkErrorsService,
private cdr: ChangeDetectorRef
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

query EvidenceItemRevisableFields2($evidenceId: Int!) {
query EvidenceItemRevisableFields($evidenceId: Int!) {
evidenceItem(id: $evidenceId) {
...RevisableEvidenceFields2
...RevisableEvidenceFields
}
}

fragment RevisableEvidenceFields2 on EvidenceItem {
fragment RevisableEvidenceFields on EvidenceItem {
id
molecularProfile {
...MolecularProfileSelectTypeaheadFields
Expand All @@ -32,7 +31,7 @@ fragment RevisableEvidenceFields2 on EvidenceItem {
}
}

mutation SuggestEvidenceItemRevision2(
mutation SuggestEvidenceItemRevision(
$input: SuggestEvidenceItemRevisionInput!
) {
suggestEvidenceItemRevision(input: $input) {
Expand Down
47 changes: 29 additions & 18 deletions client/src/app/forms/config/evidence-submit/evidence-submit.form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ import {
} from '@app/core/utilities/mutation-state-wrapper'
import { EvidenceSubmitModel } from '@app/forms/models/evidence-submit.model'
import { EvidenceState } from '@app/forms/states/evidence.state'
import { evidenceToModelFields, evidenceFormModelToInput, } from '@app/forms/utilities/evidence-to-model-fields'
import {
EvidenceItemRevisableFields2GQL,
evidenceToModelFields,
evidenceFormModelToInput,
} from '@app/forms/utilities/evidence-to-model-fields'
import {
EvidenceItemRevisableFieldsGQL,
ExistingEvidenceCountGQL,
ExistingEvidenceCountQuery,
ExistingEvidenceCountQueryVariables,
Expand Down Expand Up @@ -61,11 +64,14 @@ export class CvcEvidenceSubmitForm implements OnDestroy, AfterViewInit, OnInit {
existingEvidenceId?: number
routeSub: Subscription

countQueryRef?: QueryRef<ExistingEvidenceCountQuery, ExistingEvidenceCountQueryVariables>
countQueryRef?: QueryRef<
ExistingEvidenceCountQuery,
ExistingEvidenceCountQueryVariables
>
existingEvidenceCount$?: Observable<number>

constructor(
private revisableFieldsGQL: EvidenceItemRevisableFields2GQL,
private revisableFieldsGQL: EvidenceItemRevisableFieldsGQL,
private submitEvidenceGQL: SubmitEvidenceItemGQL,
private existingEvidenceGQL: ExistingEvidenceCountGQL,
private cdr: ChangeDetectorRef,
Expand All @@ -82,11 +88,11 @@ export class CvcEvidenceSubmitForm implements OnDestroy, AfterViewInit, OnInit {
this.existingEvidenceId = +params.existingEvidenceId

let direction = this.getFieldConfig('direction-select')
if(direction) {
if (direction) {
direction.props!.formMode = 'clone'
}
let significance = this.getFieldConfig('significance-select')
if(significance) {
if (significance) {
significance.props!.formMode = 'clone'
}
} else {
Expand All @@ -96,23 +102,25 @@ export class CvcEvidenceSubmitForm implements OnDestroy, AfterViewInit, OnInit {
}

getFieldConfig(fieldKey: string) {
return this.fields?.[0]
.fieldGroup?.find(f => f.key === 'fields')
?.fieldGroup?.find(f => f.type === fieldKey)
return this.fields?.[0].fieldGroup
?.find((f) => f.key === 'fields')
?.fieldGroup?.find((f) => f.type === fieldKey)
}


ngOnInit(): void {
this.countQueryRef = this.existingEvidenceGQL.watch({molecularProfileId: 0, sourceId: 0})
this.countQueryRef = this.existingEvidenceGQL.watch({
molecularProfileId: 0,
sourceId: 0,
})
this.existingEvidenceCount$ = this.countQueryRef?.valueChanges.pipe(
map(c => c.data?.evidenceItems?.totalCount),
filter(isNonNulled),
untilDestroyed(this)
map((c) => c.data?.evidenceItems?.totalCount),
filter(isNonNulled),
untilDestroyed(this)
)
}

ngAfterViewInit(): void {
if(this.existingEvidenceId) {
if (this.existingEvidenceId) {
this.revisableFieldsGQL
.fetch({ evidenceId: this.existingEvidenceId })
.pipe(untilDestroyed(this))
Expand Down Expand Up @@ -157,16 +165,19 @@ export class CvcEvidenceSubmitForm implements OnDestroy, AfterViewInit, OnInit {

onModelChange(newModel: EvidenceSubmitModel) {
if (newModel.fields.sourceId && newModel.fields.molecularProfileId) {
if (newModel.fields.sourceId != this.selectedSourceId || newModel.fields.molecularProfileId != this.selectedMpId) {
if (
newModel.fields.sourceId != this.selectedSourceId ||
newModel.fields.molecularProfileId != this.selectedMpId
) {
this.selectedSourceId = newModel.fields.sourceId
this.selectedMpId = newModel.fields.molecularProfileId
this.countQueryRef?.refetch({
molecularProfileId: newModel.fields.molecularProfileId,
sourceId: newModel.fields.sourceId
sourceId: newModel.fields.sourceId,
})
}
} else {
this.countQueryRef?.refetch({molecularProfileId: 0, sourceId: 0})
this.countQueryRef?.refetch({ molecularProfileId: 0, sourceId: 0 })
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
query EvidenceFieldsFromSourceSuggestion(
$sourceId: Int
$molecularProfileId: Int
$diseaseId: Int
) {
sourceSuggestionValues(
molecularProfileId: $molecularProfileId
diseaseId: $diseaseId
sourceId: $sourceId
) {
molecularProfile {
id
name
link
}
disease {
id
name
link
}
source {
id
sourceType
citationId
citation
link
}
}
}

query EvidenceSubmittableFields($evidenceId: Int!) {
evidenceItem(id: $evidenceId) {
...SubmittableEvidenceFields
}
}

fragment SubmittableEvidenceFields on EvidenceItem {
id
description
variantOrigin
evidenceType
significance
evidenceLevel
evidenceDirection
evidenceRating
therapyInteractionType
source {
id
citation
sourceType
}
phenotypes {
id
name
}
therapies {
id
name
}
disease {
id
name
}
}

mutation SubmitEvidenceItem($input: SubmitEvidenceItemInput!) {
submitEvidence(input: $input) {
clientMutationId
evidenceItem {
id
}
}
}
Loading
Loading