Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into retriever-backport
  • Loading branch information
rjawesome committed Sep 20, 2024
2 parents 1dfd7a9 + 69a3023 commit 710d5bc
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 27 deletions.
8 changes: 4 additions & 4 deletions deploy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ affinity:
topologyKey: "kubernetes.io/hostname"
resources:
requests:
memory: 50Gi
cpu: 10000m
memory: 25Gi
cpu: 8000m
limits:
memory: 58Gi
cpu: 14000m
memory: 35Gi
cpu: 10000m
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@
"@sentry/node": "^7.74.1",
"@sentry/profiling-node": "^1.2.1",
"axios": "^0.28.0",
"body-parser": "^1.20.2",
"body-parser": "^1.20.3",
"bull": "^4.11.4",
"compression": "^1.7.4",
"connect-history-api-fallback": "^2.0.0",
"cors": "^2.8.5",
"debug": "^4.3.4",
"dotenv": "^8.6.0",
"express": "^4.18.2",
"express": "^4.20.0",
"express-rate-limit": "^5.5.1",
"express-winston": "^4.2.0",
"helmet": "^4.6.0",
Expand Down
17 changes: 17 additions & 0 deletions packages/types/src/exceptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,21 @@ export class InvalidQueryGraphError extends Error {
this.message = message;
this.statusCode = 400;
}
}

export class NotImplementedError extends Error {
statusCode: number;
constructor(message = 'Feature not implemented', ...params: string[]) {
super(...params);

Object.setPrototypeOf(this, NotImplementedError.prototype);

if (Error.captureStackTrace) {
Error.captureStackTrace(this, NotImplementedError);
}

this.name = 'NotImplementedError';
this.message = message;
this.statusCode = 501;
}
}
26 changes: 23 additions & 3 deletions packages/types/src/query_graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import QNode from "./query_node";
import { resolveSRI } from "biomedical_id_resolver";
import _ from "lodash";
import * as utils from "@biothings-explorer/utils";
import { NotImplementedError } from "./exceptions";

const debug = Debug("bte:query_graph");

Expand All @@ -18,9 +19,11 @@ export default class QueryGraph {
logs: StampedLog[];
nodes: { [QNodeID: string]: QNode };
edges: { [QEdgeID: string]: QEdge };
constructor(queryGraph: TrapiQueryGraph, schema: any) {
skipCycleDetection: boolean;
constructor(queryGraph: TrapiQueryGraph, schema: any, skipCycleDetection = false) {
this.queryGraph = queryGraph;
this.schema = schema;
this.skipCycleDetection = skipCycleDetection;
this.logs = [];
}

Expand Down Expand Up @@ -110,7 +113,7 @@ export default class QueryGraph {
}

for (const firstNode in nodes) {
if (nodes[firstNode].visited === true) continue;
if (nodes[firstNode].visited == true) continue;
const stack: { curNode: string; parent: string | number }[] = [
{ curNode: firstNode, parent: -1 },
];
Expand Down Expand Up @@ -206,6 +209,14 @@ export default class QueryGraph {
}
});
}

_validateNoMCQ(queryGraph: TrapiQueryGraph): boolean {
return Object.values(queryGraph.nodes).some((node) => {
if (node.set_interpretation && node.set_interpretation.toLowerCase() === 'many') {
throw new NotImplementedError('NotImplementedError', 'Set interpretation is not yet implemented.')
}
})
}

_validate(queryGraph: TrapiQueryGraph): void {
this._validateEmptyEdges(queryGraph);
Expand All @@ -216,8 +227,9 @@ export default class QueryGraph {
this._validateNodeProperties(queryGraph);
this._validateEdgeProperties(queryGraph);
this._validateBatchSize(queryGraph);
this._validateCycles(queryGraph);
!this.skipCycleDetection && this._validateCycles(queryGraph);
this._validateNoDuplicateQualifierTypes(queryGraph);
this._validateNoMCQ(queryGraph);
}

private async _findNodeCategories(curies: string[]): Promise<string[]> {
Expand Down Expand Up @@ -413,6 +425,14 @@ export default class QueryGraph {
) {
nodes[qNodeID].categories.push("biolink:Gene");
}
if (
nodes[qNodeID].categories.includes('biolink:Gene') &&
!nodes[qNodeID].categories.includes('biolink:Protein')
) {
nodes[qNodeID].categories.push('biolink:Protein');
}
// Ensure categories are rolled into expandedCategories
nodes[qNodeID].expandCategories()
}
}
this.logs.push(
Expand Down
6 changes: 4 additions & 2 deletions packages/types/src/record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,8 @@ export class Record {
sourceA.resource_id.localeCompare(sourceB.resource_id),
).map(source => _.omit(source, ["source_record_urls"])),
),
this.knowledge_level,
this.agent_type
].join("-");
}

Expand Down Expand Up @@ -511,9 +513,9 @@ export class Record {

get apiInforesCurie(): string {
if (this.association["x-translator"]) {
return this.association["x-translator"]["infores"] || undefined;
return this.association["x-translator"]["infores"] || "infores:error-not-provided";
}
return undefined;
return "infores:error-not-provided";
}

get metaEdgeSource(): string {
Expand Down
6 changes: 3 additions & 3 deletions packages/types/src/trapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ export interface TrapiAttributeConstraint {
export interface TrapiNodeBinding {
id: string;
query_id?: string;
attributes?: TrapiAttribute[];
attributes: TrapiAttribute[];
}

export interface TrapiEdgeBinding {
id: string;
attributes?: TrapiAttribute[];
attributes: TrapiAttribute[];
}

export interface TrapiAnalysis {
Expand All @@ -118,7 +118,7 @@ export interface TrapiAnalysis {

export interface TrapiAuxiliaryGraph {
edges: string[];
attributes?: TrapiAttribute[];
attributes: TrapiAttribute[];
}

export interface TrapiPfocrFigure {
Expand Down
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions prod_revisions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
> @biothings-explorer/[email protected] get_rev /Users/jcallaghan/Projects/bte-main
> ./scripts/get_rev.sh

# Generated from "pnpm run get_rev" on Fri Aug 30 12:53:17 EDT 2024
https://github.com/biothings/bte-server.git cdb1b8e cdb1b8e2b7fea8c83852db3542de91c03ca7626f
https://github.com/biothings/api-respone-transform.js.git f5831b9 f5831b9c54ab974f08c2fb476a61c0e1e4629ebb
https://github.com/biothings/call-apis.js.git 4c59a93 4c59a930a10024e928e6deffa09725551b9579a3
# Generated from "pnpm run get_rev" on Fri Sep 20 12:30:17 EDT 2024
https://github.com/biothings/bte-server.git b1b8d91 b1b8d91bda0d52bffc6b56b69c86d46843cd2058
https://github.com/biothings/api-respone-transform.js.git 13c306d 13c306d2accc288d99ade65cb684244498e75013
https://github.com/biothings/call-apis.js.git 273b866 273b866273056e9e43ab057c25e76758bfa23944
https://github.com/biothings/smartapi-kg.js.git a328307 a3283077e18145d1865e4a9ba57ef56846d19264
https://github.com/biothings/bte_trapi_query_graph_handler.git 265360d 265360def22d267d8a621cc4bacd786852e4bcc5
https://github.com/biothings/bte_trapi_query_graph_handler.git 9bc677d 9bc677dc02ef030bb7debd94b57f0f1f9e38cb7f
https://github.com/biothings/node-expansion.git d140a26 d140a264e96d71fc20da90891bd37c4f4d0e06a8
https://github.com/biothings/biolink-model.js.git 24b8192 24b81923c99269185f39b7d5bee02239931a0f1b
https://github.com/biothings/biomedical_id_resolver.js.git 8c1f094 8c1f094d7525fb1ddc6502a379ae2e23f9dbfbe5
https://github.com/biothings/bte-utils.git 84708cf 84708cf8bd138ee85b11fdc4564d5faac1f31539
https://github.com/biothings/bte-utils.git 0e577b6 0e577b6a96a62ada3e393d2d8cddd0b4f6e42c69

0 comments on commit 710d5bc

Please sign in to comment.