package Ġorg . simple . clin ic . summary . pre scribed drug s Ċ Ċ import Ġcom . spotify . mob ius . rx 2 . Rx Mob ius Ċ import Ġdagger . Lazy Ċ import Ġdagger . ass isted . Ass isted Ċ import Ġdagger . ass isted . Ass isted Factory Ċ import Ġdagger . ass isted . Ass isted Inject Ċ import Ġio . reactivex . Observable Transformer Ċ import Ġorg . simple . clin ic . drug s . Pre scription Repository Ċ import Ġorg . simple . clin ic . facility . Facility Ċ import Ġorg . simple . clin ic . util . scheduler . Schedulers Provider Ċ Ċ class ĠDr ug Summary Effect Handler Ġ@ Ass isted Inject Ġconstructor ( ĊĠĠĠ Ġprivate Ġval Ġpre scription Repository : ĠPre scription Repository , ĊĠĠĠ Ġprivate Ġval Ġcurrent Facility : ĠLazy < Facility >, ĊĠĠĠ Ġprivate Ġval Ġs chedulers Provider : ĠS chedulers Provider , ĊĠĠĠ Ġ@ Ass isted Ġprivate Ġval Ġui Actions : ĠDr ug Summary Ui Actions Ċ ) Ġ{ ĊĊĠ Ġ@ Ass isted Factory ĊĠ Ġinterface ĠFactory Ġ{ ĊĠĠĠ Ġfun Ġcreate ( ui Actions : ĠDr ug Summary Ui Actions ): ĠDr ug Summary Effect Handler ĊĠ Ġ} ĊĊĠ Ġfun Ġbuild (): ĠObservable Transformer < Dr ug Summary Effect , ĠDr ug Summary Event > Ġ= ĠRx Mob ius ĊĠĠĠĠĠ Ġ. subtype Effect Handler < Dr ug Summary Effect , ĠDr ug Summary Event >() ĊĠĠĠĠĠ Ġ. add Transformer ( Load Pre scribed Dr ug s :: class . java , Ġpopulate Pre scribed Dr ug s ()) ĊĠĠĠĠĠ Ġ. add Transformer ( Load Current Facility :: class . java , Ġload Current Facility ()) ĊĠĠĠĠĠ Ġ. add Consumer ( Open Update Pre scribed Dr ug Screen :: class . java , Ġ{ Ġui Actions . show Update Pre scribed Dr ug s Screen ( it . patient Uuid , Ġit . facility ) Ġ}, Ġs chedulers Provider . ui ()) ĊĠĠĠĠĠ Ġ. build () ĊĊĠ Ġprivate Ġfun Ġload Current Facility (): ĠObservable Transformer < Load Current Facility , ĠDr ug Summary Event > Ġ{ ĊĠĠĠ Ġreturn ĠObservable Transformer Ġ{ Ġeffects Ġ-> ĊĠĠĠĠĠ Ġeffects ĊĠĠĠĠĠĠĠĠĠ Ġ. observe On ( schedul ers Provider . io ()) ĊĠĠĠĠĠĠĠĠĠ Ġ. map Ġ{ Ġcurrent Facility . get () Ġ} ĊĠĠĠĠĠĠĠĠĠ Ġ. map (:: Current Facility Loaded ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġpopulate Pre scribed Dr ug s (): ĠObservable Transformer < Load Pre scribed Dr ug s , ĠDr ug Summary Event > Ġ{ ĊĠĠĠ Ġreturn ĠObservable Transformer Ġ{ Ġeffects Ġ-> ĊĠĠĠĠĠ Ġeffects ĊĠĠĠĠĠĠĠĠĠ Ġ. observe On ( schedul ers Provider . io ()) ĊĠĠĠĠĠĠĠĠĠ Ġ. switch Map Ġ{ Ġpre scription Repository . new est Pre scriptions For Patient ( patient Uuid Ġ= Ġit . patient Uuid ) Ġ} ĊĠĠĠĠĠĠĠĠĠ Ġ. map (:: Pre scribed Dr ug s Loaded ) ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ