dsi-icl/optimise

View on GitHub
packages/optimise-core/src/utils/selector-utils.js

Summary

Maintainability
F
2 wks
Test Coverage

File selector-utils.js has 467 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import dbcon from '../utils/db-connection';

class SelectorUtils {

    getConcomitantMeds(patientId, deleted) {
Severity: Minor
Found in packages/optimise-core/src/utils/selector-utils.js - About 7 hrs to fix

    SelectorUtils has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class SelectorUtils {
    
        getConcomitantMeds(patientId, deleted) {
            const whereObj = { patient: patientId };
            if (deleted !== true)
    Severity: Minor
    Found in packages/optimise-core/src/utils/selector-utils.js - About 2 hrs to fix

      Function getTreatments has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          getTreatments(patientId, deleted) {
              const _this = this;
              const whereObj = { patient: patientId };
              const innerWhereObj = {};
              if (deleted !== true) {
      Severity: Minor
      Found in packages/optimise-core/src/utils/selector-utils.js - About 1 hr to fix

        Function getClinicalEvents has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            getClinicalEvents(patientId, deleted) {
                const _this = this;
                const whereObj = { patient: patientId };
                const innerWhereObj = {};
                if (deleted !== true) {
        Severity: Minor
        Found in packages/optimise-core/src/utils/selector-utils.js - About 1 hr to fix

          Function getTests has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              getTests(patientId, deleted) {
                  const _this = this;
                  const whereObj = { patient: patientId };
                  const innerWhereObj = {};
                  if (deleted !== true) {
          Severity: Minor
          Found in packages/optimise-core/src/utils/selector-utils.js - About 1 hr to fix

            Function getPregnancyEntries has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                getPregnancyEntries(patientId, deleted) {
                    const _this = this;
                    const whereObj = { patient: patientId };
                    const innerWhereObj = {};
                    if (deleted !== true) {
            Severity: Minor
            Found in packages/optimise-core/src/utils/selector-utils.js - About 1 hr to fix

              Function getVisits has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  getVisits(patientId, deleted) {
                      const _this = this;
                      const whereObj = { 'VISITS.patient': patientId };
                      if (deleted !== true)
                          whereObj['VISITS.deleted'] = '-';
              Severity: Minor
              Found in packages/optimise-core/src/utils/selector-utils.js - About 1 hr to fix

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    getTests(patientId, deleted) {
                        const _this = this;
                        const whereObj = { patient: patientId };
                        const innerWhereObj = {};
                        if (deleted !== true) {
                Severity: Major
                Found in packages/optimise-core/src/utils/selector-utils.js and 1 other location - About 2 days to fix
                packages/optimise-core/src/utils/selector-utils.js on lines 273..313

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 457.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    getPregnancyEntries(patientId, deleted) {
                        const _this = this;
                        const whereObj = { patient: patientId };
                        const innerWhereObj = {};
                        if (deleted !== true) {
                Severity: Major
                Found in packages/optimise-core/src/utils/selector-utils.js and 1 other location - About 2 days to fix
                packages/optimise-core/src/utils/selector-utils.js on lines 144..184

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 457.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    getTestsWithoutData(patientId, deleted) {
                        const whereObj = { patient: patientId };
                        if (deleted !== true)
                            whereObj.deleted = '-';
                        return dbcon()('VISITS').select({ id: 'id' }).where(whereObj).then(resu => {
                Severity: Major
                Found in packages/optimise-core/src/utils/selector-utils.js and 1 other location - About 1 day to fix
                packages/optimise-core/src/utils/selector-utils.js on lines 5..27

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 280.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    getConcomitantMeds(patientId, deleted) {
                        const whereObj = { patient: patientId };
                        if (deleted !== true)
                            whereObj.deleted = '-';
                        return dbcon()('VISITS').select({ id: 'id' }).where(whereObj).then(resu => {
                Severity: Major
                Found in packages/optimise-core/src/utils/selector-utils.js and 1 other location - About 1 day to fix
                packages/optimise-core/src/utils/selector-utils.js on lines 120..142

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 280.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                            return dbcon()('CLINICAL_EVENTS')
                                .select({ id: 'CLINICAL_EVENTS.id', recordedDuringVisit: 'CLINICAL_EVENTS.recordedDuringVisit', type: 'CLINICAL_EVENTS.type', type_name: 'AVAILABLE_CLINICAL_EVENT_TYPES.name', type_module: 'AVAILABLE_CLINICAL_EVENT_TYPES.module', dateStartDate: 'CLINICAL_EVENTS.dateStartDate', endDate: 'CLINICAL_EVENTS.endDate', meddra: 'CLINICAL_EVENTS.meddra', meddra_code: 'ADVERSE_EVENT_MEDDRA.code', deleted: 'CLINICAL_EVENTS.deleted' })
                                .leftJoin('AVAILABLE_CLINICAL_EVENT_TYPES', 'AVAILABLE_CLINICAL_EVENT_TYPES.id', 'CLINICAL_EVENTS.type')
                                .leftJoin('ADVERSE_EVENT_MEDDRA', 'ADVERSE_EVENT_MEDDRA.id', 'CLINICAL_EVENTS.meddra')
                                .where(builder => builder.where('CLINICAL_EVENTS.patient', patientId).orWhere('CLINICAL_EVENTS.recordedDuringVisit', 'in', ids))
                Severity: Major
                Found in packages/optimise-core/src/utils/selector-utils.js and 1 other location - About 4 hrs to fix
                packages/optimise-core/src/utils/selector-utils.js on lines 429..455

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 131.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                            return dbcon()('CLINICAL_EVENTS')
                                .select({ id: 'CLINICAL_EVENTS.id', recordedDuringVisit: 'CLINICAL_EVENTS.recordedDuringVisit', type: 'CLINICAL_EVENTS.type', type_name: 'AVAILABLE_CLINICAL_EVENT_TYPES.name', type_module: 'AVAILABLE_CLINICAL_EVENT_TYPES.module', dateStartDate: 'CLINICAL_EVENTS.dateStartDate', endDate: 'CLINICAL_EVENTS.endDate', meddra: 'CLINICAL_EVENTS.meddra', meddra_code: 'ADVERSE_EVENT_MEDDRA.code', deleted: 'CLINICAL_EVENTS.deleted' })
                                .leftJoin('AVAILABLE_CLINICAL_EVENT_TYPES', 'AVAILABLE_CLINICAL_EVENT_TYPES.id', 'CLINICAL_EVENTS.type')
                                .leftJoin('ADVERSE_EVENT_MEDDRA', 'ADVERSE_EVENT_MEDDRA.id', 'CLINICAL_EVENTS.meddra')
                                .where(builder => builder.where('CLINICAL_EVENTS.patient', patientId).orWhere('CLINICAL_EVENTS.recordedDuringVisit', 'in', ids))
                Severity: Major
                Found in packages/optimise-core/src/utils/selector-utils.js and 1 other location - About 4 hrs to fix
                packages/optimise-core/src/utils/selector-utils.js on lines 403..412

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 131.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    _getPregnancyEntryData(pregnancyEntryId, deleted) {
                        const whereObj = { 'PREGNANCY_ENTRY_DATA.pregnancyEntry': pregnancyEntryId };
                        if (deleted !== true)
                            whereObj['PREGNANCY_ENTRY_DATA.deleted'] = '-';
                        return dbcon()('PREGNANCY_ENTRY_DATA')
                Severity: Major
                Found in packages/optimise-core/src/utils/selector-utils.js and 1 other location - About 3 hrs to fix
                packages/optimise-core/src/utils/selector-utils.js on lines 350..358

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 114.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    _getTestData(testId, deleted) {
                        const whereObj = { 'TEST_DATA.test': testId };
                        if (deleted !== true)
                            whereObj['TEST_DATA.deleted'] = '-';
                        return dbcon()('TEST_DATA')
                Severity: Major
                Found in packages/optimise-core/src/utils/selector-utils.js and 1 other location - About 3 hrs to fix
                packages/optimise-core/src/utils/selector-utils.js on lines 360..368

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 114.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    _getVisitData(visitId, deleted) {
                        const whereObj = { 'VISIT_DATA.visit': visitId };
                        if (deleted !== true)
                            whereObj['VISIT_DATA.deleted'] = '-';
                        return dbcon()('VISIT_DATA')
                Severity: Major
                Found in packages/optimise-core/src/utils/selector-utils.js and 1 other location - About 3 hrs to fix
                packages/optimise-core/src/utils/selector-utils.js on lines 381..389

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 109.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    _getCeData(ceId, deleted) {
                        const whereObj = { 'CLINICAL_EVENTS_DATA.clinicalEvent': ceId };
                        if (deleted !== true)
                            whereObj['CLINICAL_EVENTS_DATA.deleted'] = '-';
                        return dbcon()('CLINICAL_EVENTS_DATA')
                Severity: Major
                Found in packages/optimise-core/src/utils/selector-utils.js and 1 other location - About 3 hrs to fix
                packages/optimise-core/src/utils/selector-utils.js on lines 340..348

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 109.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        return dbcon()('PATIENT_PREGNANCY')
                            .select({ id: 'PATIENT_PREGNANCY.id', startDate: 'PATIENT_PREGNANCY.startDate', outcome: 'PATIENT_PREGNANCY.outcome', outcome_value: 'PREGNANCY_OUTCOMES.value', outcomeDate: 'PATIENT_PREGNANCY.outcomeDate', meddra: 'PATIENT_PREGNANCY.meddra', meddra_code: 'ADVERSE_EVENT_MEDDRA.code', deleted: 'PATIENT_PREGNANCY.deleted' })
                            .leftJoin('PREGNANCY_OUTCOMES', 'PREGNANCY_OUTCOMES.id', 'PATIENT_PREGNANCY.outcome')
                            .leftJoin('ADVERSE_EVENT_MEDDRA', 'ADVERSE_EVENT_MEDDRA.id', 'PATIENT_PREGNANCY.meddra')
                            .where(whereObj)
                Severity: Major
                Found in packages/optimise-core/src/utils/selector-utils.js and 1 other location - About 2 hrs to fix
                packages/optimise-core/src/utils/selector-utils.js on lines 374..378

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 85.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        return dbcon()('TREATMENTS_INTERRUPTIONS')
                            .select({ id: 'TREATMENTS_INTERRUPTIONS.id', reason: 'TREATMENTS_INTERRUPTIONS.reason', reason_value: 'REASONS.value', startDate: 'TREATMENTS_INTERRUPTIONS.startDate', endDate: 'TREATMENTS_INTERRUPTIONS.endDate', meddra: 'TREATMENTS_INTERRUPTIONS.meddra', meddra_code: 'ADVERSE_EVENT_MEDDRA.code', deleted: 'TREATMENTS_INTERRUPTIONS.deleted' })
                            .leftJoin('REASONS', 'REASONS.id', 'TREATMENTS_INTERRUPTIONS.reason')
                            .leftJoin('ADVERSE_EVENT_MEDDRA', 'ADVERSE_EVENT_MEDDRA.id', 'TREATMENTS_INTERRUPTIONS.meddra')
                            .where(whereObj);
                Severity: Major
                Found in packages/optimise-core/src/utils/selector-utils.js and 1 other location - About 2 hrs to fix
                packages/optimise-core/src/utils/selector-utils.js on lines 238..242

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 85.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        return dbcon()('VISITS')
                            .select({ id: 'VISITS.id', visitDate: 'VISITS.visitDate', type: 'VISITS.type', type_name: 'AVAILABLE_VISIT_TYPES.name', type_module: 'AVAILABLE_VISIT_TYPES.module', communication: 'VISITS.communication', deleted: 'VISITS.deleted' })
                            .leftJoin('AVAILABLE_VISIT_TYPES', 'AVAILABLE_VISIT_TYPES.id', 'VISITS.type')
                            .where(whereObj)
                            .then(result => {
                Severity: Major
                Found in packages/optimise-core/src/utils/selector-utils.js and 1 other location - About 2 hrs to fix
                packages/optimise-core/src/utils/selector-utils.js on lines 78..85

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 75.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        return dbcon()('VISITS')
                            .select({ visitId: 'VISITS.id', visitDate: 'VISITS.visitDate', type: 'VISITS.type', type_name: 'AVAILABLE_VISIT_TYPES.name', type_module: 'AVAILABLE_VISIT_TYPES.module', communication: 'VISITS.communication', deleted: 'VISITS.deleted' })
                            .leftJoin('AVAILABLE_VISIT_TYPES', 'AVAILABLE_VISIT_TYPES.id', 'VISITS.type')
                            .where(whereObj)
                            .then(result => {
                Severity: Major
                Found in packages/optimise-core/src/utils/selector-utils.js and 1 other location - About 2 hrs to fix
                packages/optimise-core/src/utils/selector-utils.js on lines 93..117

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 75.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                            for (let i = 0; i < resu.length; i++) {
                                ids[i] = resu[i].id;
                                dates[resu[i].id] = resu[i].visitDate;
                            }
                Severity: Major
                Found in packages/optimise-core/src/utils/selector-utils.js and 1 other location - About 1 hr to fix
                packages/optimise-core/src/utils/selector-utils.js on lines 483..486

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 73.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                            for (let i = 0; i < resu.length; i++) {
                                ids[i] = resu[i].id;
                                dates[resu[i].id] = resu[i].visitDate;
                            }
                Severity: Major
                Found in packages/optimise-core/src/utils/selector-utils.js and 1 other location - About 1 hr to fix
                packages/optimise-core/src/utils/selector-utils.js on lines 197..200

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 73.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        return dbcon()('VISITS').select({ id: 'id', visitDate: 'visitDate', type: 'type', deleted: 'deleted' }).where(whereObj).then(resu => {
                            const ids = [];
                            const dates = [];
                            for (let i = 0; i < resu.length; i++) {
                                ids[i] = resu[i].id;
                Severity: Minor
                Found in packages/optimise-core/src/utils/selector-utils.js and 1 other location - About 45 mins to fix
                packages/optimise-core/src/utils/selector-utils.js on lines 194..231

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 50.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                        return dbcon()('VISITS').select({ id: 'id', visitDate: 'visitDate', type: 'type', deleted: 'deleted' }).where(whereObj).then(resu => {
                            const ids = [];
                            const dates = [];
                            for (let i = 0; i < resu.length; i++) {
                                ids[i] = resu[i].id;
                Severity: Minor
                Found in packages/optimise-core/src/utils/selector-utils.js and 1 other location - About 45 mins to fix
                packages/optimise-core/src/utils/selector-utils.js on lines 480..493

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 50.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                            .select({ id: 'MEDICAL_HISTORY.id', relation: 'MEDICAL_HISTORY.relation', relation_value: 'RELATIONS.value', conditionName: 'MEDICAL_HISTORY.conditionName', conditionName_value: 'CONDITIONS.value', startDate: 'MEDICAL_HISTORY.startDate', outcome: 'MEDICAL_HISTORY.outcome', resolvedYear: 'MEDICAL_HISTORY.resolvedYear', deleted: 'MEDICAL_HISTORY.deleted' })
                Severity: Minor
                Found in packages/optimise-core/src/utils/selector-utils.js and 1 other location - About 35 mins to fix
                packages/optimise-ui/src/components/patientProfile/fullTimeline.jsx on lines 13..23

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 47.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 3 locations. Consider refactoring.
                Open

                        return dbcon()('PATIENT_DIAGNOSIS')
                            .select({ id: 'PATIENT_DIAGNOSIS.id', diagnosis: 'PATIENT_DIAGNOSIS.diagnosis', diagnosis_value: 'AVAILABLE_DIAGNOSES.value', diagnosisDate: 'PATIENT_DIAGNOSIS.diagnosisDate', deleted: 'PATIENT_DIAGNOSIS.deleted' })
                            .leftJoin('AVAILABLE_DIAGNOSES', 'AVAILABLE_DIAGNOSES.id', 'PATIENT_DIAGNOSIS.diagnosis')
                Severity: Minor
                Found in packages/optimise-core/src/utils/selector-utils.js and 2 other locations - About 35 mins to fix
                packages/optimise-core/src/core/user.js on lines 10..10
                packages/optimise-core/src/core/user.js on lines 14..14

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 47.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                There are no issues that match your filters.

                Category
                Status