Skip to content

Instantly share code, notes, and snippets.

@shreybatra
Created February 19, 2020 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shreybatra/41c359d6718a23d2a8d81a09aeecda0e to your computer and use it in GitHub Desktop.
Save shreybatra/41c359d6718a23d2a8d81a09aeecda0e to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const patientSelectionMachine = Machine({
id: "patientSelector",
initial: "pickPatients",
states: {
pickPatients: {
on: {
FROM_MEASURE: "measure",
FROM_ADT: "activity",
FROM_CSV: "customCsv"
}
},
activity: { on: { ABC: "exit" } },
measure: {},
customCsv: {},
exit: {}
}
});
const strategyMachine = Machine({
id: "Strategy",
initial: "startExecution",
states: {
startExecution: {
on: {
HAVE_SCHEDULE: "scheduleCheck",
DONT_HAVE_SCHEDULE: "patientSelection"
}
},
scheduleCheck: {
on: { TRUE: "patientSelection", FALSE: "nextStrategy" }
},
nextStrategy: {
on: {
HAVE_NEXT_STRATEGY: "startExecution",
NO_STRATEGY: "exit"
}
},
patientSelection: { on: { COMPLETE: "exit" }, ...patientSelectionMachine },
exit: {}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment