Building your Data


This tutorial goes over the data argument which is needed in almost all of our API methods.

The data argument is used to represent the profile of an individual on whom we wish to calculate various measures like life expectancy. Programmatically, it's an array of objects where each object has a name field and a cofficent field.

The name field informs the engine what characteristic of the individual the object is referring to and the coefficent field represents the value of that characteristic.

In terms of the model, each object actually represents a variable in the model which is used to calculate the final model output.

// The following data argument represents the profile of a 21 year old male
const individual = [
  {
    // The name of the variable
    name: "age",
    // The value of the variable
    coefficent: 21
  },
  {
    name: "sex",
    coefficent: "male"
  }
];
// The value of the name and coefficent fields in the objects above are not related
// to any algorithms i.e. they are for example purposes only. Refer to the documentation for each
// model to figure out what characteristics or variables the model accepts

Each model has it's own set of data variables which it needs, all of which you can find in the documentation for that model available here

A few things to note:

  • Not all the variables in the model are required. The optional variables are mentioned in the model documentation
  • Some variables are not used in the actual evaluation of the model but are used to decide which algorithm is evaluated. We call these predicate variables. For example, the MPoRT model internally consists of 2 algorithms, a male and a female one. The sex variable here is the predicate variable, used to decide which algorithm gets used
  • Some variables can be substituted for others. For example the BMI variable in MPoRT can be substituted with 2 other variables, height_in and weight_lbs. These substitutions can be identified using the dependency tree diagram present in the documentation for each variable in the model documentation

results matching ""

    No results matching ""