vivifyhealthcare/Open-Health-Bot-API

View on GitHub

Showing 100 of 2,397 total issues

Function Score has a Cognitive Complexity of 152 (exceeds 5 allowed). Consider refactoring.
Open

def Score(questionid, answer):
    if questionid.Question == 'Felt your life had a sense of purpose':
        if answer == 'Yes':
            return 2
        elif answer == 'No':
Severity: Minor
Found in openhealth/openhealthapi/score.py - About 3 days to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function get has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    def get(self, request, UserId):
        """Here We Get the Session Scoring The User Have Fill All The Questions For Every Session Then We Get The Scoring For All Sessions
        Or Else He/She Fill Only One Session Questions Then They Will  Only Get That One Session Scoring  Which They Are Filled By Using UserId
        (Here We Get Scoring From Different Tables
        1.Table_Name:'User_Diabetes_Assessment_table'

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function get has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    def get(self, request, UserId):
        """Here We Get The Lifestyle assessment Data Based On UserId Include All the MasterData
        (Table_Name : 'Lifestyle scoring Questions',
        Table_Name : 'Openhealth_Lifestyle_Assessment_table')"""

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function get has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    def get(self, request, UserId):
        """Here We Get The Depression assessment Data Based On UserId Include All the MasterData
        (Table_Name : 'Depression Questions',
        Table_Name : 'Openhealth_Depression_Assessment_table')"""

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function get has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    def get(self, request, UserId):
        """Here We Get The Diabetes assessment Data Based On UserId Include All the MasterData
        (Table_Name : 'Diabetes Questions',
        Table_Name : 'Openhealth_Diabetes_Assessment_table')"""

Severity: Minor
Found in openhealth/openhealthapi/openhealthbot_crud/Get_Diabetes_By_Userid.py - About 5 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function get has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    def get(self,request,state_name,district_name):

        
        """Here  We're  getting  The  available vaccine slots  Based  On  district
        (example: district= Visakhapatnam )"""
Severity: Minor
Found in openhealth/openhealthapi/openhealthbot_crud/findbydistrict.py - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function get has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    def get(self,request,state_name,district_name,Date):
        print(f"Showing you vaccination slots for DistricName: {district_name} and {Date} for next 7 days")
        try:
            b = datetime.datetime.strptime(Date, '%d-%m-%Y')
            if b:
Severity: Minor
Found in openhealth/openhealthapi/openhealthbot_crud/calendarbydistrict.py - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function post has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def post(self, request):
        """Here We Post The Open health bot Diabetes Assessment And We Get Score Of Each Question User
        (Table_Name:'Openhealth_Diabetes_Assessment_table')"""
        try:
            question = request.data.get('QuestionId')

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function post has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def post(self, request):
        """Here We Post The Open health bot LifeStyle Assessment And We Get Score Of Each Question User
        (Table_Name:'Openhealth_Lifestyle_Assessment_table')"""
        try:
            question = request.data.get('QuestionId')

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function post has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def post(self, request):
        """Here We Post The Open health bot Depression Assessment And We Get Score Of Each Question User
        (Table_Name:'Openhealth_Depression_Assessment_table')"""
        try:
            question = request.data.get('QuestionId')

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Avoid deeply nested control flow statements.
Open

                            if int(i['id']) not in count:
                                if a==1:
                                    a+=1
                                    i['Diabetes'] = "Not Answered"
                                    data.append(i)
Severity: Major
Found in openhealth/openhealthapi/openhealthbot_crud/Get_Diabetes_By_Userid.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                if int(i['id']) not in count:
                                    if a==1:
                                        a+=1
                                        i['Lifestyle'] = "Not Answered"
                                        data.append(i)

      Avoid deeply nested control flow statements.
      Open

                                  if j['district_name'] == district_name:
                                      district_id = j['district_id']
                                      
                  
                                      # datee = str(Date)
      Severity: Major
      Found in openhealth/openhealthapi/openhealthbot_crud/calendarbydistrict.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                    for i in range(10):
                                        day = (datetime.date.today() + datetime.timedelta(i)).day
                                        month = (datetime.date.today() + datetime.timedelta(i)).month
                                        year = (datetime.date.today() + datetime.timedelta(i)).year
                                        slot = 0
        Severity: Major
        Found in openhealth/openhealthapi/openhealthbot_crud/findbydistrict.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                      if int(i['id']) in count:
                                          i['Lifestyle'] = j
                                          data.append(i)
                                      else:
                                          pass

            Avoid deeply nested control flow statements.
            Open

                                        if int(i['id']) in count:
                                            i['Depression'] = j
                                            data.append(i)
                                        else:
                                            pass
            Severity: Major
            Found in openhealth/openhealthapi/openhealthbot_crud/Get_Depression_By_UserId.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          if int(i['id']) in count:
                                              i['Diabetes'] = j
                                              data.append(i)
                                          else:
                                              pass
              Severity: Major
              Found in openhealth/openhealthapi/openhealthbot_crud/Get_Diabetes_By_Userid.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                            if int(i['id']) not in count:
                                                if a==1:
                                                    a+=1
                                                    i['Depression'] = "Not Answered"
                                                    data.append(i)
                Severity: Major
                Found in openhealth/openhealthapi/openhealthbot_crud/Get_Depression_By_UserId.py - About 45 mins to fix

                  Function get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def get(self,request,pincode,Date):
                          """Here  We're  getting  The  available vaccine slots  Based  On  pincode and Date
                          (example: pincode= 530016 ,Date= 29-11-2022 )"""
                          # datee = str(Date)
                          # datem = datetime.datetime.strptime(datee, '%Y-%m-%d')
                  Severity: Minor
                  Found in openhealth/openhealthapi/openhealthbot_crud/calendarbypin.py - About 35 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Avoid too many return statements within this function.
                  Open

                              return s
                  Severity: Major
                  Found in openhealth/openhealthapi/score.py - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language