New model
This commit is contained in:
parent
f2d52e6180
commit
312d90af39
|
@ -3,5 +3,6 @@ let make = () => {
|
||||||
<div className="w-full max-w-screen-xl mx-auto px-6">
|
<div className="w-full max-w-screen-xl mx-auto px-6">
|
||||||
<FormBuilder.ModelForm model=EAFunds.Interface.model />
|
<FormBuilder.ModelForm model=EAFunds.Interface.model />
|
||||||
<FormBuilder.ModelForm model=GlobalCatastrophe.Interface.model />
|
<FormBuilder.ModelForm model=GlobalCatastrophe.Interface.model />
|
||||||
|
<FormBuilder.ModelForm model=Human.Interface.model />
|
||||||
</div>;
|
</div>;
|
||||||
};
|
};
|
|
@ -19,6 +19,7 @@ module DistPlusChart = {
|
||||||
<DistributionPlot
|
<DistributionPlot
|
||||||
minX
|
minX
|
||||||
maxX
|
maxX
|
||||||
|
height=120
|
||||||
?discrete
|
?discrete
|
||||||
?continuous
|
?continuous
|
||||||
color={`hex("333")}
|
color={`hex("333")}
|
||||||
|
@ -50,7 +51,7 @@ module IntegralChart = {
|
||||||
<DistributionPlot
|
<DistributionPlot
|
||||||
minX
|
minX
|
||||||
maxX
|
maxX
|
||||||
height=100
|
height=80
|
||||||
?continuous
|
?continuous
|
||||||
color={`hex("333")}
|
color={`hex("333")}
|
||||||
timeScale
|
timeScale
|
||||||
|
|
|
@ -49,7 +49,7 @@ module ModelForm = {
|
||||||
let make = (~model: Model.t) => {
|
let make = (~model: Model.t) => {
|
||||||
let formState = makeHelpers(Combo.fromModel(model));
|
let formState = makeHelpers(Combo.fromModel(model));
|
||||||
<div>
|
<div>
|
||||||
<form
|
<div
|
||||||
className="bg-white rounded px-8 pt-6 pb-8 mb-4 mt-6 border-gray-200 border-solid border-2">
|
className="bg-white rounded px-8 pt-6 pb-8 mb-4 mt-6 border-gray-200 border-solid border-2">
|
||||||
<h1 className="text-gray-800 text-xl font-bold">
|
<h1 className="text-gray-800 text-xl font-bold">
|
||||||
{model.name |> ReasonReact.string}
|
{model.name |> ReasonReact.string}
|
||||||
|
@ -82,7 +82,7 @@ module ModelForm = {
|
||||||
{model.run(Prop.Combo.InputValues.toValueArray(formState.combo))
|
{model.run(Prop.Combo.InputValues.toValueArray(formState.combo))
|
||||||
|> E.O.React.fmapOrNull(propValue)}
|
|> E.O.React.fmapOrNull(propValue)}
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</div>
|
||||||
</div>;
|
</div>;
|
||||||
};
|
};
|
||||||
};
|
};
|
|
@ -221,6 +221,21 @@ module TypeWithMetadata = {
|
||||||
~assumptionType=ASSUMPTION,
|
~assumptionType=ASSUMPTION,
|
||||||
(),
|
(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let age =
|
||||||
|
make(
|
||||||
|
~id="age",
|
||||||
|
~name="Current Age",
|
||||||
|
~description=None,
|
||||||
|
~type_=
|
||||||
|
FloatPoint({
|
||||||
|
default: Some(40.0),
|
||||||
|
min: Some(0.0),
|
||||||
|
max: Some(100.0),
|
||||||
|
}),
|
||||||
|
~assumptionType=PRIMARY_INPUT,
|
||||||
|
(),
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
module Model = {
|
module Model = {
|
||||||
|
|
38
src/models/Human.re
Normal file
38
src/models/Human.re
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
let guesstimatorString = age => GuesstimatorDist.normal(80.0 -. age, 2.);
|
||||||
|
|
||||||
|
let makeI = (age: float) => {
|
||||||
|
DistPlusIngredients.make(
|
||||||
|
~guesstimatorString=guesstimatorString(age),
|
||||||
|
~unit=TimeDistribution({zero: MomentRe.momentNow(), unit: `years}),
|
||||||
|
~domain=RightLimited({xPoint: 300.0, excludingProbabilityMass: 0.3}),
|
||||||
|
(),
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
module Model = {
|
||||||
|
let make = (age: float) => {
|
||||||
|
Prop.Value.DistPlusIngredients(makeI(age));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
module Interface = {
|
||||||
|
let ageKey = "age";
|
||||||
|
|
||||||
|
let run = (p: array(option(Prop.Value.t))) => {
|
||||||
|
switch (p) {
|
||||||
|
| [|Some(FloatPoint(age))|] => Some(Model.make(age))
|
||||||
|
| _ => None
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
let model: Prop.Model.t =
|
||||||
|
Prop.{
|
||||||
|
name: "Death Time",
|
||||||
|
description: "When will you die?",
|
||||||
|
version: "1.0.0",
|
||||||
|
author: "Ozzie Gooen",
|
||||||
|
inputTypes: [|TypeWithMetadata.age|],
|
||||||
|
outputTypes: [||],
|
||||||
|
run,
|
||||||
|
};
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user