dsi-icl/optimise

View on GitHub

Showing 1,390 of 1,390 total issues

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

        visitCore.getVisit(query.patientId).then((result) => {
            res.status(200).json(formatToJSON(result));
            return true;
        }).catch((error) => {
            res.status(400).json(ErrorHelper(message.errorMessages.GETFAIL, error));
Severity: Major
Found in packages/optimise-core/src/controllers/visitController.js and 1 other location - About 3 hrs to fix
packages/optimise-core/src/controllers/userController.js on lines 179..185

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 104.

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

Function itemRenderer has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    itemRenderer({ item, getItemProps, timelineContext }) {

        let itemProps = getItemProps(item.itemProps);
        const itemPropsStyle = {
            ...itemProps.style,
Severity: Minor
Found in packages/optimise-ui/src/components/patientProfile/fullTimeline.jsx - 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 render has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    render() {
        const { reference, choices, origVal } = this.props;
        if (choices.includes('LEFT'))
            return (
                <>
Severity: Minor
Found in packages/optimise-ui/src/components/medicalData/utils.jsx - 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

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

                                    <Route path='/patientProfile/:patientId/visitFrontPage/:visitId/page/:currentPage/data/:ceId' render={({ match, location }) => <EventCreatedMessage location={location} match={match} events={this.props.data.clinicalEvents} typeHash={this.props.typeHash} meddraHash={this.props.meddraHash}/>}/>
packages/optimise-ui/src/components/createVisitFrontPage/componentWrappers/ce/relapseWrapper.jsx on lines 32..32

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 103.

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

                                    <Route path='/patientProfile/:patientId/visitFrontPage/:visitId/page/:currentPage/data/:ceId' render={({ match, location }) => <EventCreatedMessage location={location} match={match} events={this.props.data.clinicalEvents} typeHash={this.props.typeHash} meddraHash={this.props.meddraHash}/>}/>
packages/optimise-ui/src/components/createVisitFrontPage/componentWrappers/ce/otherSAEWrapper.jsx on lines 32..32

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 103.

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

                                        <select onChange={this._handleOutcomeChange} value={outcome}>
                                            <option value='unselected'></option>
                                            {pregnancyOutcomes.map(el => <option key={el.id} value={el.id}>{el.value}</option>)}
                                        </select><br /><br />
packages/optimise-ui/src/components/editMedicalElements/editPrimaryDiagnosis.jsx on lines 244..247
packages/optimise-ui/src/components/medicalData/treatmentInterruptions.jsx on lines 348..351

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 102.

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

                                <select onChange={this._handleReasonChange} value={reason}>
                                    <option value='unselected'></option>
                                    {interruptionReasons.map(el => <option key={el.id} value={el.id}>{el.value}</option>)}
                                </select><br /><br />
packages/optimise-ui/src/components/editMedicalElements/editPregnancy.jsx on lines 331..334
packages/optimise-ui/src/components/editMedicalElements/editPrimaryDiagnosis.jsx on lines 244..247

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 102.

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

                                <select onChange={this._handleDiagnosisChange} value={diagnosis}>
                                    <option value='unselected'></option>
                                    {diagnoses.map(el => <option key={el.id} value={el.id}>{el.value}</option>)}
                                </select><br /><br />
packages/optimise-ui/src/components/editMedicalElements/editPregnancy.jsx on lines 331..334
packages/optimise-ui/src/components/medicalData/treatmentInterruptions.jsx on lines 348..351

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 102.

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

Function edssAlgorithm has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function edssAlgorithm(FSArrayWithoutAmbulation, ambulationScore) {

    if (FSArrayWithoutAmbulation.length === 0)
        return '';
Severity: Major
Found in packages/optimise-ui/src/components/EDSScalculator/calculator.jsx - About 3 hrs to fix

    Function createPregnancy has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        static createPregnancy({ body, user }, res) {
            if (body.hasOwnProperty('patient') && typeof body.patient === 'number') {
    
                if (body.hasOwnProperty('meddra') && body.meddra !== null && isNaN(parseInt(body.meddra))) {
                    res.status(400).json(ErrorHelper(message.userError.WRONGARGUMENTS));
    Severity: Minor
    Found in packages/optimise-core/src/controllers/demographicDataController.js - 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 alterPregnancyItemsCall has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    export const alterPregnancyItemsCall = (body, callback) => async (dispatch) => {
        try {
            //if pregnancy entry needs to be created and entry type is 1 (baseline) then new pregnancy needs to be created
    
            const pregnancyMethod = body.pregnancyEntry?.type === 1 && !body.pregnancy.id ? 'POST' : 'PUT';
    Severity: Minor
    Found in packages/optimise-ui/src/redux/actions/demographicData.js - 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 addInterruption has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        static addInterruption({ body, user }, res) {    //need to search if treatment exists
            if (body.hasOwnProperty('treatmentId') && body.hasOwnProperty('start_date') &&
                typeof body.treatmentId === 'number' && typeof body.start_date === 'string') {
                const momentStart = moment(body.start_date, moment.ISO_8601);
                const momentEnd = moment(body.end_date, moment.ISO_8601);
    Severity: Minor
    Found in packages/optimise-core/src/controllers/treatmentController.js - 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

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

            userCore.getUserByUsername(queryUsername).then((result) => {
                res.status(200).json(formatToJSON(result));
                return true;
            }).catch((error) => {
                res.status(400).json(ErrorHelper(message.errorMessages.GETFAIL, error));
    Severity: Major
    Found in packages/optimise-core/src/controllers/userController.js and 23 other locations - About 3 hrs to fix
    packages/optimise-core/src/controllers/actionController.js on lines 18..24
    packages/optimise-core/src/controllers/ceController.js on lines 39..45
    packages/optimise-core/src/controllers/comorbidityController.js on lines 20..26
    packages/optimise-core/src/controllers/comorbidityController.js on lines 43..49
    packages/optimise-core/src/controllers/concomitantMedController.js on lines 39..45
    packages/optimise-core/src/controllers/demographicDataController.js on lines 44..50
    packages/optimise-core/src/controllers/demographicDataController.js on lines 69..75
    packages/optimise-core/src/controllers/demographicDataController.js on lines 107..113
    packages/optimise-core/src/controllers/demographicDataController.js on lines 380..386
    packages/optimise-core/src/controllers/demographicDataController.js on lines 426..432
    packages/optimise-core/src/controllers/demographicDataController.js on lines 525..531
    packages/optimise-core/src/controllers/demographicDataController.js on lines 614..620
    packages/optimise-core/src/controllers/patientDiagnosisController.js on lines 44..50
    packages/optimise-core/src/controllers/patientPiiController.js on lines 36..42
    packages/optimise-core/src/controllers/syncController.js on lines 31..37
    packages/optimise-core/src/controllers/syncController.js on lines 55..61
    packages/optimise-core/src/controllers/testController.js on lines 39..45
    packages/optimise-core/src/controllers/treatmentController.js on lines 64..70
    packages/optimise-core/src/controllers/userController.js on lines 110..116
    packages/optimise-core/src/controllers/userController.js on lines 147..153
    packages/optimise-core/src/controllers/visitController.js on lines 50..56
    packages/optimise-core/src/controllers/visitController.js on lines 112..118
    packages/optimise-core/src/controllers/visitController.js on lines 134..140

    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 100.

    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 24 locations. Consider refactoring.
    Open

            visitCore.createVisit(entryObj).then((result) => {
                res.status(200).json(formatToJSON(result));
                return true;
            }).catch((error) => {
                res.status(400).json(ErrorHelper(message.errorMessages.CREATIONFAIL, error));
    Severity: Major
    Found in packages/optimise-core/src/controllers/visitController.js and 23 other locations - About 3 hrs to fix
    packages/optimise-core/src/controllers/actionController.js on lines 18..24
    packages/optimise-core/src/controllers/ceController.js on lines 39..45
    packages/optimise-core/src/controllers/comorbidityController.js on lines 20..26
    packages/optimise-core/src/controllers/comorbidityController.js on lines 43..49
    packages/optimise-core/src/controllers/concomitantMedController.js on lines 39..45
    packages/optimise-core/src/controllers/demographicDataController.js on lines 44..50
    packages/optimise-core/src/controllers/demographicDataController.js on lines 69..75
    packages/optimise-core/src/controllers/demographicDataController.js on lines 107..113
    packages/optimise-core/src/controllers/demographicDataController.js on lines 380..386
    packages/optimise-core/src/controllers/demographicDataController.js on lines 426..432
    packages/optimise-core/src/controllers/demographicDataController.js on lines 525..531
    packages/optimise-core/src/controllers/demographicDataController.js on lines 614..620
    packages/optimise-core/src/controllers/patientDiagnosisController.js on lines 44..50
    packages/optimise-core/src/controllers/patientPiiController.js on lines 36..42
    packages/optimise-core/src/controllers/syncController.js on lines 31..37
    packages/optimise-core/src/controllers/syncController.js on lines 55..61
    packages/optimise-core/src/controllers/testController.js on lines 39..45
    packages/optimise-core/src/controllers/treatmentController.js on lines 64..70
    packages/optimise-core/src/controllers/userController.js on lines 58..64
    packages/optimise-core/src/controllers/userController.js on lines 110..116
    packages/optimise-core/src/controllers/userController.js on lines 147..153
    packages/optimise-core/src/controllers/visitController.js on lines 112..118
    packages/optimise-core/src/controllers/visitController.js on lines 134..140

    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 100.

    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 24 locations. Consider refactoring.
    Open

            DemographicCore.createDemographic(entryObj).then((result) => {
                res.status(200).json(formatToJSON(result));
                return true;
            }).catch((error) => {
                res.status(400).json(ErrorHelper(message.errorMessages.CREATIONFAIL, error));
    packages/optimise-core/src/controllers/actionController.js on lines 18..24
    packages/optimise-core/src/controllers/ceController.js on lines 39..45
    packages/optimise-core/src/controllers/comorbidityController.js on lines 20..26
    packages/optimise-core/src/controllers/comorbidityController.js on lines 43..49
    packages/optimise-core/src/controllers/concomitantMedController.js on lines 39..45
    packages/optimise-core/src/controllers/demographicDataController.js on lines 69..75
    packages/optimise-core/src/controllers/demographicDataController.js on lines 107..113
    packages/optimise-core/src/controllers/demographicDataController.js on lines 380..386
    packages/optimise-core/src/controllers/demographicDataController.js on lines 426..432
    packages/optimise-core/src/controllers/demographicDataController.js on lines 525..531
    packages/optimise-core/src/controllers/demographicDataController.js on lines 614..620
    packages/optimise-core/src/controllers/patientDiagnosisController.js on lines 44..50
    packages/optimise-core/src/controllers/patientPiiController.js on lines 36..42
    packages/optimise-core/src/controllers/syncController.js on lines 31..37
    packages/optimise-core/src/controllers/syncController.js on lines 55..61
    packages/optimise-core/src/controllers/testController.js on lines 39..45
    packages/optimise-core/src/controllers/treatmentController.js on lines 64..70
    packages/optimise-core/src/controllers/userController.js on lines 58..64
    packages/optimise-core/src/controllers/userController.js on lines 110..116
    packages/optimise-core/src/controllers/userController.js on lines 147..153
    packages/optimise-core/src/controllers/visitController.js on lines 50..56
    packages/optimise-core/src/controllers/visitController.js on lines 112..118
    packages/optimise-core/src/controllers/visitController.js on lines 134..140

    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 100.

    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 24 locations. Consider refactoring.
    Open

            syncCore.triggerSync(body).then((result) => {
                res.status(200).json(formatToJSON(result));
                return true;
            }).catch((error) => {
                res.status(400).json(ErrorHelper(message.errorMessages.GETFAIL, error));
    Severity: Major
    Found in packages/optimise-core/src/controllers/syncController.js and 23 other locations - About 3 hrs to fix
    packages/optimise-core/src/controllers/actionController.js on lines 18..24
    packages/optimise-core/src/controllers/ceController.js on lines 39..45
    packages/optimise-core/src/controllers/comorbidityController.js on lines 20..26
    packages/optimise-core/src/controllers/comorbidityController.js on lines 43..49
    packages/optimise-core/src/controllers/concomitantMedController.js on lines 39..45
    packages/optimise-core/src/controllers/demographicDataController.js on lines 44..50
    packages/optimise-core/src/controllers/demographicDataController.js on lines 69..75
    packages/optimise-core/src/controllers/demographicDataController.js on lines 107..113
    packages/optimise-core/src/controllers/demographicDataController.js on lines 380..386
    packages/optimise-core/src/controllers/demographicDataController.js on lines 426..432
    packages/optimise-core/src/controllers/demographicDataController.js on lines 525..531
    packages/optimise-core/src/controllers/demographicDataController.js on lines 614..620
    packages/optimise-core/src/controllers/patientDiagnosisController.js on lines 44..50
    packages/optimise-core/src/controllers/patientPiiController.js on lines 36..42
    packages/optimise-core/src/controllers/syncController.js on lines 31..37
    packages/optimise-core/src/controllers/testController.js on lines 39..45
    packages/optimise-core/src/controllers/treatmentController.js on lines 64..70
    packages/optimise-core/src/controllers/userController.js on lines 58..64
    packages/optimise-core/src/controllers/userController.js on lines 110..116
    packages/optimise-core/src/controllers/userController.js on lines 147..153
    packages/optimise-core/src/controllers/visitController.js on lines 50..56
    packages/optimise-core/src/controllers/visitController.js on lines 112..118
    packages/optimise-core/src/controllers/visitController.js on lines 134..140

    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 100.

    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 24 locations. Consider refactoring.
    Open

            TestCore.createTest(entryObj).then((result) => {
                res.status(200).json(formatToJSON(result));
                return true;
            }).catch((error) => {
                res.status(400).json(ErrorHelper(message.errorMessages.CREATIONFAIL, error));
    Severity: Major
    Found in packages/optimise-core/src/controllers/testController.js and 23 other locations - About 3 hrs to fix
    packages/optimise-core/src/controllers/actionController.js on lines 18..24
    packages/optimise-core/src/controllers/ceController.js on lines 39..45
    packages/optimise-core/src/controllers/comorbidityController.js on lines 20..26
    packages/optimise-core/src/controllers/comorbidityController.js on lines 43..49
    packages/optimise-core/src/controllers/concomitantMedController.js on lines 39..45
    packages/optimise-core/src/controllers/demographicDataController.js on lines 44..50
    packages/optimise-core/src/controllers/demographicDataController.js on lines 69..75
    packages/optimise-core/src/controllers/demographicDataController.js on lines 107..113
    packages/optimise-core/src/controllers/demographicDataController.js on lines 380..386
    packages/optimise-core/src/controllers/demographicDataController.js on lines 426..432
    packages/optimise-core/src/controllers/demographicDataController.js on lines 525..531
    packages/optimise-core/src/controllers/demographicDataController.js on lines 614..620
    packages/optimise-core/src/controllers/patientDiagnosisController.js on lines 44..50
    packages/optimise-core/src/controllers/patientPiiController.js on lines 36..42
    packages/optimise-core/src/controllers/syncController.js on lines 31..37
    packages/optimise-core/src/controllers/syncController.js on lines 55..61
    packages/optimise-core/src/controllers/treatmentController.js on lines 64..70
    packages/optimise-core/src/controllers/userController.js on lines 58..64
    packages/optimise-core/src/controllers/userController.js on lines 110..116
    packages/optimise-core/src/controllers/userController.js on lines 147..153
    packages/optimise-core/src/controllers/visitController.js on lines 50..56
    packages/optimise-core/src/controllers/visitController.js on lines 112..118
    packages/optimise-core/src/controllers/visitController.js on lines 134..140

    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 100.

    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 24 locations. Consider refactoring.
    Open

            Comorbidity.createComorbidity(entryObj).then((result) => {
                res.status(200).json(formatToJSON(result));
                return true;
            }).catch((error) => {
                res.status(400).json(ErrorHelper(message.errorMessages.CREATIONFAIL, error));
    packages/optimise-core/src/controllers/actionController.js on lines 18..24
    packages/optimise-core/src/controllers/ceController.js on lines 39..45
    packages/optimise-core/src/controllers/comorbidityController.js on lines 20..26
    packages/optimise-core/src/controllers/concomitantMedController.js on lines 39..45
    packages/optimise-core/src/controllers/demographicDataController.js on lines 44..50
    packages/optimise-core/src/controllers/demographicDataController.js on lines 69..75
    packages/optimise-core/src/controllers/demographicDataController.js on lines 107..113
    packages/optimise-core/src/controllers/demographicDataController.js on lines 380..386
    packages/optimise-core/src/controllers/demographicDataController.js on lines 426..432
    packages/optimise-core/src/controllers/demographicDataController.js on lines 525..531
    packages/optimise-core/src/controllers/demographicDataController.js on lines 614..620
    packages/optimise-core/src/controllers/patientDiagnosisController.js on lines 44..50
    packages/optimise-core/src/controllers/patientPiiController.js on lines 36..42
    packages/optimise-core/src/controllers/syncController.js on lines 31..37
    packages/optimise-core/src/controllers/syncController.js on lines 55..61
    packages/optimise-core/src/controllers/testController.js on lines 39..45
    packages/optimise-core/src/controllers/treatmentController.js on lines 64..70
    packages/optimise-core/src/controllers/userController.js on lines 58..64
    packages/optimise-core/src/controllers/userController.js on lines 110..116
    packages/optimise-core/src/controllers/userController.js on lines 147..153
    packages/optimise-core/src/controllers/visitController.js on lines 50..56
    packages/optimise-core/src/controllers/visitController.js on lines 112..118
    packages/optimise-core/src/controllers/visitController.js on lines 134..140

    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 100.

    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 24 locations. Consider refactoring.
    Open

                clinicalEventCore.createClinicalEvent(ce).then((result) => {
                    res.status(200).json(formatToJSON(result));
                    return true;
                }).catch((error) => {
                    res.status(400).json(ErrorHelper(message.errorMessages.CREATIONFAIL, error));
    Severity: Major
    Found in packages/optimise-core/src/controllers/ceController.js and 23 other locations - About 3 hrs to fix
    packages/optimise-core/src/controllers/actionController.js on lines 18..24
    packages/optimise-core/src/controllers/comorbidityController.js on lines 20..26
    packages/optimise-core/src/controllers/comorbidityController.js on lines 43..49
    packages/optimise-core/src/controllers/concomitantMedController.js on lines 39..45
    packages/optimise-core/src/controllers/demographicDataController.js on lines 44..50
    packages/optimise-core/src/controllers/demographicDataController.js on lines 69..75
    packages/optimise-core/src/controllers/demographicDataController.js on lines 107..113
    packages/optimise-core/src/controllers/demographicDataController.js on lines 380..386
    packages/optimise-core/src/controllers/demographicDataController.js on lines 426..432
    packages/optimise-core/src/controllers/demographicDataController.js on lines 525..531
    packages/optimise-core/src/controllers/demographicDataController.js on lines 614..620
    packages/optimise-core/src/controllers/patientDiagnosisController.js on lines 44..50
    packages/optimise-core/src/controllers/patientPiiController.js on lines 36..42
    packages/optimise-core/src/controllers/syncController.js on lines 31..37
    packages/optimise-core/src/controllers/syncController.js on lines 55..61
    packages/optimise-core/src/controllers/testController.js on lines 39..45
    packages/optimise-core/src/controllers/treatmentController.js on lines 64..70
    packages/optimise-core/src/controllers/userController.js on lines 58..64
    packages/optimise-core/src/controllers/userController.js on lines 110..116
    packages/optimise-core/src/controllers/userController.js on lines 147..153
    packages/optimise-core/src/controllers/visitController.js on lines 50..56
    packages/optimise-core/src/controllers/visitController.js on lines 112..118
    packages/optimise-core/src/controllers/visitController.js on lines 134..140

    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 100.

    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 24 locations. Consider refactoring.
    Open

            visitCore.getReport(whereObj).then((result) => {
                res.status(200).json(formatToJSON(result));
                return true;
            }).catch((error) => {
                res.status(400).json(ErrorHelper(message.errorMessages.GETFAIL, error));
    Severity: Major
    Found in packages/optimise-core/src/controllers/visitController.js and 23 other locations - About 3 hrs to fix
    packages/optimise-core/src/controllers/actionController.js on lines 18..24
    packages/optimise-core/src/controllers/ceController.js on lines 39..45
    packages/optimise-core/src/controllers/comorbidityController.js on lines 20..26
    packages/optimise-core/src/controllers/comorbidityController.js on lines 43..49
    packages/optimise-core/src/controllers/concomitantMedController.js on lines 39..45
    packages/optimise-core/src/controllers/demographicDataController.js on lines 44..50
    packages/optimise-core/src/controllers/demographicDataController.js on lines 69..75
    packages/optimise-core/src/controllers/demographicDataController.js on lines 107..113
    packages/optimise-core/src/controllers/demographicDataController.js on lines 380..386
    packages/optimise-core/src/controllers/demographicDataController.js on lines 426..432
    packages/optimise-core/src/controllers/demographicDataController.js on lines 525..531
    packages/optimise-core/src/controllers/demographicDataController.js on lines 614..620
    packages/optimise-core/src/controllers/patientDiagnosisController.js on lines 44..50
    packages/optimise-core/src/controllers/patientPiiController.js on lines 36..42
    packages/optimise-core/src/controllers/syncController.js on lines 31..37
    packages/optimise-core/src/controllers/syncController.js on lines 55..61
    packages/optimise-core/src/controllers/testController.js on lines 39..45
    packages/optimise-core/src/controllers/treatmentController.js on lines 64..70
    packages/optimise-core/src/controllers/userController.js on lines 58..64
    packages/optimise-core/src/controllers/userController.js on lines 110..116
    packages/optimise-core/src/controllers/userController.js on lines 147..153
    packages/optimise-core/src/controllers/visitController.js on lines 50..56
    packages/optimise-core/src/controllers/visitController.js on lines 134..140

    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 100.

    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

    Severity
    Category
    Status
    Source
    Language