FROM fiware/quantum-leap:latest
USER root
# Patch _filter_empty_entities to handle flat NGSI-v2 attribute values
RUN sed -i "s/if 'value' in payload\[j\]:/if isinstance(payload[j], dict) and 'value' in payload[j]:/" /src/ngsi-timeseries-api/src/reporter/reporter.py && \
    sed -i "s/if isinstance(value, int) and value is not None:/if isinstance(value, (int, float)) and value is not None:/" /src/ngsi-timeseries-api/src/reporter/reporter.py
