Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#695 Move Code List SPARQL Queries to CodeListInspector #725

Merged
merged 23 commits into from
Feb 16, 2023

Conversation

nimshi89
Copy link
Contributor

@nimshi89 nimshi89 commented Feb 6, 2023

#695

transferred the following queries to cached properties:

  • select_codelist_csv_url.sparql (code_list_inspector.py) - reworked to link between the csv_url and conceptSchemeUrl
  • select_codelist_cols_by_csv_url.sparql (csvw_state.py) - replaced with a generic columns query in csvw_state

Adds a get_catalog_metadata API function to code_list_inspector.py which uses the results from the select_codelist_csv_url.sparql cached property.

Adds unit test coverage for new functions/properties

Class has been renamed to CodeListInspector

@github-actions
Copy link

github-actions bot commented Feb 7, 2023

ubuntu-latest-python3.9 test results

460 tests  +4   460 ✔️ +4   2m 59s ⏱️ -16s
    8 suites ±0       0 💤 ±0 
    8 files   ±0       0 ±0 

Results for commit 2e5142e. ± Comparison against base commit 9bea1bd.

This pull request removes 1 and adds 5 tests. Note that renamed tests count towards both.
tests.unit.utils.sparqlhandler.test_sparqlquerymanager ‑ test_select_qb_csv_url
tests.unit.cli.inspect.test_code_list_inspector ‑ test_code_list_table_identifiers
tests.unit.cli.inspect.test_code_list_inspector ‑ test_code_list_table_identifiers_error
tests.unit.cli.inspect.test_code_list_inspector ‑ test_get_catalog_metadata_for_concept_scheme
tests.unit.cli.inspect.test_code_list_inspector ‑ test_get_catalog_metadata_for_concept_scheme_error
tests.unit.cli.inspect.test_code_list_inspector ‑ test_get_table_identifiers_for_concept_scheme_error

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 7, 2023

ubuntu-latest-python3.11 test results

460 tests  +4   460 ✔️ +4   2m 49s ⏱️ -15s
    8 suites ±0       0 💤 ±0 
    8 files   ±0       0 ±0 

Results for commit 2e5142e. ± Comparison against base commit 9bea1bd.

This pull request removes 1 and adds 5 tests. Note that renamed tests count towards both.
tests.unit.utils.sparqlhandler.test_sparqlquerymanager ‑ test_select_qb_csv_url
tests.unit.cli.inspect.test_code_list_inspector ‑ test_code_list_table_identifiers
tests.unit.cli.inspect.test_code_list_inspector ‑ test_code_list_table_identifiers_error
tests.unit.cli.inspect.test_code_list_inspector ‑ test_get_catalog_metadata_for_concept_scheme
tests.unit.cli.inspect.test_code_list_inspector ‑ test_get_catalog_metadata_for_concept_scheme_error
tests.unit.cli.inspect.test_code_list_inspector ‑ test_get_table_identifiers_for_concept_scheme_error

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Feb 7, 2023

windows-latest-python3.11 test results

    9 files  ±0    10 suites  ±0   7m 53s ⏱️ +17s
474 tests +4  474 ✔️ +4  0 💤 ±0  0 ±0 
487 runs  +4  487 ✔️ +4  0 💤 ±0  0 ±0 

Results for commit 2e5142e. ± Comparison against base commit 9bea1bd.

This pull request removes 1 and adds 5 tests. Note that renamed tests count towards both.
tests.unit.utils.sparqlhandler.test_sparqlquerymanager ‑ test_select_qb_csv_url
tests.unit.cli.inspect.test_code_list_inspector ‑ test_code_list_table_identifiers
tests.unit.cli.inspect.test_code_list_inspector ‑ test_code_list_table_identifiers_error
tests.unit.cli.inspect.test_code_list_inspector ‑ test_get_catalog_metadata_for_concept_scheme
tests.unit.cli.inspect.test_code_list_inspector ‑ test_get_catalog_metadata_for_concept_scheme_error
tests.unit.cli.inspect.test_code_list_inspector ‑ test_get_table_identifiers_for_concept_scheme_error

♻️ This comment has been updated with latest results.

src/csvcubed/utils/sparql_handler/code_list_inspector.py Outdated Show resolved Hide resolved
src/csvcubed/utils/sparql_handler/code_list_inspector.py Outdated Show resolved Hide resolved
src/csvcubed/utils/sparql_handler/data_cube_state.py Outdated Show resolved Hide resolved
src/csvcubed/utils/sparql_handler/data_cube_state.py Outdated Show resolved Hide resolved
src/csvcubed/utils/sparql_handler/data_cube_state.py Outdated Show resolved Hide resolved
tests/unit/cli/inspect/test_code_list_inspector.py Outdated Show resolved Hide resolved
tests/unit/cli/inspect/test_code_list_inspector.py Outdated Show resolved Hide resolved
tests/unit/cli/inspect/test_code_list_inspector.py Outdated Show resolved Hide resolved
tests/unit/utils/sparqlhandler/test_code_list_state.py Outdated Show resolved Hide resolved
@nimshi89 nimshi89 marked this pull request as ready for review February 8, 2023 10:59
Copy link
Contributor

@NickPapONS NickPapONS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, makes sense to me! There are a few differences in the way cached properties are implemented compared to how we did it in the other tickets with myself and Sarah (data_cube_state or csvw_state), but I think these cached properties mostly work independently between code lists and data cubes. There will be quite a bit of conflict resolution needed when we merge all these 3 cached properties tickets together, but that's a natural part of splitting up the task the way we did. I don't see anything here that I think we wouldn't want to keep anyway.

@robons robons changed the title 695 populate code list #695 Move Code List SPARQL Queries to CodeListInspector Feb 13, 2023
src/csvcubed/utils/sparql_handler/code_list_inspector.py Outdated Show resolved Hide resolved
src/csvcubed/utils/sparql_handler/code_list_inspector.py Outdated Show resolved Hide resolved
src/csvcubed/utils/sparql_handler/code_list_inspector.py Outdated Show resolved Hide resolved
src/csvcubed/utils/sparql_handler/csvw_state.py Outdated Show resolved Hide resolved
tests/behaviour/steps/inspectcli.py Outdated Show resolved Hide resolved
tests/unit/cli/inspect/test_code_list_inspector.py Outdated Show resolved Hide resolved
tests/unit/cli/inspect/test_code_list_inspector.py Outdated Show resolved Hide resolved
Copy link
Contributor

@robons robons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there, just tidy up those comments and I think we're pretty much there.

src/csvcubed/utils/sparql_handler/code_list_inspector.py Outdated Show resolved Hide resolved
src/csvcubed/utils/sparql_handler/code_list_inspector.py Outdated Show resolved Hide resolved
src/csvcubed/utils/sparql_handler/code_list_inspector.py Outdated Show resolved Hide resolved
src/csvcubed/utils/sparql_handler/csvw_state.py Outdated Show resolved Hide resolved
src/csvcubed/utils/sparql_handler/csvw_state.py Outdated Show resolved Hide resolved
src/csvcubed/utils/sparql_handler/data_cube_state.py Outdated Show resolved Hide resolved
src/csvcubed/utils/sparql_handler/data_cube_state.py Outdated Show resolved Hide resolved
src/csvcubed/utils/sparql_handler/data_cube_state.py Outdated Show resolved Hide resolved
src/csvcubed/utils/sparql_handler/data_cube_state.py Outdated Show resolved Hide resolved
tests/helpers/inspectors_cache.py Show resolved Hide resolved
@sonarcloud
Copy link

sonarcloud bot commented Feb 15, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

def get_column_definitions_for_csv(self, csv_url: str) -> List[ColumnDefinition]:
"""
Returns the `ColumnDefinition`s for a given csv file, raises a KeyError if the csv_url
is not associated with a ColumnDefinition.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A list of column definitions.

@robons robons merged commit 2361d5d into main Feb 16, 2023
@nimshi89 nimshi89 deleted the 695_populate_code_list branch February 24, 2023 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants