Function parseRadiologyReport
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
export const parseRadiologyReport = radiologyReportText => {
const radiologyReportMap = {};
const lines = radiologyReportText ? radiologyReportText.split(/\r?\n/) : [];
let i = 0;
let clinicalHistory = '';
- Read upRead up
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 parseRadiologyReport
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const parseRadiologyReport = radiologyReportText => {
const radiologyReportMap = {};
const lines = radiologyReportText ? radiologyReportText.split(/\r?\n/) : [];
let i = 0;
let clinicalHistory = '';
Avoid deeply nested control flow statements. Open
} else if (line.startsWith('Report:')) {
// Begin collecting "Report" and "Impression"
reportText = '';
impressionText = '';
inImpression = false;
Avoid deeply nested control flow statements. Open
while (i < lines.length) {
const historyLine = lines[i].trim();
if (historyLine.startsWith('Report Status:')) {
// Extract "Report Status" and remove "Date Reported" if present
let statusValue = historyLine
Function areDatesEqualToMinute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const areDatesEqualToMinute = (var1, var2) => {
const parseDate = input => {
let date;
if (/^\d+$/.test(input)) {
// Input is a numeric string, parse it as a number (timestamp)
- Read upRead up
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 findMatchingPhrAndCvixStudies
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const findMatchingPhrAndCvixStudies = async (
id,
phrResponse,
cvixResponse,
) => {
- Read upRead up
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 findMatchingCvixReport
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const findMatchingCvixReport = (phrResponse, cvixResponseList) => {
if (phrResponse && Array.isArray(cvixResponseList)) {
for (const cvixResponse of cvixResponseList) {
if (radiologyReportsMatch(phrResponse, cvixResponse)) {
return cvixResponse;
- Read upRead up
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"