-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #126 from FedericoTartarini/jordan/new-npm-release
Run build in prep for NPM release
- Loading branch information
Showing
198 changed files
with
8,001 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const JOS3Defaults = { | ||
// Body information | ||
height: 1.72, | ||
weight: 74.43, | ||
age: 20, | ||
body_fat: 15, | ||
cardiac_index: 2.59, | ||
blood_flow_rate: 290, | ||
physical_activity_ratio: 1.25, | ||
metabolic_rate: 1.0, | ||
sex: "male", | ||
posture: "standing", | ||
bmr_equation: "harris-benedict", | ||
bsa_equation: "dubois", | ||
local_bsa: [ | ||
0.11, 0.029, 0.175, 0.161, 0.221, 0.096, 0.063, 0.05, 0.096, 0.063, 0.05, | ||
0.209, 0.112, 0.056, 0.209, 0.112, 0.056, | ||
], | ||
// Environment information | ||
core_temperature: 37, | ||
skin_temperature: 34, | ||
other_body_temperature: 36, | ||
dry_bulb_air_temperature: 28.8, | ||
mean_radiant_temperature: 28.8, | ||
relative_humidity: 50, | ||
air_speed: 0.1, | ||
// Clothing information | ||
clothing_insulation: 0, | ||
clothing_vapor_permeation_efficiency: 0.45, | ||
lewis_rate: 16.5, // [K/kPa] | ||
}; | ||
exports.default = JOS3Defaults; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.bfb_rate = void 0; | ||
const JOS3Defaults_js_1 = __importDefault(require("./JOS3Defaults.js")); | ||
const bsa_rate_js_1 = require("./bsa_rate.js"); | ||
const validate_body_parameters_js_1 = require("./validate_body_parameters.js"); | ||
const math = __importStar(require("mathjs")); | ||
/** | ||
* Calculate the ratio of basal blood flow (BFB) of the standard body (290 L/h). | ||
* | ||
* @param {number} height - Body height [m]. The default is 1.72. | ||
* @param {number} weight - Body weight [kg]. The default is 74.43. | ||
* @param {string} bsa_equation - The equation name of bsa calculation. Choose a name from "dubois", "takahira", "fujimoto", or "kurazumi". The default is "dubois". | ||
* @param {number} age - age [years]. The default is 20. | ||
* @param {number} ci - Cardiac index [L/min/㎡]. The default is 2.59. | ||
* | ||
* @returns {number} - Basal blood flow rate. | ||
*/ | ||
function bfb_rate(height = JOS3Defaults_js_1.default.height, weight = JOS3Defaults_js_1.default.weight, bsa_equation = JOS3Defaults_js_1.default.bsa_equation, age = JOS3Defaults_js_1.default.age, ci = JOS3Defaults_js_1.default.cardiac_index) { | ||
(0, validate_body_parameters_js_1.validate_body_parameters)(height, weight, age); | ||
ci *= 60; | ||
if (age < 50) { | ||
ci *= 1; | ||
} | ||
else if (age < 60) { | ||
ci *= 0.85; | ||
} | ||
else if (age < 70) { | ||
ci *= 0.75; | ||
} | ||
else { | ||
// age >= 70 | ||
ci *= 0.7; | ||
} | ||
const bfb_all = ci * | ||
(0, bsa_rate_js_1.bsa_rate)(height, weight, bsa_equation) * | ||
math.sum(JOS3Defaults_js_1.default.local_bsa); | ||
return bfb_all / JOS3Defaults_js_1.default.blood_flow_rate; | ||
} | ||
exports.bfb_rate = bfb_rate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.bsa_rate = void 0; | ||
const JOS3Defaults_js_1 = __importDefault(require("../jos3_functions/JOS3Defaults.js")); | ||
const validate_body_parameters_js_1 = require("./validate_body_parameters.js"); | ||
const utilities_js_1 = require("../utilities/utilities.js"); | ||
/** | ||
* Calculates the body surface area rate based on the given height, weight and | ||
* BSA equation. | ||
* | ||
* @param {number} [height=JOS3Defaults.height] - The height of the person in | ||
* meters. | ||
* @param {number} [weight=JOS3Defaults.weight] - The weight of the person in | ||
* kilograms. | ||
* @param {string} [bsa_equation=JOS3Defaults.bsa_equation] - The BSA equation | ||
* to use for calculation. | ||
* | ||
* @returns {number} The body surface area rate. | ||
*/ | ||
function bsa_rate(height = JOS3Defaults_js_1.default.height, weight = JOS3Defaults_js_1.default.weight, bsa_equation = JOS3Defaults_js_1.default.bsa_equation) { | ||
(0, validate_body_parameters_js_1.validate_body_parameters)(height, weight, bsa_equation); | ||
const bsa_all = (0, utilities_js_1.body_surface_area)(weight, height, bsa_equation); | ||
return bsa_all / JOS3Defaults_js_1.default.local_bsa.reduce((t, c) => t + c, 0); | ||
} | ||
exports.bsa_rate = bsa_rate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.capacity = void 0; | ||
const JOS3Defaults_js_1 = __importDefault(require("./JOS3Defaults.js")); | ||
const validate_body_parameters_js_1 = require("./validate_body_parameters.js"); | ||
const bfb_rate_js_1 = require("./bfb_rate.js"); | ||
const weight_rate_js_1 = require("./weight_rate.js"); | ||
const matrix_js_1 = require("./matrix.js"); | ||
/** | ||
* Calculate thermal capacity in Joules per Kelvin (J/K). | ||
* Derived from Yokoyama's model, assuming blood's heat as 1.0 [kcal/L.K]. | ||
* | ||
* @param {number} [height=JOS3Defaults.height] - Body height in meters. Default | ||
* is 1.72. | ||
* @param {number} [weight=JOS3Defaults.weight] - Body weight in kg. Default is | ||
* 74.43. | ||
* @param {string} [bsa_equation=JOS3Defaults.bsa_equation] - Equation name for | ||
* bsa calc. Must be from "dubois","takahira", "fujimoto", "kurazumi". | ||
* Default is "dubois". | ||
* @param {number} [age=JOS3Defaults.age] - Age in years. Default is 20. | ||
* @param {number} [ci=JOS3Defaults.cardiac_index] - Cardiac index in L/min/㎡. | ||
* Default is 2.59. | ||
* @returns {number[]} - Thermal capacity in W/K. Shape is (NUM_NODES). | ||
*/ | ||
function capacity(height = JOS3Defaults_js_1.default.height, weight = JOS3Defaults_js_1.default.weight, bsa_equation = JOS3Defaults_js_1.default.bsa_equation, age = JOS3Defaults_js_1.default.age, ci = JOS3Defaults_js_1.default.cardiac_index) { | ||
(0, validate_body_parameters_js_1.validate_body_parameters)(height, weight, age); | ||
// artery [Wh/K] | ||
let cap_art = [ | ||
0.096, 0.025, 0.12, 0.111, 0.265, 0.0186, 0.0091, 0.0044, 0.0186, 0.0091, | ||
0.0044, 0.0813, 0.04, 0.0103, 0.0813, 0.04, 0.0103, | ||
]; | ||
// vein [Wh/K] | ||
let cap_vein = [ | ||
0.321, 0.085, 0.424, 0.39, 0.832, 0.046, 0.024, 0.01, 0.046, 0.024, 0.01, | ||
0.207, 0.1, 0.024, 0.207, 0.1, 0.024, | ||
]; | ||
// superficial vein [Wh/K] | ||
let cap_sfv = [ | ||
0, 0, 0, 0, 0, 0.025, 0.015, 0.011, 0.025, 0.015, 0.011, 0.074, 0.05, 0.021, | ||
0.074, 0.05, 0.021, | ||
]; | ||
// central blood [Wh/K] | ||
let cap_cb = 1.999; | ||
// core [Wh/K] | ||
let cap_cr = [ | ||
1.7229, 0.564, 10.2975, 9.3935, 4.488, 1.6994, 1.1209, 0.1536, 1.6994, | ||
1.1209, 0.1536, 5.3117, 2.867, 0.2097, 5.3117, 2.867, 0.2097, | ||
]; | ||
// muscle [Wh/K] | ||
let cap_ms = [ | ||
0.305, 0.0, 0.0, 0.0, 7.409, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, | ||
0.0, 0.0, 0.0, | ||
]; | ||
// fat [Wh/K] | ||
let cap_fat = [ | ||
0.203, 0.0, 0.0, 0.0, 1.947, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, | ||
0.0, 0.0, 0.0, | ||
]; | ||
// skin [Wh/K] | ||
let cap_sk = [ | ||
0.1885, 0.058, 0.441, 0.406, 0.556, 0.126, 0.084, 0.088, 0.126, 0.084, | ||
0.088, 0.334, 0.169, 0.107, 0.334, 0.169, 0.107, | ||
]; | ||
// Changes the values based on the standard body | ||
const bfbr = (0, bfb_rate_js_1.bfb_rate)(height, weight, bsa_equation, age, ci); | ||
const wr = (0, weight_rate_js_1.weight_rate)(weight); | ||
cap_art = cap_art.map((x) => x * bfbr); | ||
cap_vein = cap_vein.map((x) => x * bfbr); | ||
cap_sfv = cap_sfv.map((x) => x * bfbr); | ||
cap_cb = cap_cb * bfbr; | ||
cap_cr = cap_cr.map((x) => x * wr); | ||
cap_ms = cap_ms.map((x) => x * wr); | ||
cap_fat = cap_fat.map((x) => x * wr); | ||
cap_sk = cap_sk.map((x) => x * wr); | ||
let cap_whole = Array(matrix_js_1.NUM_NODES).fill(0); | ||
cap_whole[0] = cap_cb; | ||
for (let i = 0; i < matrix_js_1.BODY_NAMES.length; i++) { | ||
// Dictionary of indices in each body segment | ||
// key = layer name, value = index of matrix | ||
let bn = matrix_js_1.BODY_NAMES[i]; | ||
let index_of = matrix_js_1.IDICT[bn]; | ||
// Common | ||
cap_whole[index_of["artery"]] = cap_art[i]; | ||
cap_whole[index_of["vein"]] = cap_vein[i]; | ||
cap_whole[index_of["core"]] = cap_cr[i]; | ||
cap_whole[index_of["skin"]] = cap_sk[i]; | ||
// Only limbs | ||
if (i >= 5) { | ||
cap_whole[index_of["sfvein"]] = cap_sfv[i]; | ||
} | ||
// If the segment has a muscle or fat layer | ||
if (index_of["muscle"] !== null || index_of["fat"] !== null) { | ||
cap_whole[index_of["muscle"]] = cap_ms[i]; | ||
cap_whole[index_of["fat"]] = cap_fat[i]; | ||
} | ||
} | ||
return cap_whole.map((x) => x * 3600); | ||
} | ||
exports.capacity = capacity; |
Oops, something went wrong.