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 warning banner to eid and assertion summary if entity is in an invalid state #622

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 6 additions & 2 deletions client/src/app/generated/civic.apollo-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export type AdvancedSearchResultFieldPolicy = {
resultIds?: FieldPolicy<any> | FieldReadFunction<any>,
searchEndpoint?: FieldPolicy<any> | FieldReadFunction<any>
};
export type AssertionKeySpecifier = ('acceptanceEvent' | 'acmgCodes' | 'ampLevel' | 'assertionDirection' | 'assertionType' | 'clingenCodes' | 'clinicalSignificance' | 'comments' | 'description' | 'disease' | 'drugInteractionType' | 'drugs' | 'events' | 'evidenceItems' | 'evidenceItemsCount' | 'fdaCompanionTest' | 'fdaCompanionTestLastUpdated' | 'flagged' | 'flags' | 'id' | 'lastAcceptedRevisionEvent' | 'lastCommentEvent' | 'lastSubmittedRevisionEvent' | 'link' | 'molecularProfile' | 'name' | 'nccnGuideline' | 'nccnGuidelineVersion' | 'phenotypes' | 'regulatoryApproval' | 'regulatoryApprovalLastUpdated' | 'rejectionEvent' | 'revisions' | 'status' | 'submissionEvent' | 'summary' | 'variantOrigin' | AssertionKeySpecifier)[];
export type AssertionKeySpecifier = ('acceptanceEvent' | 'acmgCodes' | 'ampLevel' | 'assertionDirection' | 'assertionType' | 'clingenCodes' | 'clinicalSignificance' | 'comments' | 'description' | 'disease' | 'drugInteractionType' | 'drugs' | 'events' | 'evidenceItems' | 'evidenceItemsCount' | 'fdaCompanionTest' | 'fdaCompanionTestLastUpdated' | 'flagged' | 'flags' | 'id' | 'lastAcceptedRevisionEvent' | 'lastCommentEvent' | 'lastSubmittedRevisionEvent' | 'link' | 'molecularProfile' | 'name' | 'nccnGuideline' | 'nccnGuidelineVersion' | 'phenotypes' | 'regulatoryApproval' | 'regulatoryApprovalLastUpdated' | 'rejectionEvent' | 'revisions' | 'status' | 'submissionEvent' | 'summary' | 'valid' | 'validationErrors' | 'variantOrigin' | AssertionKeySpecifier)[];
export type AssertionFieldPolicy = {
acceptanceEvent?: FieldPolicy<any> | FieldReadFunction<any>,
acmgCodes?: FieldPolicy<any> | FieldReadFunction<any>,
Expand Down Expand Up @@ -84,6 +84,8 @@ export type AssertionFieldPolicy = {
status?: FieldPolicy<any> | FieldReadFunction<any>,
submissionEvent?: FieldPolicy<any> | FieldReadFunction<any>,
summary?: FieldPolicy<any> | FieldReadFunction<any>,
valid?: FieldPolicy<any> | FieldReadFunction<any>,
validationErrors?: FieldPolicy<any> | FieldReadFunction<any>,
variantOrigin?: FieldPolicy<any> | FieldReadFunction<any>
};
export type AssertionConnectionKeySpecifier = ('edges' | 'nodes' | 'pageCount' | 'pageInfo' | 'totalCount' | AssertionConnectionKeySpecifier)[];
Expand Down Expand Up @@ -603,7 +605,7 @@ export type EventSubjectWithCountFieldPolicy = {
occuranceCount?: FieldPolicy<any> | FieldReadFunction<any>,
subject?: FieldPolicy<any> | FieldReadFunction<any>
};
export type EvidenceItemKeySpecifier = ('acceptanceEvent' | 'assertions' | 'clinicalSignificance' | 'comments' | 'description' | 'disease' | 'drugInteractionType' | 'drugs' | 'events' | 'evidenceDirection' | 'evidenceLevel' | 'evidenceRating' | 'evidenceType' | 'flagged' | 'flags' | 'id' | 'lastAcceptedRevisionEvent' | 'lastCommentEvent' | 'lastSubmittedRevisionEvent' | 'link' | 'molecularProfile' | 'name' | 'phenotypes' | 'rejectionEvent' | 'revisions' | 'source' | 'status' | 'submissionEvent' | 'variant' | 'variantHgvs' | 'variantOrigin' | EvidenceItemKeySpecifier)[];
export type EvidenceItemKeySpecifier = ('acceptanceEvent' | 'assertions' | 'clinicalSignificance' | 'comments' | 'description' | 'disease' | 'drugInteractionType' | 'drugs' | 'events' | 'evidenceDirection' | 'evidenceLevel' | 'evidenceRating' | 'evidenceType' | 'flagged' | 'flags' | 'id' | 'lastAcceptedRevisionEvent' | 'lastCommentEvent' | 'lastSubmittedRevisionEvent' | 'link' | 'molecularProfile' | 'name' | 'phenotypes' | 'rejectionEvent' | 'revisions' | 'source' | 'status' | 'submissionEvent' | 'valid' | 'validationErrors' | 'variant' | 'variantHgvs' | 'variantOrigin' | EvidenceItemKeySpecifier)[];
export type EvidenceItemFieldPolicy = {
acceptanceEvent?: FieldPolicy<any> | FieldReadFunction<any>,
assertions?: FieldPolicy<any> | FieldReadFunction<any>,
Expand Down Expand Up @@ -633,6 +635,8 @@ export type EvidenceItemFieldPolicy = {
source?: FieldPolicy<any> | FieldReadFunction<any>,
status?: FieldPolicy<any> | FieldReadFunction<any>,
submissionEvent?: FieldPolicy<any> | FieldReadFunction<any>,
valid?: FieldPolicy<any> | FieldReadFunction<any>,
validationErrors?: FieldPolicy<any> | FieldReadFunction<any>,
variant?: FieldPolicy<any> | FieldReadFunction<any>,
variantHgvs?: FieldPolicy<any> | FieldReadFunction<any>,
variantOrigin?: FieldPolicy<any> | FieldReadFunction<any>
Expand Down
22 changes: 18 additions & 4 deletions client/src/app/generated/civic.apollo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ export type Assertion = Commentable & EventOriginObject & EventSubject & Flaggab
status: EvidenceStatus;
submissionEvent: Event;
summary: Scalars['String'];
valid: Scalars['Boolean'];
validationErrors: Array<FieldValidationError>;
variantOrigin: VariantOrigin;
};

Expand Down Expand Up @@ -1448,6 +1450,8 @@ export type EvidenceItem = Commentable & EventOriginObject & EventSubject & Flag
source: Source;
status: EvidenceStatus;
submissionEvent: Event;
valid: Scalars['Boolean'];
validationErrors: Array<FieldValidationError>;
variant: Variant;
variantHgvs: Scalars['String'];
variantOrigin: VariantOrigin;
Expand Down Expand Up @@ -6103,9 +6107,9 @@ export type AssertionDetailQueryVariables = Exact<{
}>;


export type AssertionDetailQuery = { __typename: 'Query', assertion?: { __typename: 'Assertion', id: number, name: string, status: EvidenceStatus, submissionEvent: { __typename: 'Event', originatingUser: { __typename: 'User', id: number } }, molecularProfile: { __typename: 'MolecularProfile', id: number, name: string, link: string }, flags: { __typename: 'FlagConnection', totalCount: number }, revisions: { __typename: 'RevisionConnection', totalCount: number }, comments: { __typename: 'CommentConnection', totalCount: number } } | undefined };
export type AssertionDetailQuery = { __typename: 'Query', assertion?: { __typename: 'Assertion', id: number, name: string, status: EvidenceStatus, valid: boolean, validationErrors: Array<{ __typename: 'FieldValidationError', fieldName: string, error: string }>, submissionEvent: { __typename: 'Event', originatingUser: { __typename: 'User', id: number } }, molecularProfile: { __typename: 'MolecularProfile', id: number, name: string, link: string }, flags: { __typename: 'FlagConnection', totalCount: number }, revisions: { __typename: 'RevisionConnection', totalCount: number }, comments: { __typename: 'CommentConnection', totalCount: number } } | undefined };

export type AssertionDetailFieldsFragment = { __typename: 'Assertion', id: number, name: string, status: EvidenceStatus, submissionEvent: { __typename: 'Event', originatingUser: { __typename: 'User', id: number } }, molecularProfile: { __typename: 'MolecularProfile', id: number, name: string, link: string }, flags: { __typename: 'FlagConnection', totalCount: number }, revisions: { __typename: 'RevisionConnection', totalCount: number }, comments: { __typename: 'CommentConnection', totalCount: number } };
export type AssertionDetailFieldsFragment = { __typename: 'Assertion', id: number, name: string, status: EvidenceStatus, valid: boolean, validationErrors: Array<{ __typename: 'FieldValidationError', fieldName: string, error: string }>, submissionEvent: { __typename: 'Event', originatingUser: { __typename: 'User', id: number } }, molecularProfile: { __typename: 'MolecularProfile', id: number, name: string, link: string }, flags: { __typename: 'FlagConnection', totalCount: number }, revisions: { __typename: 'RevisionConnection', totalCount: number }, comments: { __typename: 'CommentConnection', totalCount: number } };

export type AssertionSummaryQueryVariables = Exact<{
assertionId: Scalars['Int'];
Expand Down Expand Up @@ -6167,9 +6171,9 @@ export type EvidenceDetailQueryVariables = Exact<{
}>;


export type EvidenceDetailQuery = { __typename: 'Query', evidenceItem?: { __typename: 'EvidenceItem', id: number, name: string, status: EvidenceStatus, submissionEvent: { __typename: 'Event', originatingUser: { __typename: 'User', id: number } }, molecularProfile: { __typename: 'MolecularProfile', id: number, name: string, link: string }, assertions: Array<{ __typename: 'Assertion', id: number, name: string, link: string }>, flags: { __typename: 'FlagConnection', totalCount: number }, revisions: { __typename: 'RevisionConnection', totalCount: number }, comments: { __typename: 'CommentConnection', totalCount: number } } | undefined };
export type EvidenceDetailQuery = { __typename: 'Query', evidenceItem?: { __typename: 'EvidenceItem', id: number, name: string, status: EvidenceStatus, valid: boolean, validationErrors: Array<{ __typename: 'FieldValidationError', fieldName: string, error: string }>, submissionEvent: { __typename: 'Event', originatingUser: { __typename: 'User', id: number } }, molecularProfile: { __typename: 'MolecularProfile', id: number, name: string, link: string }, assertions: Array<{ __typename: 'Assertion', id: number, name: string, link: string }>, flags: { __typename: 'FlagConnection', totalCount: number }, revisions: { __typename: 'RevisionConnection', totalCount: number }, comments: { __typename: 'CommentConnection', totalCount: number } } | undefined };

export type EvidenceDetailFieldsFragment = { __typename: 'EvidenceItem', id: number, name: string, status: EvidenceStatus, submissionEvent: { __typename: 'Event', originatingUser: { __typename: 'User', id: number } }, molecularProfile: { __typename: 'MolecularProfile', id: number, name: string, link: string }, assertions: Array<{ __typename: 'Assertion', id: number, name: string, link: string }>, flags: { __typename: 'FlagConnection', totalCount: number }, revisions: { __typename: 'RevisionConnection', totalCount: number }, comments: { __typename: 'CommentConnection', totalCount: number } };
export type EvidenceDetailFieldsFragment = { __typename: 'EvidenceItem', id: number, name: string, status: EvidenceStatus, valid: boolean, validationErrors: Array<{ __typename: 'FieldValidationError', fieldName: string, error: string }>, submissionEvent: { __typename: 'Event', originatingUser: { __typename: 'User', id: number } }, molecularProfile: { __typename: 'MolecularProfile', id: number, name: string, link: string }, assertions: Array<{ __typename: 'Assertion', id: number, name: string, link: string }>, flags: { __typename: 'FlagConnection', totalCount: number }, revisions: { __typename: 'RevisionConnection', totalCount: number }, comments: { __typename: 'CommentConnection', totalCount: number } };

export type EvidenceSummaryQueryVariables = Exact<{
evidenceId: Scalars['Int'];
Expand Down Expand Up @@ -7803,6 +7807,11 @@ export const AssertionDetailFieldsFragmentDoc = gql`
id
name
status
valid
validationErrors {
fieldName
error
}
submissionEvent {
originatingUser {
id
Expand Down Expand Up @@ -7943,6 +7952,11 @@ export const EvidenceDetailFieldsFragmentDoc = gql`
id
name
status
valid
validationErrors {
fieldName
error
}
submissionEvent {
originatingUser {
id
Expand Down
4 changes: 4 additions & 0 deletions client/src/app/generated/server.model.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,8 @@ type Assertion implements Commentable & EventOriginObject & EventSubject & Flagg
status: EvidenceStatus!
submissionEvent: Event!
summary: String!
valid: Boolean!
validationErrors: [FieldValidationError!]!
variantOrigin: VariantOrigin!
}

Expand Down Expand Up @@ -2384,6 +2386,8 @@ type EvidenceItem implements Commentable & EventOriginObject & EventSubject & Fl
source: Source!
status: EvidenceStatus!
submissionEvent: Event!
valid: Boolean!
validationErrors: [FieldValidationError!]!
variant: Variant!
variantHgvs: String!
variantOrigin: VariantOrigin!
Expand Down
80 changes: 80 additions & 0 deletions client/src/app/generated/server.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1886,6 +1886,46 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "valid",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "validationErrors",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "FieldValidationError",
"ofType": null
}
}
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "variantOrigin",
"description": null,
Expand Down Expand Up @@ -11443,6 +11483,46 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "valid",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "validationErrors",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "LIST",
"name": null,
"ofType": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "FieldValidationError",
"ofType": null
}
}
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "variant",
"description": null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,31 @@ query AssertionDetail(
}

fragment AssertionDetailFields on Assertion {
id
name
status
submissionEvent {
originatingUser {
id
}
}
molecularProfile {
id
name
status
valid
validationErrors {
fieldName
error
}
submissionEvent {
originatingUser {
id
name
link
}
flags(state: OPEN) {
totalCount
}
revisions(status: NEW) {
totalCount
}
comments {
totalCount
}
}
molecularProfile {
id
name
link
}
flags(state: OPEN) {
totalCount
}
revisions(status: NEW) {
totalCount
}
comments {
totalCount
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,18 @@
nzMessage="This Assertion has been rejected."
nzType="error">
</nz-alert>
<nz-alert *ngIf="!this.assertion.valid"
nzBanner
[nzMessage]="validationErrorTpl"
nzType="warning">
</nz-alert>
<ng-template #validationErrorTpl>
This Assertion is in an invalid state.
<br/>
<span nzTypographq *ngFor="let error of this.assertion.validationErrors">
<strong>Field</strong>: {{error.fieldName}}. <strong>Error</strong>: {{error.error}}<br/>
</span>
</ng-template>
<cvc-tab-navigation [tabs]="this.tabs$ | ngrxPush">
<ng-template #tabBarExtraContent>
<nz-col id="contributors-col">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ fragment EvidenceDetailFields on EvidenceItem {
id
name
status
valid
validationErrors {
fieldName
error
}
submissionEvent {
originatingUser {
id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@
nzMessage="This Evidence Item has been rejected."
nzType="error">
</nz-alert>
<nz-alert *ngIf="!this.evidence.valid"
nzBanner
[nzMessage]="validationErrorTpl"
nzType="warning">
</nz-alert>
<ng-template #validationErrorTpl>
This Evidence Item is in an invalid state.
<br/>
<span nzTypographq *ngFor="let error of this.evidence.validationErrors">
<strong>Field</strong>: {{error.fieldName}}. <strong>Error</strong>: {{error.error}}<br/>
</span>
</ng-template>
<cvc-tab-navigation [tabs]="this.tabs$ | ngrxPush">
<ng-template #tabBarExtraContent>
<nz-col id="contributors-col">
Expand Down
23 changes: 23 additions & 0 deletions server/app/graphql/types/entities/assertion_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class AssertionType < Types::BaseObject
implements Types::Interfaces::EventOriginObject

field :id, Int, null: false
field :valid, Boolean, null: false
field :validation_errors, [Types::FieldValidationErrorType], null: false
field :name, String, null: false
field :molecular_profile, Types::Entities::MolecularProfileType, null: false
field :clinical_significance, Types::AssertionClinicalSignificanceType, null: false
Expand Down Expand Up @@ -36,6 +38,27 @@ class AssertionType < Types::BaseObject
field :evidence_items, [Types::Entities::EvidenceItemType], null: false
field :evidence_items_count, Integer, null: false

def valid
object.valid?
end

def validation_errors
if !object.valid?
object.errors.map do |attribute, message|
attribute = attribute.to_s
if attribute.ends_with?("_ids")
formatted_attribute = attribute.singularize.humanize.pluralize
else
formatted_attribute = attribute.humanize
end
{ 'field_name': formatted_attribute, 'error': message }
end
else
[]
end
end


def disease
Loaders::RecordLoader.for(Disease).load(object.disease_id)
end
Expand Down
22 changes: 22 additions & 0 deletions server/app/graphql/types/entities/evidence_item_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class EvidenceItemType < Types::BaseObject
implements Types::Interfaces::EventOriginObject

field :id, Int, null: false
field :valid, Boolean, null: false
field :validation_errors, [Types::FieldValidationErrorType], null: false
field :name, String, null: false
field :molecular_profile, Types::Entities::MolecularProfileType, null: false
field :clinical_significance, Types::EvidenceClinicalSignificanceType, null: false
Expand All @@ -31,6 +33,26 @@ class EvidenceItemType < Types::BaseObject
field :rejection_event, Types::Entities::EventType, null: true
field :assertions, [Types::Entities::AssertionType], null: false

def valid
object.valid?
end

def validation_errors
if !object.valid?
object.errors.map do |attribute, message|
attribute = attribute.to_s
if attribute.ends_with?("_ids")
formatted_attribute = attribute.singularize.humanize.pluralize
else
formatted_attribute = attribute.humanize
end
{ 'field_name': formatted_attribute, 'error': message }
end
else
[]
end
end

def disease
Loaders::RecordLoader.for(Disease).load(object.disease_id)
end
Expand Down