Minor changes

This commit is contained in:
Ozzie Gooen 2020-03-02 10:13:52 +00:00
parent d772dc3841
commit a37078d839
4 changed files with 39 additions and 23 deletions

View File

@ -165,7 +165,7 @@ let make = () => {
~onSubmit=({state}) => {None},
~initialState={
guesstimatorString: "mm(5 to 20, floor(normal(20,2)), [.5, .5])",
domainType: "LeftLimited",
domainType: "Complete",
xPoint: 50.0,
xPoint2: 60.0,
excludingProbabilityMass2: 0.5,

View File

@ -21,30 +21,28 @@ let propValue = (t: Prop.Value.t) => {
let newDistribution =
DistPlusIngredients.toDistPlus(
~sampleCount=2000,
~outputXYPoints=2000,
~truncateTo=Some(100),
~outputXYPoints=1000,
~truncateTo=Some(500),
r,
);
switch (newDistribution) {
| Some(distribution) =>
<div>
<DistPlusPlot distPlus=distribution />
<input
readOnly=true
className="shadow appearance-none border w-1/3 rounded py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
value={r.guesstimatorString}
/>
<select
defaultValue="years"
readOnly=true
className="appearance-none w-32 bg-white border border-gray-400 hover:border-gray-500 px-4 py-2 pr-8 rounded shadow leading-tight focus:outline-none focus:shadow-outline">
<option> {"years" |> ReasonReact.string} </option>
</select>
<div
className="w-1/3 border w-1/2 rounded py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline bg-white">
{"30 to infinity, 80% mass" |> ReasonReact.string}
</div>
</div>
<div> <DistPlusPlot distPlus=distribution /> </div>
// <input
// readOnly=true
// className="shadow appearance-none border w-1/3 rounded py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
// value={r.guesstimatorString}
// />
// <select
// defaultValue="years"
// readOnly=true
// className="appearance-none w-32 bg-white border border-gray-400 hover:border-gray-500 px-4 py-2 pr-8 rounded shadow leading-tight focus:outline-none focus:shadow-outline">
// <option> {"years" |> ReasonReact.string} </option>
// </select>
// <div
// className="w-1/3 border w-1/2 rounded py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline bg-white">
// {"30 to infinity, 80% mass" |> ReasonReact.string}
// </div>
| None => "Something went wrong" |> ReasonReact.string
};
| FloatCdf(_) => <div />

View File

@ -236,6 +236,23 @@ module TypeWithMetadata = {
~assumptionType=PRIMARY_INPUT,
(),
);
let sex =
make(
~id="sex",
~name="Sex",
~description=None,
~type_=
SelectSingle({
options: [
{id: "male", name: "Male"},
{id: "female", name: "Female"},
],
default: Some("female"),
}),
~assumptionType=PRIMARY_INPUT,
(),
);
};
module Model = {

View File

@ -21,7 +21,8 @@ module Interface = {
let run = (p: array(option(Prop.Value.t))) => {
switch (p) {
| [|Some(FloatPoint(age))|] => Some(Model.make(age))
| [|Some(FloatPoint(age)), Some(SelectSingle(sex))|] =>
Some(Model.make(age))
| _ => None
};
};
@ -34,7 +35,7 @@ module Interface = {
description: "When will you die?",
version: "1.0.0",
author: "Ozzie Gooen",
inputTypes: [|TypeWithMetadata.age|],
inputTypes: [|TypeWithMetadata.age, TypeWithMetadata.sex|],
outputTypes: [||],
run,
};