This directory contains code supplied to students alongside coursework specifications, to aid structuring and building submissions.
model.py is a trival implementation of an acute kidney injury detection model that picks a result randomly. It serves to document the interface between submissions and the continuous integtation pipeline used to test submissions - specifically, the flags used to specify the location of input and output data, and the format of the predictions.
simulator.py is a simple simulator for a hospital environment. It can replay a stream of pre-generated HL7 messages over the MLLP protocol, and respond to requests to page clinicians made over a HTTP-based protocol described in the lectures. It serves to give students scaffolding to build their inference system around. You can run it with:
./simulator.py --messages=messages.mllp --mllp=8440 --pager=8441
--messages
specifies the file containing the messages to replay. The messages should be be encapsulated within MLLP, which could be generated by the generator in this repo.--mllp
specifies the port on which to listen for MLLP connections. Each new connection is sent all messages, starting from the beginging of the supplied file, with a new message sent as soon as the current message is acknowledged. The simulator always listens on0.0.0.0
.--pager
specifies the the port on which to listen for pager request, over HTTP. The simulator always listens on0.0.0.0
.
Aside from scaffolding to work from, the code itself attempts to:
- Provide a simple example of socket programming, to aid students who've not seen it before (which is why we don't use supporting libraries).
- Highlight common difficulties that arise in socket programming, for example, fragmented messages:
--short_messages
encourages the simulator to deliberately split HL7 messages across tworead()
calls, for example. - Provide an example of how to implement graceful shutdown via signals.
- Provide an example of integration-style testing, in
simulator_test.py
.
Note that this simulator is intended as scaffolding only. This repo contains a separate simulator used to assess coursework submissions.