Skip to content

Commit

Permalink
Merge pull request #1074 from ldhtnp/issue/1073
Browse files Browse the repository at this point in the history
Added a materialized view for the organizations table
  • Loading branch information
acoffman authored Jul 23, 2024
2 parents 850ca2a + 68f6cc4 commit 99a6ffb
Show file tree
Hide file tree
Showing 14 changed files with 645 additions and 265 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,26 @@
[nzSortFn]="true">
Organization
</th>
<th nzWidth="100px">Members</th>
<th
nzWidth="100px"
[nzColumnKey]="sortColumns.MemberCount"
[nzSortFn]="true">
Members
</th>
<th nzWidth="320px">Sub Organizations</th>
<th
nzWidth="80px"
nzRight
[nzColumnKey]="sortColumns.ActivityCount"
[nzSortFn]="true"
nzAlign="right">
Actions
</th>
<th
nzWidth="125px"
nzRight
[nzColumnKey]="sortColumns.MostRecentActivityTimestamp"
[nzSortFn]="true"
nzAlign="right">
Last Action
</th>
Expand Down Expand Up @@ -97,13 +106,13 @@
<cvc-tag-overflow
[maxDisplayCount]="1"
tagType="organization"
[tags]="organization.subGroups">
[tags]="organization.childOrganizations">
</cvc-tag-overflow>
</td>
<td
nzRight
nzAlign="right">
{{ organization.eventCount | number }}
{{ organization.activityCount | number }}
</td>
<td
nzRight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { ScrollEvent } from '@app/directives/table-scroll/table-scroll.directive
import {
Maybe,
OrganizationBrowseTableRowFieldsFragment,
OrganizationConnection,
BrowseOrganizationConnection,
OrganizationsBrowseGQL,
OrganizationsBrowseQuery,
OrganizationsBrowseQueryVariables,
Expand Down Expand Up @@ -70,7 +70,7 @@ export class CvcOrganizationsTableComponent implements OnInit {
OrganizationsBrowseQueryVariables
>
result$!: Observable<ApolloQueryResult<OrganizationsBrowseQuery>>
connection$!: Observable<OrganizationConnection>
connection$!: Observable<BrowseOrganizationConnection>

// PRESENTATION STREAMS
pageInfo$!: Observable<PageInfo>
Expand Down Expand Up @@ -126,7 +126,7 @@ export class CvcOrganizationsTableComponent implements OnInit {
this.connection$ = this.result$.pipe(
pluck('data', 'organizations'),
filter(isNonNulled)
) as Observable<OrganizationConnection>
) as Observable<BrowseOrganizationConnection>

// entity row nodes
this.row$ = this.connection$.pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ query OrganizationsBrowse(
}
}

fragment OrganizationBrowseTableRowFields on Organization {
fragment OrganizationBrowseTableRowFields on BrowseOrganization {
id
name
description
# profileImagePath(size: 256) @include(if: $cardView)
url
memberCount
eventCount
subGroups {
name
activityCount
mostRecentActivityTimestamp
childOrganizations {
id
name
}
mostRecentActivityTimestamp
# profileImagePath(size: 256) @include(if: $cardView)
# orgStatsHash @include(if: $cardView) {
# comments
# revisions
Expand Down
62 changes: 41 additions & 21 deletions client/src/app/generated/civic.apollo-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,35 @@ export type BrowseMolecularProfileEdgeFieldPolicy = {
cursor?: FieldPolicy<any> | FieldReadFunction<any>,
node?: FieldPolicy<any> | FieldReadFunction<any>
};
export type BrowseOrganizationKeySpecifier = ('activityCount' | 'childOrganizations' | 'createdAt' | 'description' | 'id' | 'memberCount' | 'mostRecentActivityTimestamp' | 'name' | 'parentId' | 'updatedAt' | 'url' | BrowseOrganizationKeySpecifier)[];
export type BrowseOrganizationFieldPolicy = {
activityCount?: FieldPolicy<any> | FieldReadFunction<any>,
childOrganizations?: FieldPolicy<any> | FieldReadFunction<any>,
createdAt?: FieldPolicy<any> | FieldReadFunction<any>,
description?: FieldPolicy<any> | FieldReadFunction<any>,
id?: FieldPolicy<any> | FieldReadFunction<any>,
memberCount?: FieldPolicy<any> | FieldReadFunction<any>,
mostRecentActivityTimestamp?: FieldPolicy<any> | FieldReadFunction<any>,
name?: FieldPolicy<any> | FieldReadFunction<any>,
parentId?: FieldPolicy<any> | FieldReadFunction<any>,
updatedAt?: FieldPolicy<any> | FieldReadFunction<any>,
url?: FieldPolicy<any> | FieldReadFunction<any>
};
export type BrowseOrganizationConnectionKeySpecifier = ('edges' | 'filteredCount' | 'lastUpdated' | 'nodes' | 'pageCount' | 'pageInfo' | 'totalCount' | BrowseOrganizationConnectionKeySpecifier)[];
export type BrowseOrganizationConnectionFieldPolicy = {
edges?: FieldPolicy<any> | FieldReadFunction<any>,
filteredCount?: FieldPolicy<any> | FieldReadFunction<any>,
lastUpdated?: FieldPolicy<any> | FieldReadFunction<any>,
nodes?: FieldPolicy<any> | FieldReadFunction<any>,
pageCount?: FieldPolicy<any> | FieldReadFunction<any>,
pageInfo?: FieldPolicy<any> | FieldReadFunction<any>,
totalCount?: FieldPolicy<any> | FieldReadFunction<any>
};
export type BrowseOrganizationEdgeKeySpecifier = ('cursor' | 'node' | BrowseOrganizationEdgeKeySpecifier)[];
export type BrowseOrganizationEdgeFieldPolicy = {
cursor?: FieldPolicy<any> | FieldReadFunction<any>,
node?: FieldPolicy<any> | FieldReadFunction<any>
};
export type BrowsePhenotypeKeySpecifier = ('assertionCount' | 'evidenceCount' | 'hpoId' | 'id' | 'link' | 'name' | 'url' | BrowsePhenotypeKeySpecifier)[];
export type BrowsePhenotypeFieldPolicy = {
assertionCount?: FieldPolicy<any> | FieldReadFunction<any>,
Expand Down Expand Up @@ -1576,19 +1605,6 @@ export type OrganizationFieldPolicy = {
subGroups?: FieldPolicy<any> | FieldReadFunction<any>,
url?: FieldPolicy<any> | FieldReadFunction<any>
};
export type OrganizationConnectionKeySpecifier = ('edges' | 'nodes' | 'pageCount' | 'pageInfo' | 'totalCount' | OrganizationConnectionKeySpecifier)[];
export type OrganizationConnectionFieldPolicy = {
edges?: FieldPolicy<any> | FieldReadFunction<any>,
nodes?: FieldPolicy<any> | FieldReadFunction<any>,
pageCount?: FieldPolicy<any> | FieldReadFunction<any>,
pageInfo?: FieldPolicy<any> | FieldReadFunction<any>,
totalCount?: FieldPolicy<any> | FieldReadFunction<any>
};
export type OrganizationEdgeKeySpecifier = ('cursor' | 'node' | OrganizationEdgeKeySpecifier)[];
export type OrganizationEdgeFieldPolicy = {
cursor?: FieldPolicy<any> | FieldReadFunction<any>,
node?: FieldPolicy<any> | FieldReadFunction<any>
};
export type OrganizationLeaderboardsKeySpecifier = ('commentsLeaderboard' | 'moderationLeaderboard' | 'revisionsLeaderboard' | 'submissionsLeaderboard' | OrganizationLeaderboardsKeySpecifier)[];
export type OrganizationLeaderboardsFieldPolicy = {
commentsLeaderboard?: FieldPolicy<any> | FieldReadFunction<any>,
Expand Down Expand Up @@ -2424,6 +2440,18 @@ export type StrictTypedTypePolicies = {
keyFields?: false | BrowseMolecularProfileEdgeKeySpecifier | (() => undefined | BrowseMolecularProfileEdgeKeySpecifier),
fields?: BrowseMolecularProfileEdgeFieldPolicy,
},
BrowseOrganization?: Omit<TypePolicy, "fields" | "keyFields"> & {
keyFields?: false | BrowseOrganizationKeySpecifier | (() => undefined | BrowseOrganizationKeySpecifier),
fields?: BrowseOrganizationFieldPolicy,
},
BrowseOrganizationConnection?: Omit<TypePolicy, "fields" | "keyFields"> & {
keyFields?: false | BrowseOrganizationConnectionKeySpecifier | (() => undefined | BrowseOrganizationConnectionKeySpecifier),
fields?: BrowseOrganizationConnectionFieldPolicy,
},
BrowseOrganizationEdge?: Omit<TypePolicy, "fields" | "keyFields"> & {
keyFields?: false | BrowseOrganizationEdgeKeySpecifier | (() => undefined | BrowseOrganizationEdgeKeySpecifier),
fields?: BrowseOrganizationEdgeFieldPolicy,
},
BrowsePhenotype?: Omit<TypePolicy, "fields" | "keyFields"> & {
keyFields?: false | BrowsePhenotypeKeySpecifier | (() => undefined | BrowsePhenotypeKeySpecifier),
fields?: BrowsePhenotypeFieldPolicy,
Expand Down Expand Up @@ -2928,14 +2956,6 @@ export type StrictTypedTypePolicies = {
keyFields?: false | OrganizationKeySpecifier | (() => undefined | OrganizationKeySpecifier),
fields?: OrganizationFieldPolicy,
},
OrganizationConnection?: Omit<TypePolicy, "fields" | "keyFields"> & {
keyFields?: false | OrganizationConnectionKeySpecifier | (() => undefined | OrganizationConnectionKeySpecifier),
fields?: OrganizationConnectionFieldPolicy,
},
OrganizationEdge?: Omit<TypePolicy, "fields" | "keyFields"> & {
keyFields?: false | OrganizationEdgeKeySpecifier | (() => undefined | OrganizationEdgeKeySpecifier),
fields?: OrganizationEdgeFieldPolicy,
},
OrganizationLeaderboards?: Omit<TypePolicy, "fields" | "keyFields"> & {
keyFields?: false | OrganizationLeaderboardsKeySpecifier | (() => undefined | OrganizationLeaderboardsKeySpecifier),
fields?: OrganizationLeaderboardsFieldPolicy,
Expand Down
86 changes: 54 additions & 32 deletions client/src/app/generated/civic.apollo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,49 @@ export type BrowseMolecularProfileEdge = {
node?: Maybe<BrowseMolecularProfile>;
};

export type BrowseOrganization = {
__typename: 'BrowseOrganization';
activityCount: Scalars['Int'];
childOrganizations: Array<Organization>;
createdAt?: Maybe<Scalars['ISO8601DateTime']>;
description: Scalars['String'];
id: Scalars['Int'];
memberCount: Scalars['Int'];
mostRecentActivityTimestamp?: Maybe<Scalars['ISO8601DateTime']>;
name: Scalars['String'];
parentId?: Maybe<Scalars['Int']>;
updatedAt?: Maybe<Scalars['ISO8601DateTime']>;
url: Scalars['String'];
};

/** The connection type for BrowseOrganization. */
export type BrowseOrganizationConnection = {
__typename: 'BrowseOrganizationConnection';
/** A list of edges. */
edges: Array<BrowseOrganizationEdge>;
/** The total number of records in this set. */
filteredCount: Scalars['Int'];
/** The last time the data in this browse table was refreshed */
lastUpdated: Scalars['ISO8601DateTime'];
/** A list of nodes. */
nodes: Array<BrowseOrganization>;
/** Total number of pages, based on filtered count and pagesize. */
pageCount: Scalars['Int'];
/** Information to aid in pagination. */
pageInfo: PageInfo;
/** The total number of records of this type, regardless of any filtering. */
totalCount: Scalars['Int'];
};

/** An edge in a connection. */
export type BrowseOrganizationEdge = {
__typename: 'BrowseOrganizationEdge';
/** A cursor for use in pagination. */
cursor: Scalars['String'];
/** The item at the end of the edge. */
node?: Maybe<BrowseOrganization>;
};

export type BrowsePhenotype = {
__typename: 'BrowsePhenotype';
assertionCount: Scalars['Int'];
Expand Down Expand Up @@ -4008,30 +4051,6 @@ export type OrganizationProfileImagePathArgs = {
size?: InputMaybe<Scalars['Int']>;
};

/** The connection type for Organization. */
export type OrganizationConnection = {
__typename: 'OrganizationConnection';
/** A list of edges. */
edges: Array<OrganizationEdge>;
/** A list of nodes. */
nodes: Array<Organization>;
/** Total number of pages, based on filtered count and pagesize. */
pageCount: Scalars['Int'];
/** Information to aid in pagination. */
pageInfo: PageInfo;
/** The total number of records in this filtered collection. */
totalCount: Scalars['Int'];
};

/** An edge in a connection. */
export type OrganizationEdge = {
__typename: 'OrganizationEdge';
/** A cursor for use in pagination. */
cursor: Scalars['String'];
/** The item at the end of the edge. */
node?: Maybe<Organization>;
};

/** Filter on organization id and whether or not to include the organization's subgroups */
export type OrganizationFilter = {
/** The organization ID. */
Expand Down Expand Up @@ -4098,7 +4117,10 @@ export type OrganizationSort = {
};

export enum OrganizationSortColumns {
ActivityCount = 'ACTIVITY_COUNT',
Id = 'ID',
MemberCount = 'MEMBER_COUNT',
MostRecentActivityTimestamp = 'MOST_RECENT_ACTIVITY_TIMESTAMP',
Name = 'NAME'
}

Expand Down Expand Up @@ -4230,7 +4252,7 @@ export type Query = {
organization?: Maybe<Organization>;
organizationLeaderboards: OrganizationLeaderboards;
/** List and filter organizations. */
organizations: OrganizationConnection;
organizations: BrowseOrganizationConnection;
/** Find a phenotype by CIViC ID */
phenotype?: Maybe<Phenotype>;
/** Retrieve popover fields for a specific phenotype. */
Expand Down Expand Up @@ -7302,9 +7324,9 @@ export type OrganizationsBrowseQueryVariables = Exact<{
}>;


export type OrganizationsBrowseQuery = { __typename: 'Query', organizations: { __typename: 'OrganizationConnection', totalCount: number, pageInfo: { __typename: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | undefined, endCursor?: string | undefined }, edges: Array<{ __typename: 'OrganizationEdge', cursor: string, node?: { __typename: 'Organization', id: number, name: string, description: string, url: string, memberCount: number, eventCount: number, mostRecentActivityTimestamp?: any | undefined, subGroups: Array<{ __typename: 'Organization', name: string, id: number }> } | undefined }> } };
export type OrganizationsBrowseQuery = { __typename: 'Query', organizations: { __typename: 'BrowseOrganizationConnection', totalCount: number, pageInfo: { __typename: 'PageInfo', hasNextPage: boolean, hasPreviousPage: boolean, startCursor?: string | undefined, endCursor?: string | undefined }, edges: Array<{ __typename: 'BrowseOrganizationEdge', cursor: string, node?: { __typename: 'BrowseOrganization', id: number, name: string, description: string, url: string, memberCount: number, activityCount: number, mostRecentActivityTimestamp?: any | undefined, childOrganizations: Array<{ __typename: 'Organization', id: number, name: string }> } | undefined }> } };

export type OrganizationBrowseTableRowFieldsFragment = { __typename: 'Organization', id: number, name: string, description: string, url: string, memberCount: number, eventCount: number, mostRecentActivityTimestamp?: any | undefined, subGroups: Array<{ __typename: 'Organization', name: string, id: number }> };
export type OrganizationBrowseTableRowFieldsFragment = { __typename: 'BrowseOrganization', id: number, name: string, description: string, url: string, memberCount: number, activityCount: number, mostRecentActivityTimestamp?: any | undefined, childOrganizations: Array<{ __typename: 'Organization', id: number, name: string }> };

export type PhenotypePopoverQueryVariables = Exact<{
phenotypeId: Scalars['Int'];
Expand Down Expand Up @@ -9607,18 +9629,18 @@ export const OrgPopoverFragmentDoc = gql`
}
`;
export const OrganizationBrowseTableRowFieldsFragmentDoc = gql`
fragment OrganizationBrowseTableRowFields on Organization {
fragment OrganizationBrowseTableRowFields on BrowseOrganization {
id
name
description
url
memberCount
eventCount
subGroups {
name
activityCount
mostRecentActivityTimestamp
childOrganizations {
id
name
}
mostRecentActivityTimestamp
}
`;
export const PhenotypeBrowseTableRowFieldsFragmentDoc = gql`
Expand Down
Loading

0 comments on commit 99a6ffb

Please sign in to comment.