FHIR Chat · Simple random CDC data · Covid-19 Response

Stream: Covid-19 Response

Topic: Simple random CDC data


view this post on Zulip Michael Donnelly (May 15 2020 at 20:58):

@John Moehrke and I were talking about this, and I figured I'd share it in case it's useful to anyone. These are the functions I used to generate the sample data in Epic's MeasureReports for the track.

initialize(beds,bedsInUse,icuBeds,icuBedsInUse,vents,ventsInUse) ;
    s beds=$random(400)+$random(100)+50
    s icuBeds=$$randPercent(beds,2,12)
    s vents=$$randPercent(icuBeds,0,80)
    ;
    s bedsInUse=$$randPercent(beds,45,95)
    s icuBedsInUse=$$randPercent(icuBeds,25,100)
    s ventsInUse=$$randPercent(vents,30,100)
    q

nextDay(beds,bedsInUse,icuBeds,icuBedsInUse,vents,ventsInUse) ;
    n bedChange,icuChange,ventChange
    s bedChange=$$randPercent(beds,-15,15)
    s icuChange=$$randPercent(bedChange,0,80)
    s ventChange=$$randPercent(icuChange,0,100)
    ;
    s bedsInUse=bedsInUse+bedChange
    i bedsInUse<0 s bedsInUse=0
    i bedsInUse>beds s bedsInUse=beds
    ;
    s icuBedsInUse=icuBedsInUse+icuChange
    i icuBedsInUse<0 s icuBedsInUse=0
    i icuBedsInUse>icuBeds s icuBedsInUse=icuBeds
    i icuBedsInUse>bedsInUse s icuBedsInUse=bedsInUse
    ;
    s ventsInUse=ventsInUse+ventChange
    i ventsInUse<0 s ventsInUse=0
    i ventsInUse>vents s ventsInUse=vents
    q```

view this post on Zulip John Moehrke (May 18 2020 at 13:09):

This seems like something useful to capture in the test plan. My thinking is that it is human readable enough for people to get a feel for how to create test data. What do others think?


Last updated: Apr 12 2022 at 19:14 UTC