Passed
Pull Request — master (#3)
by Yang
04:58
created

Python.Integration.DICOM_to_LORIS   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 22
dl 0
loc 44
rs 10
c 0
b 0
f 0
wmc 6

1 Method

Rating   Name   Duplication   Size   Complexity  
B Integration.step2_dicom2LORIS() 0 33 6
1
from DICOM.elements import DICOM_elements
0 ignored issues
show
Coding Style Naming introduced by
The name DICOM_to_LORIS does not conform to the module naming conventions ((([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style introduced by
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
introduced by
Unable to import 'DICOM.elements'
Loading history...
2
from LocalDB.query import LocalDB_query
0 ignored issues
show
Bug introduced by
The name query does not seem to exist in module LocalDB.
Loading history...
introduced by
Unable to import 'LocalDB.query'
Loading history...
3
from LocalDB.schema import CNBP_blueprint
0 ignored issues
show
Bug introduced by
The name schema does not seem to exist in module LocalDB.
Loading history...
introduced by
Unable to import 'LocalDB.schema'
Loading history...
4
from dotenv import load_dotenv
5
import logging
0 ignored issues
show
introduced by
standard import "import logging" should be placed before "from DICOM.elements import DICOM_elements"
Loading history...
6
from DICOM.validate import DICOM_validate
0 ignored issues
show
introduced by
Unable to import 'DICOM.validate'
Loading history...
introduced by
Imports from package DICOM are not grouped
Loading history...
7
#from LORIS.candidates import  LORIS_candidates
8
9
class Integration:
0 ignored issues
show
Coding Style introduced by
This class should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Unused Code introduced by
The variable __class__ seems to be unused.
Loading history...
10
11
    @staticmethod
12
    def step2_dicom2LORIS(folder_paths):
0 ignored issues
show
Coding Style Naming introduced by
The name step2_dicom2LORIS does not conform to the method naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
13
        """
14
        Within each folder, verify they all have the same PatientID.
15
        :param folder_paths:
16
        :return:
17
        """
18
19
        database_path = load_dotenv("LocalDatabase")
20
21
        logger = logging.getLogger(__name__)
0 ignored issues
show
Unused Code introduced by
The variable logger seems to be unused.
Loading history...
22
23
        for folder in folder_paths:
24
            success, DICOM_files = DICOM_validate.path(folder)
0 ignored issues
show
Coding Style Naming introduced by
The name DICOM_files does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
25
26
            if not success or DICOM_files is None:
27
                return False
28
29
            # At this point, we know all DICOM files from the folder has the same name.
30
            MRN = DICOM_elements.retrieveMRN(DICOM_files[0])
0 ignored issues
show
Coding Style Naming introduced by
The name MRN does not conform to the variable naming conventions ((([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
31
32
            # Store MRN in database.
33
            mrn_exist_in_database, _ = LocalDB_query.check_value(database_path, CNBP_blueprint.table_name, CNBP_blueprint.keyfield, MRN)
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (136/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
34
35
            # Continue to next subject if MRN already exist in the database.
36
            if mrn_exist_in_database:
37
                continue
38
39
            # else database the subject.
40
            elif not mrn_exist_in_database:
41
42
                # Create the subject
43
                LocalDB_query.create_entry(database_path, CNBP_blueprint.table_name, CNBP_blueprint.keyfield, MRN)
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (114/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
44
45
                # Retrieve the PSCID based on the scanner protocol
46
                #DICOM_elements.get_ResearchProtocol()
47
48
                #LORIS_candidates.check_PSCID_compliance(PSCID)
49
50
                # Contact LORIS to request new MRN number.
51