Skip to content
Snippets Groups Projects
Commit 904aa9c3 authored by Tadeusz Miesiąc's avatar Tadeusz Miesiąc
Browse files

Merge branch 'feature/connect-bio-entity-endpoint' into 'development'

Feature/connect bio entity endpoint

See merge request !39
parents 4ef3021f b9f7167d
No related branches found
No related tags found
2 merge requests!223reset the pin numbers before search results are fetch (so the results will be...,!39Feature/connect bio entity endpoint
Pipeline #80184 passed
Showing
with 212 additions and 14 deletions
NEXT_PUBLIC_BASE_API_URL = 'https://corsproxy.io/?https://pdmap.uni.lu/minerva/api' NEXT_PUBLIC_BASE_API_URL = 'https://corsproxy.io/?https://lux1.atcomp.pl/minerva/api'
NEXT_PUBLIC_PROJECT_ID = 'pd_map_winter_23' NEXT_PUBLIC_BASE_NEW_API_URL = 'https://corsproxy.io/?https://lux1.atcomp.pl/minerva/new_api/'
\ No newline at end of file NEXT_PUBLIC_PROJECT_ID = 'pdmap_appu_test'
\ No newline at end of file
export const BASE_API_URL = process.env.NEXT_PUBLIC_BASE_API_URL || ''; export const BASE_API_URL = process.env.NEXT_PUBLIC_BASE_API_URL || '';
export const BASE_NEW_API_URL = process.env.NEXT_PUBLIC_BASE_NEW_API_URL || '';
export const PROJECT_ID = process.env.NEXT_PUBLIC_PROJECT_ID || ''; export const PROJECT_ID = process.env.NEXT_PUBLIC_PROJECT_ID || '';
export const ZOD_SEED = 997; export const ZOD_SEED = 997;
export const BIO_ENTITY = 'bioEntity'; export const BIO_ENTITY = 'bioEntity';
......
import { z } from 'zod';
export const arrowSchema = z.object({
arrowType: z.string(),
angle: z.number(),
lineType: z.string(),
length: z.number(),
});
import { z } from 'zod'; import { z } from 'zod';
import { bioEntitySchema } from './bioEntitySchema';
export const bioEntityContentSchema = z.object({ export const bioEntityContentSchema = z.object({
id: z.number(), bioEntity: bioEntitySchema,
modelId: z.number(), /** indicates if bioEntity matches perfect match even if not provided in query */
type: z.string(), perfect: z.boolean(),
}); });
import { z } from 'zod';
import { bioEntityContentSchema } from './bioEntityContentSchema';
export const bioEntityResponseSchema = z.object({
content: z.array(bioEntityContentSchema),
totalPages: z.number(),
totalElements: z.number(),
numberOfElements: z.number(),
size: z.number(),
number: z.number(),
});
import { z } from 'zod';
import { referenceSchema } from './referenceSchema';
import { glyphSchema } from './glyphSchema';
import { modificationResiduesSchema } from './modificationResiduesSchema';
import { submodelSchema } from './submodelSchema';
import { colorSchema } from './colorSchema';
import { productsSchema } from './products';
import { lineSchema } from './lineSchema';
import { operatorSchema } from './operatorSchema';
import { structuralStateSchema } from './structuralStateSchema';
export const bioEntitySchema = z.object({
id: z.number(),
stringType: z.string(),
name: z.string(),
elementId: z.string(),
model: z.number(),
references: z.array(referenceSchema),
z: z.number(),
notes: z.string(),
symbol: z.string().nullable(),
homodimer: z.number(),
nameX: z.number(),
nameY: z.number(),
nameWidth: z.number(),
nameHeight: z.number(),
nameVerticalAlign: z.string(),
nameHorizontalAlign: z.string(),
width: z.number(),
height: z.number(),
visibilityLevel: z.string(),
transparencyLevel: z.string(),
synonyms: z.array(z.string()),
formerSymbols: z.array(z.string()),
fullName: z.string().nullable(),
abbreviation: z.string().nullable(),
formula: z.string().nullable(),
glyph: glyphSchema.nullable(),
activity: z.boolean(),
structuralState: structuralStateSchema.nullable(),
hypothetical: z.boolean().nullable(),
boundaryCondition: z.boolean(),
constant: z.boolean(),
initialAmount: z.number().nullable(),
initialConcentration: z.number().nullable(),
charge: z.number().nullable(),
substanceUnits: z.string().nullable(),
onlySubstanceUnits: z.boolean(),
modificationResidues: z.optional(z.array(modificationResiduesSchema)),
complex: z.number().nullable(),
compartment: z.number().nullable(),
submodel: submodelSchema.nullable(),
x: z.number(),
y: z.number(),
lineWidth: z.number(),
fontColor: colorSchema,
fontSize: z.number(),
fillColor: colorSchema,
borderColor: colorSchema,
smiles: z.optional(z.string()),
inChI: z.optional(z.string().nullable()),
inChIKey: z.optional(z.string().nullable()),
thickness: z.optional(z.number()),
outerWidth: z.optional(z.number()),
innerWidth: z.optional(z.number()),
idReaction: z.optional(z.string()),
reversible: z.optional(z.boolean()),
mechanicalConfidenceScore: z.optional(z.boolean()),
lowerBound: z.optional(z.boolean()),
upperBound: z.optional(z.boolean()),
subsystem: z.optional(z.string()),
geneProteinReaction: z.optional(z.string()),
kinetics: z.optional(z.null()),
products: z.optional(z.array(productsSchema)),
reactants: z.optional(z.array(productsSchema)),
modifiers: z.optional(z.array(productsSchema)),
processCoordinates: z.optional(z.null()),
line: z.optional(lineSchema),
operators: z.optional(z.array(operatorSchema)),
});
import { z } from 'zod';
export const colorSchema = z.object({
alpha: z.number(),
rgb: z.number(),
});
import { ZOD_SEED } from '@/constants'; import { ZOD_SEED } from '@/constants';
import { bioEntityContentSchema } from '@/models/bioEntityContentSchema'; import { bioEntityContentSchema } from '@/models/bioEntityContentSchema';
import { z } from 'zod';
// eslint-disable-next-line import/no-extraneous-dependencies // eslint-disable-next-line import/no-extraneous-dependencies
import { createFixture } from 'zod-fixture'; import { createFixture } from 'zod-fixture';
import { bioEntityResponseSchema } from '../bioEntityResponseSchema';
export const bioEntityContentsFixture = createFixture(z.array(bioEntityContentSchema), { export const bioEntityResponseFixture = createFixture(bioEntityResponseSchema, {
seed: ZOD_SEED, seed: ZOD_SEED,
array: { min: 2, max: 2 },
}); });
export const bioEntityContentFixture = createFixture(bioEntityContentSchema, { export const bioEntityContentFixture = createFixture(bioEntityContentSchema, {
......
import { z } from 'zod';
export const glyphSchema = z.object({
file: z.number(),
});
import { z } from 'zod';
import { colorSchema } from './colorSchema';
import { segmentSchema } from './segmentSchema';
import { arrowSchema } from './arrowSchema';
export const lineSchema = z.object({
id: z.number(),
width: z.number(),
color: colorSchema,
z: z.number(),
segments: z.array(segmentSchema),
startArrow: arrowSchema,
endArrow: arrowSchema,
lineType: z.string(),
});
...@@ -15,17 +15,17 @@ export const modelSchema = z.object({ ...@@ -15,17 +15,17 @@ export const modelSchema = z.object({
/** size of the png tile used to visualize in frontend */ /** size of the png tile used to visualize in frontend */
tileSize: z.number(), tileSize: z.number(),
/** default x center used in frontend visualization */ /** default x center used in frontend visualization */
defaultCenterX: z.union([z.number(), z.null()]), defaultCenterX: z.number().nullable(),
/** default y center used in frontend visualization */ /** default y center used in frontend visualization */
defaultCenterY: z.union([z.number(), z.null()]), defaultCenterY: z.number().nullable(),
/** default zoom level used in frontend visualization */ /** default zoom level used in frontend visualization */
defaultZoomLevel: z.union([z.number(), z.null()]), defaultZoomLevel: z.number().nullable(),
/** minimum zoom level availbale for the map */ /** minimum zoom level availbale for the map */
minZoom: z.number(), minZoom: z.number(),
/** maximum zoom level available for the map */ /** maximum zoom level available for the map */
maxZoom: z.number(), maxZoom: z.number(),
authors: z.array(authorSchema), authors: z.array(authorSchema),
references: z.array(referenceSchema), references: z.array(referenceSchema),
creationDate: z.union([z.string(), z.null()]), creationDate: z.string().nullable(),
modificationDates: z.array(z.string()), modificationDates: z.array(z.string()),
}); });
import { z } from 'zod';
import { positionSchema } from './positionSchema';
import { colorSchema } from './colorSchema';
export const modificationResiduesSchema = z.object({
id: z.number(),
idModificationResidue: z.string(),
name: z.string(),
position: positionSchema,
z: z.number(),
borderColor: colorSchema,
state: z.union([z.string(), z.number()]).nullable(),
size: z.number(),
elementId: z.string(),
});
import { z } from 'zod';
import { lineSchema } from './lineSchema';
export const operatorSchema = z.object({
id: z.number(),
line: lineSchema,
inputs: z.array(z.object({ id: z.number() })),
outputs: z.undefined(),
operatorText: z.string(),
reactantOperator: z.boolean(),
productOperator: z.boolean(),
modifierOperator: z.boolean(),
});
import { z } from 'zod';
export const positionSchema = z.object({
x: z.number(),
y: z.number(),
});
import { z } from 'zod';
export const productsSchema = z.object({
aliasId: z.number(),
stoichiometry: z.number().nullable(),
type: z.optional(z.string()),
});
...@@ -2,7 +2,7 @@ import { z } from 'zod'; ...@@ -2,7 +2,7 @@ import { z } from 'zod';
import { articleSchema } from './articleSchema'; import { articleSchema } from './articleSchema';
export const referenceSchema = z.object({ export const referenceSchema = z.object({
link: z.string(), link: z.string().nullable(),
article: articleSchema.optional(), article: articleSchema.optional(),
type: z.string(), type: z.string(),
resource: z.string(), resource: z.string(),
......
import { z } from 'zod';
export const segmentSchema = z.object({
x1: z.number(),
y1: z.number(),
x2: z.number(),
y2: z.number(),
});
import { z } from 'zod';
import { positionSchema } from './positionSchema';
import { colorSchema } from './colorSchema';
export const structuralStateSchema = z.object({
value: z.string(),
position: positionSchema,
z: z.number(),
width: z.number(),
height: z.number(),
fontSize: z.number(),
size: z.number(),
center: positionSchema,
borderColor: colorSchema,
elementId: z.string(),
});
import { z } from 'zod';
export const submodelSchema = z.object({
mapId: z.number(),
type: z.string(),
});
...@@ -16,7 +16,7 @@ describe('api path', () => { ...@@ -16,7 +16,7 @@ describe('api path', () => {
it('should return url string for bio entity content', () => { it('should return url string for bio entity content', () => {
expect(apiPath.getBioEntityContentsStringWithQuery('park7')).toBe( expect(apiPath.getBioEntityContentsStringWithQuery('park7')).toBe(
`projects/${PROJECT_ID}/models/*/bioEntities:search?query=park7`, `projects/${PROJECT_ID}/models/*/bioEntities/:search?query=park7&size=1000`,
); );
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment