Skip to content

Commit

Permalink
Migration to visyn_core (#55)
Browse files Browse the repository at this point in the history
* Migration to visyn_core

* Linting

* Upgrade deps

---------

Co-authored-by: Michael Puehringer <[email protected]>
  • Loading branch information
oltionchampari and puehringer authored Mar 1, 2023
1 parent 234dd2e commit 45937d5
Show file tree
Hide file tree
Showing 16 changed files with 38 additions and 31 deletions.
2 changes: 1 addition & 1 deletion coral/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
###############################################################################
from os import path

from tdp_core.plugin.model import AVisynPlugin, RegHelper
from visyn_core.plugin.model import AVisynPlugin, RegHelper

from .settings import CoralSettings

Expand Down
4 changes: 2 additions & 2 deletions coral/migration/env.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import tdp_core.dbmigration.env
import visyn_core.dbmigration.env

tdp_core.dbmigration.env.run_migrations_online()
visyn_core.dbmigration.env.run_migrations_online()
2 changes: 1 addition & 1 deletion coral/settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pydantic import BaseModel
from tdp_core import manager
from visyn_core import manager


class CoralSettings(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion coral/sql.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging

from flask import Flask, abort, jsonify, request
from tdp_core.security import login_required
from visyn_core.security import login_required

from .settings import get_settings
from .sql_query_mapper import QueryElements
Expand Down
2 changes: 1 addition & 1 deletion coral/sql_query_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from sqlalchemy import create_engine, exc, inspect, text
from sqlalchemy.exc import NoInspectionAvailable
from sqlalchemy.orm import sessionmaker
from tdp_core import manager
from visyn_core import manager

from .settings import get_settings
from .sql_tables import Cohort
Expand Down
8 changes: 4 additions & 4 deletions coral/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import pytest
from fastapi import FastAPI
from fastapi.testclient import TestClient
from tdp_core.security.manager import SecurityManager
from tdp_core.security.model import User
from tdp_core.server.visyn_server import create_visyn_server
from tdp_core.tests.fixtures.postgres_db import postgres_db
from visyn_core.security.manager import SecurityManager
from visyn_core.security.model import User
from visyn_core.server.visyn_server import create_visyn_server
from visyn_core.tests.fixtures.postgres_db import postgres_db

assert postgres_db # silence unused import warning

Expand Down
3 changes: 2 additions & 1 deletion src/Cohort.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { IAllFilters, IDType, IDTypeLike, IDTypeManager, IRow, IServerColumn, UniqueIdManager } from 'tdp_core';
import { IDType, IDTypeLike, IDTypeManager, IRow, IServerColumn } from 'visyn_core';
import { IAllFilters, UniqueIdManager } from 'tdp_core';
import { ElementProvType, ICohort, ICohortRep, IElement, IElementProvJSONCohort, IProvAttrAndValuesCohort } from './CohortInterfaces';
import {
createDBCohort,
Expand Down
2 changes: 1 addition & 1 deletion src/CohortInterfaces.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IDType, IServerColumn } from 'tdp_core';
import { IDType, IServerColumn } from 'visyn_core';
import { Cohort } from './Cohort';
import { IAttribute, IAttributeJSON } from './data/Attribute';
import { IEqualsList, INumRange } from './rest';
Expand Down
17 changes: 9 additions & 8 deletions src/Taskview/SearchBar.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import {select} from 'd3v7';
import {IdTextPair, IServerColumn, RestBaseUtils} from 'tdp_core';
import {dataTypes, depletion, IDataSubtypeConfig, IDataTypeConfig} from 'tdp_publicdb';
import {colors} from '../colors';
import {ScoreType} from '../data/Attribute';
import {checkSpecialAttribute, ISpecialAttribute} from '../data/SpecialAttribute';
import {deepCopy, getAnimatedLoadingText, log} from '../util';
import {niceName} from '../utilLabels';
import { select } from 'd3v7';
import { IServerColumn } from 'visyn_core';
import { IdTextPair, RestBaseUtils } from 'tdp_core';
import { dataTypes, depletion, IDataSubtypeConfig, IDataTypeConfig } from 'tdp_publicdb';
import { colors } from '../colors';
import { ScoreType } from '../data/Attribute';
import { checkSpecialAttribute, ISpecialAttribute } from '../data/SpecialAttribute';
import { deepCopy, getAnimatedLoadingText, log } from '../util';
import { niceName } from '../utilLabels';

export class SearchBar {
private _container: HTMLDivElement;
Expand Down
2 changes: 1 addition & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { select, Selection } from 'd3v7';
import SplitGrid from 'split-grid';
import { IServerColumn } from 'visyn_core';
import {
AppContext,
ATDPApplication,
CLUEGraphManager,
IDatabaseViewDesc,
IObjectRef,
IServerColumn,
ITDPOptions,
NotificationHandler,
ObjectRefUtils,
Expand Down
3 changes: 2 additions & 1 deletion src/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
*/

import { Categories } from 'tdp_publicdb';
import { IServerColumn, ColumnDescUtils, IAdditionalColumnDesc } from 'tdp_core';
import { IServerColumn } from 'visyn_core';
import { ColumnDescUtils, IAdditionalColumnDesc } from 'tdp_core';

/**
* maximal number of rows in which just the subset if fetched instead of all
Expand Down
3 changes: 2 additions & 1 deletion src/common/forms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
*/

import { SpeciesUtils, FormSubtype } from 'tdp_publicdb';
import { FormElementType, IFormElement, IFormSelectOption, ValueCache, RestStorageUtils, LineupUtils, RestBaseUtils, IServerColumn } from 'tdp_core';
import { IServerColumn } from 'visyn_core';
import { FormElementType, IFormElement, IFormSelectOption, ValueCache, RestStorageUtils, LineupUtils, RestBaseUtils } from 'tdp_core';
import { gene, IDataSourceConfig, tissue, cellline, dataSources, dataTypes, dataSubtypes, depletion, drugScreen } from './config';
import { GeneUtils } from './GeneUtils';

Expand Down
8 changes: 4 additions & 4 deletions src/phovea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) The Caleydo Team. All rights reserved.
* Licensed under the new BSD license, available at http://caleydo.org/license
**************************************************************************** */
import { IRegistry } from 'tdp_core';
import type { IRegistry } from 'visyn_core';

export default function (registry: IRegistry) {
// helper functions copied from tdp_core:
Expand All @@ -25,7 +25,7 @@ export default function (registry: IRegistry) {
/**
* Set the base data-set
*/
actionFunction('chtSetDataset', 'setDatasetImpl', () => import('./Provenance/General'), {
actionFunction('chtSetDataset', 'setDatasetImpl', () => import('./Provenance/General.js'), {
// setDatasetImpl = function that acutally sets the dataset
analytics: {
category: 'data', // this one is a data operation (other options are visual, selections, layout, and analysis)
Expand All @@ -39,7 +39,7 @@ export default function (registry: IRegistry) {
/**
* Add Cohorts
*/
actionFunction('addCohorts', 'addOverviewCohortImpl', () => import('./Provenance/CohortEV').then(), {
actionFunction('addCohorts', 'addOverviewCohortImpl', () => import('./Provenance/CohortEV.js').then(), {
//
analytics: {
category: 'data', // this one is a data operation (other options are visual, selections, layout, and analysis)
Expand All @@ -50,7 +50,7 @@ export default function (registry: IRegistry) {
/**
* Remove Cohorts
*/
actionFunction('removeCohorts', 'removeOverviewCohortImpl', () => import('./Provenance/CohortEV').then(), {
actionFunction('removeCohorts', 'removeOverviewCohortImpl', () => import('./Provenance/CohortEV.js').then(), {
//
analytics: {
category: 'data', // this one is a data operation (other options are visual, selections, layout, and analysis)
Expand Down
3 changes: 2 additions & 1 deletion src/phovea_registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
* Licensed under the new BSD license, available at http://caleydo.org/license
**************************************************************************** */

import { PluginRegistry } from 'tdp_core';
import { PluginRegistry } from 'visyn_core';
import reg from './phovea';

/**
* build a registry by registering all phovea modules
*/
// other modules
import 'visyn_core/phovea_registry';
import 'tdp_core/dist/phovea_registry';

// self
Expand Down
3 changes: 2 additions & 1 deletion src/rest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Ajax, AppContext, IParams, IRow } from 'tdp_core';
import { Ajax, AppContext, IRow } from 'visyn_core';
import { IParams } from 'tdp_core';
import { deepCopy, log } from './util';

export interface ICohortDBParams extends IParams {
Expand Down
5 changes: 3 additions & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {select, Selection} from 'd3v7';
import { select, Selection } from 'd3v7';
import * as logger from 'loglevel';
import { NotificationHandler } from 'tdp_core';
import { ICohort } from './CohortInterfaces';
Expand Down Expand Up @@ -32,7 +32,8 @@ export const deepCopy = <T>(target: T): T => {
});
return cp.map((n: any) => deepCopy<any>(n)) as any;
}
if (typeof target === 'object' && target !== {}) {
// not empty object
if (typeof target === 'object' && Object.keys(target).length > 0) {
const cp = { ...(target as { [key: string]: any }) } as { [key: string]: any };
Object.keys(cp).forEach((k) => {
cp[k] = deepCopy<any>(cp[k]);
Expand Down

0 comments on commit 45937d5

Please sign in to comment.