pez-globo / pufferfish-software

All software for the Pufferfish ventilator.
Apache License 2.0
0 stars 1 forks source link

Implement alarms and event logging in the firmware #313

Closed ethanjli closed 3 years ago

ethanjli commented 3 years ago

This mega-PR contains a lot of changes everywhere (I'll try to split things up into smaller PRs in the future!). The most significant one is that the alarms and event logging and list synchronization code from the backend have now also been ported to the firmware, so we have alarms working in fully-integrated system with real hardware.

Firmware:

Backend:

Frontend:

Protobuf schemas:

I would appreciate testing of the software on this PR - please report all problems you see, and please test it in various configurations (with different combinations of computers, hardware, ventserver.application, and ventserver.simulator); we will fix smaller problems related to changes from this PR in this PR before merging, and we will create Github issues for larger problems or unrelated problems to address in future PRs. We will merge this in as prototype-quality code, but we should identify any regressions or breakage caused here and either fix it here or prioritize it for the next PR.

rohanpurohit commented 3 years ago

Running the tests on my local machine:

backend running ventserver.application:

(not sure if I was supposed to change anything for application)

backend running ventserver.simulator:

Running the tests on the ventilator unit:

backend running ventserver.application:

backend running ventserver.simulator:

ethanjli commented 3 years ago

This is extremely helpful, thanks for these details!

Backend running ventserver.application on your local machine: I think I'll need to understand your test conditions more thoroughly in order to understand what's happening (for example, was a Nucleo board connected up together with all the sensors). Let's discuss this in today's call. If you're able to screenshare what you see when you run this test during the meeting, that'll be very helpful.

Backend running ventserver.simulator on your local machine:

Backend running ventserver.application on the ventilator:

Backend running ventserver.simulator on the ventilator:

ethanjli commented 3 years ago

Things to do in future PRs or issues:

Issues to try to reproduce and document so that Ethan can reproduce:

Small fixes for this PR:

ethanjli commented 3 years ago

@rohanpurohit I've solved some issues with flooding of the event log. When you have a chance, can you play around with b128343 to see if the issues you previously saw with flooding the events log have been fixed, and/or if there are other issues with the events log, e.g. when the backend is restarted?

Can you also see whether/how you can reproduce the "stopping the backend gives 'software connection lost' along with the alarm, but no entry in the events log modal or active alarms modal" behavior you had observed? I've changed some things in the frontend which might interact with the code related to this behavior, but nothing which I'd expect to have fixed this issue.

rohanpurohit commented 3 years ago

Running the tests on my local machine:

backend running ventserver.application:

  • press start ventilation -> refresh page -> goes to the dashboard -> press pause -> goes back to quickstart but button still says pause ventilation

(Test env- local machine without an STM32 connected to it)

Can you also see whether/how you can reproduce the "stopping the backend gives 'software connection lost' along with the alarm, but no entry in the events log modal or active alarms modal" behavior you had observed? I've changed some things in the frontend which might interact with the code related to this behavior, but nothing which I'd expect to have fixed this issue.

I have not been able to reproduce this behavior since, maybe we can rule it out for now? I'm not sure under what circumstances I saw that behavior

@rohanpurohit I've solved some issues with flooding of the event log. When you have a chance, can you play around with b128343 to see if the issues you previously saw with flooding the events log have been fixed, and/or if there are other issues with the events log, e.g. when the backend is restarted?

The flooding issue seems to have improved, but I'd say it's still there?. unfortunately, I don't have access to a ventilator unit or STM32 connected to sensors therefore can't test it in application mode, although I had seen similar flooding in the previous test on application too.

To reproduce the behavior on backend running ventserver.simulator: 2021-04-22 (2)

ethanjli commented 3 years ago

Ok, that looks good. There should be flooding on alarms when measurements are very near alarm limits, because I haven't fixed that (progress on that will be tracked in #322). If I fully fixed the other flooding issues, there shouldn't be flooding on other events (e.g. parameter changes or alarm limits changes).

ethanjli commented 3 years ago

@rohanpurohit In this PR I've defined more MessageTypes, and once I merged develop in, some of your MessageTypes parse tests, which assume that no message types have values above 7, have started failing. We'll need those tests to work even after I define more message types, so maybe the unit tests should have their own definition of the MessageTypes enum. How do you want to proceed?

ethanjli commented 3 years ago

Because this PR has been reasonably well-tested (though testing on the final refactoring and fixes has been much lighter) and is part of the v0.7 milestone, I'm going to merge this into develop as-is, and as prototype-grade code. For records-keeping:

  1. This project is licensed under Apache License v2.0 for any software, and Solderpad Hardware License v2.1 for any hardware - do you agree that your contributions to this project will be under these licenses, too? Yes
  2. Were any of these contributions also part of work you did for an employer or a client? No
  3. Does this work include, or is it based on, any third-party work which you did not create? No