From e3c687c03797f812d5cf98e6f143e23a7bac4fd8 Mon Sep 17 00:00:00 2001 From: NeuralFlux <40491005+NeuralFlux@users.noreply.github.com> Date: Thu, 15 Aug 2024 17:01:55 -0400 Subject: [PATCH 1/4] fix: removed unnecessary biolink model test --- __test__/biolink_transformers.test.ts | 92 --------------------------- 1 file changed, 92 deletions(-) delete mode 100644 __test__/biolink_transformers.test.ts diff --git a/__test__/biolink_transformers.test.ts b/__test__/biolink_transformers.test.ts deleted file mode 100644 index ca52dfc..0000000 --- a/__test__/biolink_transformers.test.ts +++ /dev/null @@ -1,92 +0,0 @@ -import jq_tf from "../built/transformers/jq_transformer"; -import biolink_tf from "../src/transformers/biolink_transformer"; -import fs from "fs"; -import path from "path"; -import { JSONDoc } from "../src/json_transform/types"; - -describe("test biolink transformer", () => { - let response; - let input; - - beforeEach(() => { - const response_path = path.resolve(__dirname, "./data/biolink/response.json"); - response = JSON.parse(fs.readFileSync(response_path, { encoding: "utf8" })); - const edge_path = path.resolve(__dirname, "./data/biolink/edge.json"); - const edge = JSON.parse(fs.readFileSync(edge_path, { encoding: "utf8" })); - input = { - response, - edge, - }; - }); - - test("test biolink wrapper", async () => { - const tf = new jq_tf(input, { type: "biolink" }); - const res = await tf.wrap(response); - expect(res.associations[0].object.HGNC).toBe("10956"); - expect(res.associations[0].publications[0].id).toBe("21685912"); - expect(res.associations[1]).not.toHaveProperty("publications"); - expect(res.associations[1]).not.toHaveProperty("provided_by"); - }); - - test("test biolink wrapper if no association field as root key", async () => { - const tf = new jq_tf(input, { type: "biolink" }); - const res = await tf.wrap({ data: [] }); - expect(res).toEqual({ data: [] }); - }); - - test("test biolink wrapper if no object id should be prefixed", async () => { - const tf = new jq_tf(input, { type: "biolink" }); - const res = await tf.wrap({ - associations: [ - { - object: { - id: "MONDO:12345", - }, - }, - ], - }); - expect(res.associations[0].object.MONDO).toEqual("MONDO:12345"); - }); - - test("test biolink wrapper if no object field present", async () => { - const tf = new jq_tf(input, { type: "biolink" }); - const fake_response = { - associations: [ - { - object1: { - id: "MONDO:12345", - }, - }, - ], - }; - const res = await tf.wrap(fake_response); - expect(res).toEqual(fake_response); - }); - - test("test biolink wrapper if no object.id field present", async () => { - const tf = new jq_tf(input, { type: "biolink" }); - const fake_response = { - associations: [ - { - object: { - id1: "MONDO:12345", - }, - }, - ], - }; - const res = await tf.wrap(fake_response); - expect(res).toEqual(fake_response); - }); - - test("test biolink jsonTransform function", async () => { - const tf = new jq_tf(input, { type: "biolink" }); - const wrapped_response = await tf.wrap(response); - const res: JSONDoc = tf.jsonTransform(wrapped_response); - expect(res).toHaveProperty("related_to"); - expect(res.related_to[0].HGNC).toEqual("10956"); - expect(res.related_to[0].pubmed[0]).toEqual("21685912"); - expect(res.related_to[0].relation).toEqual("contributes to condition"); - expect(res.related_to[0].source[0]).toEqual("https://archive.monarchinitiative.org/#gwascatalog"); - expect(res.related_to[0].taxid).toEqual("NCBITaxon:9606"); - }); -}); From 4e776db35acf3489d8923089419cc760a4494bd4 Mon Sep 17 00:00:00 2001 From: NeuralFlux <40491005+NeuralFlux@users.noreply.github.com> Date: Thu, 15 Aug 2024 17:22:07 -0400 Subject: [PATCH 2/4] fix: update GitHub workflow to switch to main branch by default --- .github/workflows/test_ws_codecov.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_ws_codecov.yml b/.github/workflows/test_ws_codecov.yml index 4c27281..0b0b379 100644 --- a/.github/workflows/test_ws_codecov.yml +++ b/.github/workflows/test_ws_codecov.yml @@ -13,11 +13,21 @@ jobs: id: branch-name uses: tj-actions/branch-names@v7.0.7 - - uses: actions/checkout@v3 + - name: Checkout to specific branch + uses: actions/checkout@v3 + id: specific-checkout + continue-on-error: true with: repository: biothings/biothings_explorer ref: ${{ steps.branch-name.outputs.current_branch }} + - name: Checkout to main if above failed + if: steps.specific-checkout.outcome == 'failure' + uses: actions/checkout@v3 + with: + repository: biothings/biothings_explorer + ref: main + - name: Use Node.js 18.x uses: actions/setup-node@v3 with: From bbaa0f84773a931964c09d7decc3764cc1a3a7c5 Mon Sep 17 00:00:00 2001 From: NeuralFlux <40491005+NeuralFlux@users.noreply.github.com> Date: Fri, 16 Aug 2024 12:43:08 -0400 Subject: [PATCH 3/4] fix: add default infores for apiInforesCurie --- src/record.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/record.ts b/src/record.ts index d9c2d2d..2c2232c 100644 --- a/src/record.ts +++ b/src/record.ts @@ -497,9 +497,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 { From 4466341dd9ff38f22e10bb2925d6fdf9c4b317fa Mon Sep 17 00:00:00 2001 From: tokebe <43009413+tokebe@users.noreply.github.com> Date: Fri, 6 Sep 2024 12:22:10 -0400 Subject: [PATCH 4/4] use KL/AT in record hash --- src/record.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/record.ts b/src/record.ts index 2c2232c..8450b2b 100644 --- a/src/record.ts +++ b/src/record.ts @@ -455,6 +455,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("-"); }