aboutsummaryrefslogtreecommitdiff
path: root/gn3/db
AgeCommit message (Expand)Author
2022-12-08Remove unused importFrederick Muriuki Muriithi
2022-12-06Use a dataset's name to fetch it's metadata from RDF...* gn3/api/metadata.py (jsonify_dataset_metadata): Rewrite metadata end-point to use a dataset's name instead of it's accession_id. * gn3/db/rdf.py (get_dataset_metadata): Replace accession_id with name. Use one single RDF query instead of multiple queries. Munyoki Kilyungi
2022-11-16Inject SPARQLWrapper as a parameter...* gn3/db/rdf.py: Delete gn3.setting.SPARQL_ENDPOINT import. (sparql_query): Inject SPARQLWrapper. (get_dataset_metadata): Ditto. Munyoki Kilyungi
2022-11-02Re-implement RDF related code to use monads in its own module...* gn3/api/general.py: Replace gn3.db.datasets import with gn3.db.rdf. (dataset_metadata) <jsonify>: Replace datasets.dataset_metadata with rdf.get_dataset_metadata. * gn3/db/datasets.py: Remove unused imports. (sparql_query, dataset_metadata): Delete. * gn3/db/rdf.py: (sparql_query, get_dataset_metadata): New functions. Munyoki Kilyungi
2022-11-02Fix pylint and mypy errors...* gn3/db/sample_data.py (get_trait_csv_sample_data): Pass __query directly to cursor.execute. Rename value to _value in for loop to make mypy pass. * gn3/db_utils.py (Connection): Add class docstring. (Connection.cursor): Add docstring. * mypy.ini: Add an entry for xapian. Munyoki Kilyungi
2022-08-23Remove conn.commit() and conn.rollback()...* gn3/db/__init__.py (update): Delete conn.commit() and conn.rollback() (insert): Ditto. * gn3/db/case_attributes.py (insert_case_attribute_audit): Ditto. (reject_case_attribute): Ditto. (approve_case_attribute): Ditto. * gn3/db/sample_data.py (update_sample_data): Ditto. (delete_sample_data): Ditto. (insert_sample_data): Ditto. Munyoki Kilyungi
2022-06-21Replace lint code with human-readable text...* gn3/db/correlations.py (__fetch_data__): Use a more readable code as opposed to an error code. BonfaceKilz
2022-06-21db: correlations: Ignore pylint error...* gn3/db/correlations.py (__fetch_data__): Ignore "Too many args" [R0913] error. BonfaceKilz
2022-06-21db: correlations: Ignore types...* gn3/db/correlations.py (__build_query__): Ignore the "sample_ids" and "joins" types when calling build_query_sgo_lit_corr (fetch_all_database_data): Ignore the return type. TODO: Ping Alex/Arun to fix this. BonfaceKilz
2022-06-21db: datasets.py: Ignore results from sparql.queryAndConvert...ATM, it's very difficult to work the correct type that is returned. Ignore this for now and fix this later. BonfaceKilz
2022-05-31Extract utility functions from `fetch_all_database_data`...Extract the utility functions to help with understanding the what the `fetch_all_database_data` function is doing. This helps with maintenance. Frederick Muriuki Muriithi
2022-05-27Move sql for CRUD operations on case-attrs from gn2 to gn3BonfaceKilz
2022-05-27Move sql for modifying case-attributes from gn2 to gn3BonfaceKilz
2022-05-27Return all the results from CaseAttributes column as is...* gn3/db/sample_data.py: Remove "collections" import. Add "Optional" import. (get_case_attributes): Return the results of "fetchall" from the case attributes. * tests/unit/db/test_sample_data.py (test_get_case_attributes): Update failing test. BonfaceKilz
2022-05-26Add Endpoint to get menu items for use in UIFrederick Muriuki Muriithi
2022-05-06Fix linting and typing errorsFrederick Muriuki Muriithi
2022-05-05Compute partial correlation with selected traits...Compute partial correlations against a selection of traits rather than against an entire dataset. Frederick Muriuki Muriithi
2022-04-12Strip any newline, tab or carriage-return chars from sample data...* gn3/db/sample_data.py (get_trait_csv_sample_data): Strip out "\n", "\t", or "\r" from the sample data. See: <https://issues.genenetwork.org/issues/csv-error-ITP_10001-longevity-data-set.html> BonfaceKilz
2022-04-07Fix pylint errorsBonfaceKilz
2022-04-07Use case attribute id inside brackets if present during insertions...* gn3/db/sample_data.py (delete_sample_data): If an id is present in the column header, use it. * tests/unit/db/test_sample_data.py (test_delete_sample_data): Update tests to capture the above. BonfaceKilz
2022-04-07Use case attribute id inside brackets if present during insertions...* gn3/db/sample_data.py (insert_sample_data): If an id is present in the column header, use it. * tests/unit/db/test_sample_data.py (test_insert_sample_data): Update tests to capture the above. BonfaceKilz
2022-04-07Use case attribute id inside brackets if present during updates...* gn3/db/sample_data.py: Import "parse_csv_column". (update_sample_data): If an id is present in the column header, use it. * tests/unit/db/test_sample_data.py (test_update_sample_data): Update tests to capture the above. BonfaceKilz
2022-04-07Add method for fetching the case_attributes...* gn3/db/sample_data.py (get_case_attributes): New function. * tests/unit/db/test_sample_data.py (test_get_case_attributes): Test case for the above. BonfaceKilz
2022-04-07Run python black on file...* gn3/db/sample_data.py: Run "python black -l 79 ..." BonfaceKilz
2022-03-14Dummy White Space commit to fix laminarBonfaceKilz
2022-03-12Remove unused importsBonfaceKilz
2022-03-12Fix mypy issuesBonfaceKilz
2022-03-12Fix pylint issuesBonfaceKilz
2022-03-12Store the first element as strain_idBonfaceKilz
2022-03-12Append the strain name when extracting "actions"...* gn3/db/sample_data.py (__extract_actions): During updates, make sure that the strain name is part of the returned string when extracting "actions". * tests/unit/db/test_sample_data.py: Add test cases for the above. BonfaceKilz
2022-03-12Apply auto-pep8 to sample_data.py and it's test fileBonfaceKilz
2022-03-12Add missing return type-annotations...* tests/unit/db/test_sample_data.py (delete_sample_data): Add missing return type for type annotations. (insert_sample_data): Ditto. BonfaceKilz
2022-03-12Update how data is updated by re-using existing functions...* gn3/db/sample_data.py (get_sample_data_ids): Re-use "delete_sample_data" and "insert_sample_data" when updating data; and also add logic for updating modified data. * tests/unit/db/test_sample_data.py: Add tests for the above. BonfaceKilz
2022-03-12Create action dict that's created when updating data...* gn3/db/sample_data.py (__extract_actions): An update on a vector of data can contain: inserts, deletes and updates. This functions extracts these actions during an update. * tests/unit/db/test_sample_data.py (test_extract_actions): Add test-case for the above. BonfaceKilz
2022-03-12Remove check for inserted data when inserting individual data...* gn3/db/sample_data.py (insert_sample_data)[__insert_data]: Move check to the main body. With this check here, you have 3 redundant checks. For a successful insert, it will insert the first value to the `PublishData` table and ignore the rest of the inserts. BonfaceKilz
2022-03-12Make `_map` a constant...* gn3/db/sample_data.py: Now constant, `_MAP`. (delete_sample_data)[__delete_data]: Replace `_map` with `_MAP`. (insert_sample_data)[__insert_data]: Ditto. BonfaceKilz
2022-03-12Fix faulty SQL query string when deleting case-attributesBonfaceKilz
2022-03-12Explicitly get CaseAttributeId and fix broken sql query...* gn3/db/sample_data.py (insert_sample_data): Use correct query string. Also, use CaseAttributeId to determine whether case-attributes were inserted. If so, do not attempt an insert. BonfaceKilz
2022-03-12Remove duplicate params...* gn3/db/sample_data.py (insert_sample_data)[__insert_case_attribute]: Remove extra parameters. BonfaceKilz
2022-03-12Remove dead codeBonfaceKilz
2022-03-12Check whether publish data already exists before inserting...* gn3/db/sample_data.py (insert_sample_data): If data already exists in the table, do not attempt an insert; otherwise, an error will be generated. BonfaceKilz
2022-03-12Fetch id's separately for the insertion edge-case...* gn3/db/sample_data (get_sample_data_ids): Add an extra condition that caters for inserts: during inserts, joins won't work when fetching the strain_id, publishdata_id, and strain_name. In this case, just create 2 separate queries to do that work. BonfaceKilz
2022-03-12Extract a strain name given a csv string and it's header...* gn3/csvcmp.py (extract_strain_name): New function. * gn3/db/sample_data (delete_sample_data): Use the aforementioned function. (insert_sample_data): Ditto. * tests/unit/test_csvcmp: Test cases for above. BonfaceKilz
2022-03-12Allow deleting case-attribute data during deletion...* gn3/db/sample_data.py (delete_sample_data): Modify this function to allow deleting case-attribute values. BonfaceKilz
2022-03-12Allow inserting case-attribute data during inserts...* gn3/db/sample_data.py (insert_sample_data): Modify this function to allow inserting case-attribute values. BonfaceKilz
2022-03-12Fetch InbredSetId...* gn3/db/sample_data.py (get_sample_data_ids): Extend to also fetch InbredSetId. (update_sample_data): Discard the returned value of InbredSetId. (delete_sample_data): Ditto. BonfaceKilz
2022-03-12Create a new function for retrieving strain_id and publishdata_id...* gn3/db/sample_data.py: Import Any, Tuple. (get_sample_data_ids): New function that fetches the strain_id and publishdata_id of a given data point. (update_sample_data): Use `get_sample_data_ids`. (delete_sample_data): Ditto. (insert_sample_data): Ditto. BonfaceKilz
2022-03-12Move operations on sample_data to it's own moduleBonfaceKilz
2022-03-12db: Fix error in SQL query...* gn3/db/traits.py (get_trait_csv_sample_data): Update SQL to fix runtime errors. BonfaceKilz
2022-03-12Fix pylint errorBonfaceKilz