Showing 380 of 1,390 total issues
Function getMedicalConditionFields
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static getMedicalConditionFields({ query }, res) {
const action = {
relations: MedicalHistoryCore.getRelations,
conditions: MedicalHistoryCore.getConditions
};
Function createMedicalCondition
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static createMedicalCondition({ body, user }, res) {
if (body.hasOwnProperty('patient') && body.hasOwnProperty('startDate') && body.hasOwnProperty('outcome') && body.hasOwnProperty('relation') && body.hasOwnProperty('conditionName') &&
((body.hasOwnProperty('resolvedYear') && typeof body.resolvedYear === 'number') || !body.hasOwnProperty('resolvedYear')) &&
typeof body.patient === 'number' && typeof body.startDate === 'string' && typeof body.outcome === 'string' && typeof body.relation === 'number' && typeof body.conditionName === 'number') {
const momentStart = moment(body.startDate, moment.ISO_8601);
Function createSync
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async createSync({ body: { data, uuid, agent, key }, headers, connection }, res) {
if (data === undefined || uuid === undefined) {
res.status(401).json(ErrorHelper(message.userError.MISSINGARGUMENT));
return;
Function _handleSubmit
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_handleSubmit(ev) {
ev.preventDefault();
if (this.state.lastSubmit && (new Date()).getTime() - this.state.lastSubmit < 500 ? true : false)
return;
Function changeRights
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static changeRights(wsEndpoint) {
return async function ({ user, body }, res) {
if (user.adminPriv !== 1) {
const remoteControlOpened = await new Promise((resolve) => {
const ws = new WebSocket(wsEndpoint, {
Function _findDateRange
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_findDateRange(date, entryType) {
let pregnancies = Array.from(this.props.data.pregnancy);
let currentPregnancy;
Function render
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { match: { params }, patientProfile: { visits } } = this.props;
if (visits === undefined)
return null;
const visitFiltered = visits.filter(el => parseInt(params.visitId) === el.id);
Function render
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { editing } = this.state;
const { data, typedict } = this.props;
return (
<div className={style.interruption} style={{
Consider simplifying this complex logical expression. Open
Open
if (body.hasOwnProperty('treatmentInterId') && typeof body.treatmentInterId === 'number' &&
body.hasOwnProperty('start_date') && typeof body.start_date === 'string') {
const momentStart = body.hasOwnProperty('start_date') && body.start_date !== null ? moment(body.start_date, moment.ISO_8601) : null;
const momentEnd = body.hasOwnProperty('end_date') && body.end_date !== null ? moment(body.end_date, moment.ISO_8601) : null;
if (momentStart !== null && !momentStart.isValid()) {
Consider simplifying this complex logical expression. Open
Open
if (body.hasOwnProperty('id') && typeof body.id === 'number' &&
((body.hasOwnProperty('outcome') && typeof body.outcome === 'string') || !body.hasOwnProperty('outcome')) &&
((body.hasOwnProperty('resolvedYear') && typeof body.resolvedYear === 'number') || !body.hasOwnProperty('resolvedYear'))) {
MedicalHistoryCore.editMedicalHistory(user, body).then((result) => {
res.status(200).json(formatToJSON(result));
Consider simplifying this complex logical expression. Open
Open
if ((this.props.filter.visits && this.props.visitType === 1) ||
(this.props.filter.tests && visitHasTests) ||
(this.props.filter.treatments && visitHasMedications) ||
(this.props.filter.events && visitHasClinicalEvents))
shouldRender = true;
Function createDemographic
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static createDemographic({ body, user }, res) {
if ((!body.hasOwnProperty('patient') || !body.hasOwnProperty('DOB') || !body.hasOwnProperty('gender') || !body.hasOwnProperty('dominant_hand')
|| !body.hasOwnProperty('ethnicity') || !body.hasOwnProperty('country_of_origin'))) {
res.status(400).json(ErrorHelper(message.userError.MISSINGARGUMENT));
return;
Function render
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
if (this.props.data.demographicData) {
if (this.props.data.demographicData.gender === 1)
return null;
Function render
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { data, searchString } = this.props;
const ind = data.aliasId.toLowerCase().indexOf(searchString.toLowerCase());
const styledName = (
<span>
Function editPregnancy
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static editPregnancy({ body, user }, res) {
if (body.hasOwnProperty('id') && typeof body.id === 'number') {
const entryObj = Object.assign({}, body);
const momentStart = moment(body.startDate, moment.ISO_8601);
Function migrate
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export async function migrate() {
const db = await dbcon().then(client => client.db());
// // Verify the OPT_KV configuration table exists
Function migrate
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export async function migrate() {
const db = await dbcon().then(client => client.db());
// // Verify the OPT_KV configuration table exists
Function alterPregnancyItemsCall
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
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';
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { data } = this.props;
const { userId } = this.props.match.params;
if (!data.fetching) {
const usersFiltered = data.result.filter(el => el.id === parseInt(userId, 10));
Function filterEmptyRenders
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const filterEmptyRenders = (allFields, inputType, typedict) => allFields.map(data => {
const toTitleCase = (str) => str.replace(/\w\S*/g, (txt) => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase());
let value;