There is provided an apparatus for detecting the deteriorating health of a patient receiving gas from a respiratory device. The apparatus comprises a sensor unit configured to monitor a flow rate or pressure of a gas that is flowing in a pipe that connects the respiratory device to a gas delivery device worn by the patient, and a processor configured to measure a respiratory rate of the patient based on variations in the flow rate or pressure of gas in the pipe and to implement a trend analysis of the measured respiratory rate. The processor is configured to generate a warning when it determines that there is an upward trend in the measured respiratory rate and that a magnitude of the trend exceeds a threshold.