Skip to content

Commit

Permalink
95 fix docstring for with columns (#98)
Browse files Browse the repository at this point in the history
* Fix link to part of readme

* Add docstring about with_columns

* Improve spacing in docstring

* Test for mypy

* Check if the error depends on 3.10

* Update packages and try again with 3.10

* Set 3.10.6 as py version

* Add type ignores

* Add type ignores
  • Loading branch information
giuliabaldini committed Oct 27, 2022
1 parent 7b6f387 commit 6ae501e
Show file tree
Hide file tree
Showing 6 changed files with 993 additions and 479 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/mypy-flake-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10.6"]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand All @@ -46,9 +46,8 @@ jobs:
poetry install -E all
- name: Run MyPy
run: |
poetry run mypy --install-types --non-interactive .
poetry run mypy fhir_pyrate/
poetry run mypy tests/
poetry run mypy --install-types --non-interactive fhir_pyrate
poetry run mypy --install-types --non-interactive tests
- name: Run Flake8
run: |
poetry run flake8 fhir_pyrate/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Table of Contents:
* [sail_through_search_space](https://github.com/UMEssen/FHIR-PYrate/#sail_through_search_space)
* [trade_rows_for_bundles](https://github.com/UMEssen/FHIR-PYrate/#trade_rows_for_bundles)
* [bundles_to_dataframe](https://github.com/UMEssen/FHIR-PYrate/#bundles_to_dataframe)
* [***_dataframe](https://github.com/UMEssen/FHIR-PYrate/#***_dataframe)
* [***_dataframe](https://github.com/UMEssen/FHIR-PYrate/#_dataframe)
* [Miner](https://github.com/UMEssen/FHIR-PYrate/#miner)
* [DicomDownloader](https://github.com/UMEssen/FHIR-PYrate/#dicomdownloader)
* [Contributing](https://github.com/UMEssen/FHIR-PYrate/#contributing)
Expand Down
10 changes: 5 additions & 5 deletions fhir_pyrate/dicom_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def download_data(
base_dict[self.series_instance_uid_field] = series_uid

# Init the readers/writers
series_reader = sitk.ImageSeriesReader()
series_reader = sitk.ImageSeriesReader() # type: ignore
with tempfile.TemporaryDirectory() as tmp_dir:
# Create the download dir
current_tmp_dir = pathlib.Path(tmp_dir)
Expand Down Expand Up @@ -308,11 +308,11 @@ def download_data(
progress_bar.close()

# Get Series ID names from folder
series_uids = sitk.ImageSeriesReader.GetGDCMSeriesIDs(str(current_tmp_dir))
series_uids = sitk.ImageSeriesReader.GetGDCMSeriesIDs(str(current_tmp_dir)) # type: ignore
logger.info(f"Study ID has {len(series_uids)} series.")
for series in series_uids:
# Get the DICOMs corresponding to the series
files = series_reader.GetGDCMSeriesFileNames(
files = series_reader.GetGDCMSeriesFileNames( # type: ignore
str(current_tmp_dir), series
)
current_dict = base_dict.copy()
Expand All @@ -324,8 +324,8 @@ def download_data(
with simpleitk_warning_file.open("w") as f, stdout_redirected(
f, stdout=sys.stderr
):
series_reader.SetFileNames(files)
image = series_reader.Execute()
series_reader.SetFileNames(files) # type: ignore
image = series_reader.Execute() # type: ignore
with simpleitk_warning_file.open("r") as f:
content = f.read()
if "warning" in content.lower():
Expand Down
9 changes: 5 additions & 4 deletions fhir_pyrate/pirate.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,13 +445,14 @@ def trade_rows_for_dataframe(
{"date": [("ge", "init_date_column"), ("le", "end_date_column")]}
:param request_params: The parameters for the query, e.g. _count, _id
:param num_pages: The number of pages of bundles that should be returned per request,
the default is -1 (all bundles),
with any other value exactly that value of bundles will be returned,
assuming that there are that many
the default is -1 (all bundles), with any other value exactly that value of bundles will
be returned, assuming that there are that many
:param with_ref: Whether the input columns of `df_constraints` should be added to the
output DataFrame
:param with_columns: Whether additional columns from the source DataFrame should be
added to output DataFrame, as a list of column names from the source DataFrames
added to output DataFrame. The columns from the source DataFrame can be either specified
as a list of columns `[col1, col2, ...]` or as a list of tuples
`[(new_name_for_col1, col1), (new_name_for_col2, col2), ...]`
:param merge_on: Whether to merge the results on a certain row after computing. This is
useful when using includes, if you store the IDs on the same column you can use that column
to merge all the rows into one, an example is given in `bundles_to_dataframe`
Expand Down
Loading

0 comments on commit 6ae501e

Please sign in to comment.