Skip to content

kenners/SFAR-thoracoscore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Bugfixes for SFAR's Thoracoscore calculator

tl;dr

The Société Française d’Anesthésie et de Réanimation provides Google's top-ranked result for a Thoracoscore calculator. Their Thorascore calculator has a systematic error that introduces an addition of 0.05% to all scores that it calculates. We provide a patched version of their calculator's Javascript that corrects this error. We presented our findings at the Society for Cardiothoracic Surgery for Great Britain & Ireland's 2012 Annual Meeting.

The Error

SFAR's Thoracoscore calculator uses the following function to attempt to round the calculated score (x) to 2 decimal places:

	function Fmt(x) {
		var v
		if (x >= 0) {
			v = '' + (x + 0.05)
		} else {
			v = '' + (x - 0.05)
		}
		return v.substring(0,v.indexOf('.')+3)
	}

As x is always ≥0, this adds 0.05 to x before the substring method truncates the string to 2 decimal places. This does not round to 2 decimal places. What was perhaps meant was to add 0.005 before truncating to 2 decimal places; this would be a valid rounding function.

We suggest the alternative:

	function Fmt(x) {
		return Math.round(x * 100) / 100;
	}

Files

We provide 3 files:

Presentation

We presented our findings at the Society for Cardiothoracic Surgery for Great Britain & Ireland's 2012 Annual Meeting. Our slides are on SpeakerDeck:

Title slide

Authors

  • Kenrick Turner (@kenners), Norfolk & Norwich University Hospital
  • Andrew Ho (@andrewlkho), St. George's Hospital, London
  • Gunnar Rø (@gulfa), University of Durham
  • Martin Turner
  • Filip Van Tornout, Norfolk & Norwich University Hospital

Contact

Correspondance should be addressed to Kenrick: kenrickturner[at]nhs.net

About

Bugfix for the rounding error in SFAR's Thoracoscore calculator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages