aboutsummaryrefslogtreecommitdiff
path: root/gn3/settings.py
AgeCommit message (Collapse)Author
2024-01-03fix fetch token error from curent appAlexander_Kabui
2024-01-03fetch auth token from current appAlexander_Kabui
2023-12-22Feature/gn llms (#140)Alexander Kabui
* add entry route for gn_llms * add gn_llms reference doc ids * init authorization module for gn-llm * Add class for parsing unprocessable response * add init config file * add clienmodule:gn-llm fahamu interface * Add module descriptor for client file * reponse data handler * add response file handler * add processing file * remove unnecessary files * init code refactoring * Restructure code to module * refactor code:disble pylint for testing on cd
2023-10-10Do authorisation checks for relevant functionsFrederick Muriuki Muriithi
Add a `required_access(...)` function to be used to check that the user has the appropriate privileges to act on the case attributes.
2023-10-06Settings: Add note to discourage importing directly from defaultsFrederick Muriuki Muriithi
2023-06-07auth: Remove "migrate-data" scope.Frederick Muriuki Muriithi
Scope is superceded by CLI utility script.
2023-06-07auth: Remove obsoleted scopeFrederick Muriuki Muriithi
2023-05-29auth: Enable registration of OAuth2 clientsFrederick Muriuki Muriithi
Add UI and code to enable the administrative user to register new OAuth2 clients that can access the API server.
2023-04-17Fix typo, os.environment -> os.environMunyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-04-17Update the default SPARQL endpointMunyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-03-09auth: data migration: Data migration outlineFrederick Muriuki Muriithi
Provide an outline of the data migration steps to be taken from some results of the experiments with the data in redis.
2023-03-09auth: introspection: Protect introspection endpointFrederick Muriuki Muriithi
The introspection endpoint could contain privileged information, thus requires that the endpoint be protected. This commit ensures that a user has authenticated to the system and that the client they are using be one of the allowed clients.
2023-03-01Fetch sampledataMunyoki Kilyungi
* gn3/api/sampledata.py (get_sampledata): New end-point. * gn3/app.py: Register above end-point. * gn3/settings.py: Add new conf variable for LMDB. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2022-12-22tests: Setup environment variables and configsFrederick Muriuki Muriithi
* gn3/settings.py: leave `OAUTH2_ACCESS_TOKEN_GENERATOR` in its default setting * tests/unit/auth/fixtures/oauth2_client_fixtures.py: setup `AUTHLIB_INSECURE_TRANSPORT` before running the OAuth2 tests * tests/unit/conftest.py: setup the test application's configuration correctly for the tests.
2022-12-22auth: implement OAuth2 flow.oauth2_auth_flowFrederick Muriuki Muriithi
Add code to implement the OAuth2 flow. * Add test fixtures for setting up users and OAuth2 clients * Add tests for token generation with the "Password Grant" flow * Fix some issues with test due to changes in the database connection's row_factory
2022-11-08Tests: Generalise testing 'CREATE TABLE' migrationsFrederick Muriuki Muriithi
* gn3/settings.py: Omit trailing slash * tests/unit/auth/test_create_table_migrations.py: Generalise testing migrations that create tables. * tests/unit/auth/test_create_user_credentials_table.py: delete * tests/unit/auth/test_migration_create_users_table.py: delete
2022-11-08Settings: Provide default `AUTH_DB` setting.Frederick Muriuki Muriithi
2022-11-03Add credentials checkingFrederick Muriuki Muriithi
* gn3/auth/authentication.py: new function `credentials_in_database` * gn3/auth/authentication/__init__.py: replace package with module * gn3/settings.py: new `AUTH_MIGRATIONS` configuration variable * migrations/auth/20221103_02_sGrIs-create-user-credentials-table.py: new migration * tests/unit/auth/test_credentials.py: test the `credentials_in_database` function * tests/unit/conftest.py: more test fixtures
2022-10-26Add xapian database connection context manager.Arun Isaac
* gn3/settings.py (XAPIAN_DB_PATH): New variable. * gn3/db_utils.py: Import xapian and XAPIAN_DB_PATH from gn3.settings. (xapian_database): New function.
2022-07-22import rust_correlation when running gn3 as libAlexander_Kabui
2022-07-11Allow CORS everywhere by defaultFrederick Muriuki Muriithi
Allow the resources (endpoints) to be accessible from anywhere on the internet by default, while still allowing for restriction via CLI environment variable on a case by case basis.
2022-06-29new variable: CORRELATION_COMMANDAlexander
2022-02-21Fix a myriad of linter issuesFrederick Muriuki Muriithi
* Use `with` in place of plain `open` * Use f-strings in place of `str.format()` * Remove string interpolation from queries - provide data as query parameters * other minor fixes
2022-02-08Use multiprocessing to speed up computationFrederick Muriuki Muriithi
This commit refactors the code to make it possible to use multiprocessing to speed up the computation of the partial correlations. The major refactor is to move the `__compute_trait_info__` function to the top-level of the module, and provide to it all the other necessary context via the new args.
2021-12-02Implement dataset metadata API endpoint.Arun Isaac
* guix.scm: Import (gnu packages rdf). (genenetwork3)[propagated-inputs]: Add python-sparqlwrapper. * gn3/settings.py (SPARQL_ENDPOINT): New variable. * gn3/api/general.py: Import datasets from gn3.db. (dataset_metadata): New API endpoint. * gn3/db/datasets.py: Import re, Template from string, Dict and Optional from typing, JSON and SPARQLWrapper from SPARQLWrapper, SPARQL_ENDPOINT from gn3.settings. (sparql_query, dataset_metadata): New functions.
2021-11-20Merge pull request #56 from genenetwork/partial-correlationsMuriithi Frederick Muriuki
Partial correlations
2021-11-16Remove sqlalchemy.Arun Isaac
* gn3/settings.py (SQLALCHEMY_TRACK_MODIFICATIONS): Delete variable. * guix.scm (genenetwork3)[propagated-inputs]: Remove python-sqlalchemy-stubs. * setup.py: Remove sqlalchemy-stubs from install_requires.
2021-11-04Implement `compute_partial_correlations_fast`Frederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Implement `compute_partial_correlations_fast` that is a partial migration of `web.webqtl.correlation.PartialCorrDBPage.getPartialCorrelationsFast` in GN1. This function will probably be reworked once the dependencies are fully migrated. It also needs tests to be added.
2021-11-04Partially implement `partial_correlation_recursive`Frederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * gn3/computations/partial_correlations.py: Implement one path for the `gn3.computations.partial_correlations.partial_correlation_recursive` function. * gn3/settings.py: Add a setting for how many decimal places to round to * tests/unit/computations/test_partial_correlations.py: Update test to take the number of decimal places into consideration Implement a single path (where the z value is a vector and not a matrix) for the `partial_correlation_recursive` function.
2021-11-01Implement `compute_partial_correlations_fast`Frederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/partial-correlations.gmi * Implement `compute_partial_correlations_fast` that is a partial migration of `web.webqtl.correlation.PartialCorrDBPage.getPartialCorrelationsFast` in GN1. This function will probably be reworked once the dependencies are fully migrated. It also needs tests to be added.
2021-10-29Feature/biweight reimplementation (#47)Alexander Kabui
* add biweight reimplementation with pingouin * delete biweight scripts and tests * add python-pingouin to guix file * delete biweight paths * mypy fix:pingouin mising imports * pep8 formatting && pylint fixes
2021-10-19Fix some linting issuesFrederick Muriuki Muriithi
2021-10-19Allow CORS_ORIGINS to be configurable via the environmentFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/non-clustered-heatmaps-and-flipping.gmi * gn3/app.py: setup CORS after all the configuration sources are loaded. * gn3/settings.py: Parse CORS_ORIGINS from the environment variables. Enable the CORS_ORIGINS configuration to be set in the environment variables to give the application some flexibility when launching.
2021-09-27fix merge conflictsAlexander Kabui
2021-09-20Enable Cross-Origin Resource SharingFrederick Muriuki Muriithi
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/api/heatmaps.py: Fix bugs in data parsing * gn3/app.py: enable CORS * gn3/settings.py: add flask-cors configurations * guix.scm: Add flask-cors dependency For easier testing of the heatmaps generation feature, this commit activates the cross-origin resource sharing for all "localhost" origins.
2021-09-16Add WGCNA_SCRIT env to settingsAlexander Kabui
2021-08-31Provide utilities for genotype filesMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/db/genotypes.py: New module * gn3/settings.py: Add new configuration variable * qtlfilesexport.py: Test out new code Add a module containing functions dealing with the genotype files. Add a configuration variable to point to the location of the genotype files.
2021-08-30Implement module for interfacing with rust-qtlreaperMuriithi Frederick Muriuki
Issue: https://github.com/genenetwork/gn-gemtext-threads/blob/main/topics/gn1-migration-to-gn2/clustering.gmi * gn3/computations/heatmap.py: move `generate_traits_file` function to new module * gn3/computations/qtlreaper.py: new module to interface with the `rust-qtlreaper` utility. * gn3/settings.py: Provide setting for the path to the `rust-qtlreaper` utility * qtlfilesexport.py: Move `random_string` function to new module. Update to use functions in new module. Provide a module with functions to be used to interface with `rust-qtlreaper`. This module essentially contains all the functions that are needed to build the files needed for, and to run the qtlreaper utility.
2021-06-23minor fixes for biweight scriptAlexander Kabui
2021-06-20merge mainAlexander Kabui
2021-06-20make requested changes to biweightAlexander Kabui
2021-05-17Added RQTL_WRAPPER_CMD (which is fetched from environment) in settings.pyzsloan
2021-05-13Add end-point for running an rQTL programBonfaceKilz
* gn3/api/general.py (run_r_qtl): New function. * gn3/settings.py: New variable.
2021-05-03modify default SQL_URIAlexander Kabui
2021-04-12fix merge conflictAlexander Kabui
2021-04-12Integrate correlation APIAlexander Kabui
- add new api for gn2-gn3 sample r integration - delete map for sample list to values - add db util file - add python msql-client dependency - add db for fetching lit correlation results - add unittests for db utils - add tests for db_utils - modify api for fetching lit correlation results - refactor Mock Database Connector and unittests - add sql url parser - add SQL URI env variable - refactor code for db utils - modify return data for lit correlation - refactor tissue correlation endpoint - replace db_instance with conn
2021-03-31add mysqlclient in guixAlexander Kabui
add env variable for GN2_URL
2021-03-23Use ipfs to get genotype filesBonfaceKilz
2021-03-15Delete redundant gn3/config.pyBonfaceKilz
All default confs should go to one place: gn3/setting.py * gn3/app.py: Delete get_config. Apply pep-8 formatting. * gn3/config.py: Delete it. Move conf options to... * gn3/settings.py: ... here.
2021-03-08Replace APP_DEFAULTS dict with actual conf paramsBonfaceKilz