The coronavirus disease 2019 (COVID-19) has changed the world since the World Health Organization declared its outbreak on 30th January 2020, recognizing the outbreak as a pandemic on 11th March 2020. As often said by politicians and scientific advisors, the objective is "to flatten the curve", or "push the peak down", or similar wording, of the virus spreading. Central to the official advice are mathematical models and data, which provide estimates on the evolution of the number of infected, recovered and deaths. The accuracy of the models is improved day by day by inferring the contact, recovery, and death rates from data (confirmed cases). A data-driven model trained with {\it both} data {\it and} first principles is proposed. The model can quickly be re-trained any time that new data becomes available. The method can be applied to more detailed epidemic models with virtually no conceptual modification.