aboutsummaryrefslogtreecommitdiff
path: root/gn3/db
AgeCommit message (Collapse)Author
2024-09-11Move comment on the manual sort to the doc-string.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-09-11Abstract out sanitizing json-ld result into a function.Munyoki Kilyungi
* gn3/db/rdf/wiki.py (__sanitize_result): New function. (get_wiki_entries_by_symbol): Delete sanitization code. (get_comment_history): Ditto. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-09-11Update RDF queries to match ADR/000/gn-transform-databases.Munyoki Kilyungi
See: <https://issues.genenetwork.org/topics/ADR/gn-transform-databases/000-remodel-rif-transform-with-predicateobject-lists> for more context. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-09-05Update comment explaining why CONSTRUCT doesn't respect ORDER BY.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-09-05Correctly get categories in response.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-09-05Sort the RIF history data in reverse order.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-09-05Enforce array type to "categories" and "pmids" fields.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-09-05Set OPTIONAL values to default to an empty string.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-09-05Rename "pubmed_id" -> "pubmed_ids" to be explicit it's an array.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-09-05Remove type from wiki history.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-09-05Fix type error.Munyoki Kilyungi
* gn3/api/metadata_api/wiki.py: Remove FIXME comment. * gn3/db/wiki.py: Fix type error. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-09-05Add comment history.Munyoki Kilyungi
* gn3/api/metadata_api/wiki.py: Import get_comment_history. (get_history): New end-point. * gn3/db/rdf/wiki.py: (get_comment_history): New function. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-09-05Always output the top-level graph when compacting.Munyoki Kilyungi
This makes sure that the API is always consistent. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-09-05Use correct prefix when querying for email in triple.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-09-05Create global wiki context usable by all functions in gn3.rdf.wikiMunyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-09-05Add missing doc-strings to make pylint pass.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-09-05Restructure RDF module.Munyoki Kilyungi
* gn3/api/metadata.py: Import constants from gn3.db.rdf * gn3/api/metadata_api/wiki.py: Ditto. Import "get_wiki_entries_by_symbol" from gn3.db.rdf.wiki. * gn3/db/constants.py: Delete file and move all constants ... * gn3/db/rdf.py: ... and functions ... * gn3/db/rdf/__init__.py: ... here. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-08-29chore: pylint docstringJohn Nduli
2024-08-29feat: add api calls to get categories and last commentJohn Nduli
2024-08-29Remove "@id" re-map in the json-ld base context.Munyoki Kilyungi
* gn3/db/constants.py [BASE_CONTEXT]: Remove "id" key. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-08-29Fetch the latest comment by the versionId.Munyoki Kilyungi
* gn3/db/rdf.py (get_wiki_entries_by_symbol): Update query to fetch the latest query by the version. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-08-29Make fetching wiki entries by symbol case insensitive.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-08-29Add "created" to wiki return.Munyoki Kilyungi
* gn3/db/rdf.py (get_wiki_entries_by_symbol): Add "created" to dictionary. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-08-26Fix pylint errors.Munyoki Kilyungi
* gn3/api/metadata.py: Remove duplicate imports. * gn3/db/constants.py: Add docstring. * gn3/db/rdf.py (get_wiki_entries_by_symbol): Remove duplicate dictionary key. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-08-26If there's no data, return a 404.Munyoki Kilyungi
* gn3/api/metadata.py (get_wiki_entries): Return an empty {} when there's no data. * gn3/db/rdf.py (query_frame_and_compact): Delete check for empty results. Instead just return the context as is. (query_and_compact): Ditto. (query_and_frame): Ditto. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-08-26Replace map with list comprehension.Munyoki Kilyungi
* gn3/db/rdf.py (get_wiki_entries_by_symbol): Use list comprehensions. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-08-26Fetch all the wiki entries by symbol.Munyoki Kilyungi
* gn3/api/metadata.py: Import "get_wiki_entries_by_symbol". (get_gn_genewiki_entries): Rename this to... (get_wiki_entries): this; and update the URL endpoint. * gn3/db/rdf.py: Import constants.BASE_CONTEXT. (get_wiki_entries_by_symbol): New function. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-08-26Move constants to their own file.Munyoki Kilyungi
* gn3/api/metadata.py: Move constants from here... * gn3/db/rdf.py: ... and here, to... * gn3/db/constants.py: ... here. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-08-26chore: fix pylint errorsJohn Nduli
2024-08-26refactor: split out utlities into their modules and change api to use metadataJohn Nduli
2024-04-30Add an endpoint to query a dataset's git history from it's id.Munyoki Kilyungi
* gn3/api/metadata.py: Import get_history. (view_history): New endpoint. * gn3/db/datasets.py (get_history): New function. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-04-30Add a method for saving a dataset's metadata to git.Munyoki Kilyungi
* gn3/db/datasets.py (retrieve_metadata): New function. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-04-30Rename retrieve_dataset_metadata to retrieve_metadata.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-04-30Remove an f-string that doesn't have any interpolated variables.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-04-29Prevent error when group isn't in parents/f1s JSON filezsloan
2024-04-11Include parents/f1s in default samplelist + add boolean options for themzsloan
2024-02-25Construct genofile_path using pathlib module.Munyoki Kilyungi
* gn3/db/datasets.py: Remove os import. (retrieve_sample_list): Replace os.path with Path. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-02-15Use correct names for dataset entries in json result.Munyoki Kilyungi
Since we are appending to an already flattened json-ld file, we don't need to add the prefixes. * gn3/api/metadata.py (DATASET_CONTEXT): Add missing "experimentType" key. * gn3/db/datasets.py (retrieve_dataset_metadata): Match the __subject dict with entries from DATASET_CONTEXT. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-02-13Fetch extra metadata from text-files when fetching datasets.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2024-02-13Retrieve metadata from text files given a path.Munyoki Kilyungi
* gn3/db/datasets.py (retrieve_trait_dataset): New file. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-10-27Fix pylint error.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-10-27Add functions that wrap around the common jsonld patterns.Munyoki Kilyungi
* gn3/db/rdf.py: Import jsonld. (query_frame_and_compact, query_and_compact, query_and_frame): New functions. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-10-27Break up long line.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-10-27Ignore construct result for mypy complianceMunyoki Kilyungi
This commit addresses the mypy issue below by ignoring the construct result. ``` error: Item "None" of "bytes | str | dict[Any, Any] | Graph | Document | None" has no attribute "serialize" [union-attr] ```
2023-10-27Abstract out (sparql) CONSTRUCT into a function.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-10-27Delete gn3.db.rdf.sparql_query.Munyoki Kilyungi
* gn3/api/metadata.py: Remove sparql_query import. * gn3/db/rdf.py: Remove unused imports. (sparql_query): Delete. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-10-27Delete db.rdf.get_url_local_name.Munyoki Kilyungi
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-10-27Implement "GET /metadata/phenotypes/:name".Munyoki Kilyungi
* gn3/api/metadata.py: Delete gn3.db.rdf.get_phenotype_metadata. (phenotype): Rename this to ... (phenotypes): ... this and implement update logic. * gn3/db/rdf.py (get_phenotype_metadata): Delete. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-10-27Delete get_dataset_metadata.Munyoki Kilyungi
* gn3/db/rdf.py (get_dataset_metadata): Delete. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
2023-10-27Implement "GET /metadata/publications/:name".Munyoki Kilyungi
* gn3/api/metadata.py: Delete gn3.db.rdf.get_publication_metadata. (publication): Rename this ... (publications): ... to this. Return a json-ld result. * gn3/db/rdf.py (get_publication_metadata): Delete. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>