1 / 13

Personal Medical Unit

Personal Medical Unit. Lars Sarbæk Kristiansen 20050013 Kasper J. Nielsen 19980150 Martin Kjeldsen 20002072. Agenda. Last time Updated classdiagram First draft of implementation Today Updated classdiagram Implementation of selected classes/ops. Testing with VDMUnit.

beck
Download Presentation

Personal Medical Unit

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Personal Medical Unit Lars Sarbæk Kristiansen 20050013 Kasper J. Nielsen 19980150 Martin Kjeldsen 20002072

  2. Agenda • Last time • Updated classdiagram • First draft of implementation • Today • Updated classdiagram • Implementation of selected classes/ops. • Testing with VDMUnit

  3. Updated class diagram • Class Clock represents global time

  4. Classes of interest • Class Clock • Representation of global time • i.e. Need to determine patient records last update • Class MedicalDevice • Class PMUSystem (main)

  5. Class Clock class Clock instance variables static private time : nat := 0; operations static public GetTime : () ==> nat GetTime() == return time; static public IncrementClock : () ==> nat IncrementClock() == ( time := time + 1; return time ) end Clock

  6. Class MedicalDevice class MedicalDevice ... public RetrieveDeviceData : () ==> Data RetrieveDeviceData() == ( def deviceData = mk_Data(deviceId, dataLog) in ( PurgeData(); return deviceData ); ); public CreateDataEntry: seq of char * nat ==> () CreateDataEntry (data, t) == def newLogEntry = mk_LogEntry(t, data) in dataLog := [newLogEntry] ^ dataLog post entryExists(mk_LogEntry(t,data)); (continued->)

  7. Class MedicalDevice (cont.) … public entryExists: LogEntry ==> bool entryExists(logEntry) == for entry in dataLog do if logEntry.timeStamp = entry.timeStamp then return true else return false; public GetLatestEntries: nat ==> seq of LogEntry GetLatestEntries(amount) == return dataLog(1,...,amount) pre amount <= len dataLog post len dataLog(1,...,amount) = amount end MedicalDevice

  8. Class PMUSystem (main) • Operation of interest: CollectDataFromDevices class PMUSystem … public CollectDataFromDevices: seq of char ==> () CollectDataFromDevices(patientId) == ( for all pmu in set pmus do ( def patientIdFromRecord = pmu.RetrievePatientRecord().GetPatientId() in ( if (patientIdFromRecord = patientId) then def deviceList = pmu.RetrieveDeviceList() in for all device in set deviceList do pmu.PollDevice(device.GetDeviceId()) ) ) ) pre exists pmu in set pmus & pmu.RetrievePatientRecord().GetPatientId() = patientId; end PMUSystem

  9. Testing the PMU System • Benefits of the testing process • Discover required functionality • Testing with VDMUnit / IO • Testcases • Example: MedicalDevice unittest

  10. Test case: MedicalUnit (1) • Code from MedicalUnitTest.vpp class MedicalDeviceTest is subclass of TestCase … -- Test constructor protected TestInit: () ==> () TestInit() == (dcl mUnit : MedicalDevice := new MedicalDevice(1); AssertTrue(mUnit.GetDeviceId()= 1)); -- Test data entries protected TestDataEntries: () ==> () TestDataEntries() == (dcl mUnit : MedicalDevice := new MedicalDevice(1); mUnit.CreateDataEntry("some medical device data", 1); def lastDataEntry = mUnit.GetLatestEntries(1) in AssertTrue(hd lastDataEntry = mk_MedicalDevice`LogEntry(1,"some data")); ); end MedicalDeviceTest

  11. Test case: MedicalUnit (3) • Code from CompletePMUTest class CompletePMUTest operations public Execute: () ==> () Execute() == ( dcl ts: TestSuite:=new TestSuite(); ts.AddTest(new MedicalDeviceTest("MedicalDeviceTest")); ts.Run() ) end CompletePMUTest

  12. Test case: MedicalUnit (1) • Result ok?

  13. Summary • Todays presentation • Recap and introduction of new class Clock • Implementation of selected classes/ops. • Testing with VDMUnit • What’s next? • Finish polishing off the implementation • Extend test to other units and components • Write down what we’ve learned in a really good report!

More Related