dsi-icl/optimise

View on GitHub

Showing 1,390 of 1,390 total issues

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

treatment.route('/')
    .post(TreatmentController.createTreatment)
    .patch(TreatmentController.addTerminationDate)
    .put(TreatmentController.editTreatment)
    .delete(TreatmentController.deleteTreatment);
Severity: Major
Found in packages/optimise-core/src/routes/treatmentRoute.js and 2 other locations - About 1 hr to fix
packages/optimise-core/src/routes/visitRoute.js on lines 13..17
packages/optimise-core/src/routes/visitRoute.js on lines 19..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 59.

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

@withRouter
@connect(state => ({
    fetching: state.patientProfile.fetching,
    data: state.patientProfile.data,
    drugHash: state.availableFields.drugs_Hash[0]
packages/optimise-ui/src/components/createVisitFrontPage/componentWrappers/pregnancy/pregnancyWrapper.jsx on lines 12..54

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

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

visit.route('/report')
    .get(VisitController.getReportOfVisit)
    .post(VisitController.createReport)
    .put(VisitController.updateReport)
    .delete(VisitController.deleteReport);
Severity: Major
Found in packages/optimise-core/src/routes/visitRoute.js and 2 other locations - About 1 hr to fix
packages/optimise-core/src/routes/treatmentRoute.js on lines 12..16
packages/optimise-core/src/routes/visitRoute.js on lines 19..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 59.

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

            if (parseFloat(item.start) > timelineContext.visibleTimeStart)
                x2 = x2 + ((timelineContext.visibleTimeStart - parseFloat(item.start)) * timelineContext.timelineWidth / unit);
packages/optimise-ui/src/components/patientProfile/fullTimeline.jsx on lines 378..379

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

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

    static getPregnancyEntry(whereObj) {
        return new Promise((resolve, reject) => getEntry('PREGNANCY_ENTRY', whereObj, '*').then((result) => resolve(result)).catch((error) => reject(error)));
    }
Severity: Major
Found in packages/optimise-core/src/core/demographic.js and 1 other location - About 1 hr to fix
packages/optimise-core/src/core/demographic.js on lines 167..169

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

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

    static getPregnancyImage(whereObj) {
        return new Promise((resolve, reject) => getEntry('PATIENT_PREGNANCY_IMAGING', whereObj, '*').then((result) => resolve(result)).catch((error) => reject(error)));
    }
Severity: Major
Found in packages/optimise-core/src/core/demographic.js and 1 other location - About 1 hr to fix
packages/optimise-core/src/core/demographic.js on lines 184..186

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

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

@withRouter
@connect(state => ({
    fetching: state.patientProfile.fetching,
    data: state.patientProfile.data,
    drugHash: state.availableFields.drugs_Hash[0]
packages/optimise-ui/src/components/createVisitFrontPage/componentWrappers/treatment/treatmentWrapper.jsx on lines 14..52

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

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

            if (parseFloat(item.start) > timelineContext.visibleTimeStart)
                x2i = x2i + ((timelineContext.visibleTimeStart - parseFloat(item.start)) * timelineContext.timelineWidth / unit);
packages/optimise-ui/src/components/patientProfile/fullTimeline.jsx on lines 312..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 59.

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 getMeddraField has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    static async getMeddraField({ query }, res) {
        const result = [];
        const maxOccurency = 20;
        await MeddraController.loadMeddraCollection();
        if (query.hasOwnProperty('search')) {
Severity: Minor
Found in packages/optimise-core/src/controllers/meddraController.js - About 1 hr to fix

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

        static editTreatment({ body, user }, res) {
            if (body.hasOwnProperty('id') && typeof body.id === 'number') {
    
                const momentStart = moment(body.startDate, moment.ISO_8601);
                const momentTerminated = moment(body.terminatedDate, moment.ISO_8601);
    Severity: Minor
    Found in packages/optimise-core/src/controllers/treatmentController.js - About 1 hr to fix

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

          static createImmunisation({ body, user }, res) {
              if (body.hasOwnProperty('patient') && body.hasOwnProperty('immunisationDate') && body.hasOwnProperty('vaccineName') &&
                  typeof body.patient === 'number' && typeof body.immunisationDate === 'string' && typeof body.vaccineName === 'string') {
                  const momentImmun = moment(body.immunisationDate, moment.ISO_8601);
                  if (!momentImmun.isValid() && body.immunisationDate !== null) {
      Severity: Minor
      Found in packages/optimise-core/src/controllers/demographicDataController.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

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

              static async getICD11Field({ query }, res) {
                  const result = [];
                  const maxOccurency = 20;
                  await ICD11Controller.loadICD11Collection();
                  if (query.hasOwnProperty('search')) {
          Severity: Minor
          Found in packages/optimise-core/src/controllers/icd11Controller.js - About 1 hr to fix

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

                render() {
                    const { yesOrNoQuestion } = this.props;
                    return <Switch>
                        <Route
                            path='/patientProfile/:patientId/visitFrontPage/:visitId/page/:currentPage/yes_or_no'

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

                  render() {
                      const { yesOrNoQuestion } = this.props;
                      return <Switch>
                          <Route
                              path='/patientProfile/:patientId/visitFrontPage/:visitId/page/:currentPage/yes_or_no'

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

                    render() {
                        const { yesOrNoQuestion } = this.props;
                        return <Switch>
                            <Route
                                path='/patientProfile/:patientId/visitFrontPage/:visitId/page/:currentPage/yes_or_no'

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

                      render() {
                  
                          if (!this.props.data.visits)
                              return null;
                  
                  
                  Severity: Minor
                  Found in packages/optimise-ui/src/components/patientProfile/patientChart.jsx - About 1 hr to fix

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

                        _handleSubmitClick(ev) {
                            ev.preventDefault();
                            if (this.state.lastSubmit && (new Date()).getTime() - this.state.lastSubmit < 500 ? true : false)
                                return;
                            if (!this.state.startDate

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

                          _handleSubmit(ev) {
                              ev.preventDefault();
                              if (this.state.lastSubmit && (new Date()).getTime() - this.state.lastSubmit < 500 ? true : false)
                                  return;
                      

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

                                    this.originalValues = visitsMatched[0].data.reduce((a, el) => { a[el.field] = el.value; return a; }, {});
                        packages/optimise-ui/src/components/medicalData/ceDataPage.jsx on lines 155..155
                        packages/optimise-ui/src/components/medicalData/testDataPage.jsx on lines 146..146

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

                        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