Last active
March 31, 2020 18:55
-
-
Save davidkpiano/3401066b7f780e5db5a386cafc264ee2 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or 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
Machine({ | |
id: 'questionnaire', | |
initial: 'symptoms', | |
states: { | |
symptoms: { | |
on: { | |
NEXT: 'fluTest' | |
} | |
}, | |
fluTest: { | |
on: { | |
NEXT: [ | |
{ | |
target: 'fluResults', | |
cond: 'answeredYes' | |
}, | |
{ | |
target: 'exposure' | |
} | |
] | |
} | |
}, | |
fluResults: { | |
on: { | |
NEXT: 'exposure' | |
} | |
}, | |
exposure: { | |
on: { | |
NEXT: [ | |
{ | |
target: 'exposureTime', | |
cond: 'answeredYes' | |
}, | |
{ | |
target: 'travel' | |
} | |
] | |
} | |
}, | |
exposureTime: { | |
on: { | |
NEXT: 'travel' | |
} | |
}, | |
travel: { | |
on: { | |
NEXT: 'additional' | |
} | |
}, | |
additional: { | |
on: { | |
NEXT: 'evaluating' | |
} | |
}, | |
evaluating: { | |
after: { | |
3000: [ | |
{ | |
target: 'preregister', | |
cond: 'testRecommended' | |
}, | |
{ | |
target: 'notAtRisk' | |
} | |
] | |
} | |
}, | |
preregister: { | |
on: { | |
NEXT: [ | |
{ | |
target: 'patient', | |
cond: 'answeredYes' | |
}, | |
{ | |
target: 'confirmation' | |
} | |
] | |
} | |
}, | |
patient: { | |
on: { | |
NEXT: 'map' | |
} | |
}, | |
notAtRisk: {}, | |
map: { | |
on: { | |
NEXT: 'confirmation' | |
} | |
}, | |
confirmation: {} | |
} | |
}, { | |
guards: { | |
answeredYes: (_, e) => true, | |
testRecommended: (_, e) => true | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment