Skip to content

Conversation

@thompson318
Copy link
Collaborator

@thompson318 thompson318 commented Dec 17, 2025

This supersedes #21. I couldn't get the threaded version to remain up for a prolonged period of time on the GAE. It's probably doable but I was struggling with it. So this PR keeps the application single threaded, making it easier to work with pika.

Fixes #16 by creating a stable connection pool to UDS and adding short timeouts to the queries, so that database errors should not result in prolonged waits.

Fixes #17 by replacing characters in units string. (Also adds a unit test for this)

Adds some logic to send nack to rabbitMQ on some failures. This partially address #19 but may need more testing to find all failure modes.

Also updates the SQL to find the correct patients based on location visit times. This seems to be working on the GAE currently (subject to #20).

Also Addresses review comments from #21.

Limitations: most of the code does not have associated tests (low coverage) but it is tested by running on the GAE currently.

…ing a new connection for each message. Added nack messages for some failures
@thompson318 thompson318 marked this pull request as ready for review December 17, 2025 10:14
:return: True if write was successful.
"""
sourceSystem = waveform_message.get("sourceSystem", None)
sourceStreamId = waveform_message.get("sourceStreamId", None)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is null, the data is essentially useless and we should make a bigger noise about it. I don't know what our action should be – perhaps we need a dead-letter exchange in rabbitmq?
(ditto observationTime)
(this doesn't have to be solved in this PR)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe best for now to raise an exception and stop the controller? This should never happen anyway.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it happens in practice. I don't think we should stop the controller though, maybe log an error and drop the message?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've fixed this with 5f396d7
All required waveform fields are checked controller.py and an error logged is any are missing.
Require fields = mappedLocationString, observationTime, sourceStreamId, samplingRate, unit, numericValues, mappedLocationString

thompson318 and others added 2 commits December 17, 2025 16:36
Co-authored-by: Jeremy Stein <j.stein@ucl.ac.uk>
Co-authored-by: Jeremy Stein <j.stein@ucl.ac.uk>
thompson318 and others added 3 commits December 18, 2025 08:24
Co-authored-by: Jeremy Stein <j.stein@ucl.ac.uk>
Co-authored-by: Jeremy Stein <j.stein@ucl.ac.uk>
@thompson318 thompson318 merged commit f4b88ab into dev Dec 18, 2025
1 check passed
@thompson318 thompson318 deleted the 16-back_to_no_thread branch December 18, 2025 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filewriter fails for some string types. Dockerised controller disconnects from rabbitMQ on GAE

3 participants