[docs]classCostaRica(CountryTestBase):location="Costa Rica"units="people tested"source_url_ref="https://geovision.uned.ac.cr/oges/"source_label="Ministry of Health"
[docs]defpipe_metrics(self,df:pd.DataFrame):lab_pos=df.nue_posi.fillna(0)-df.conf_nexo.fillna(0)df=df.assign(**{"Daily change in cumulative total":lab_pos.fillna(0)+df.nue_descar.fillna(0)})df=df[df["Daily change in cumulative total"]!=0]df["Positive rate"]=(lab_pos.rolling(7).sum()/df["Daily change in cumulative total"].rolling(7).sum()).round(3)returndf.sort_values("Date")