Skip to content

Fixed - "None" in BF RR was converted to NaN in pandas #229

Fixed - "None" in BF RR was converted to NaN in pandas

Fixed - "None" in BF RR was converted to NaN in pandas #229

GitHub Actions / JUnit Test Report failed Mar 18, 2024 in 0s

412 tests run, 373 passed, 0 skipped, 39 failed.

Annotations

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[en/LiST countries/MDV_databook.xlsx]

Exception: Error in program data: Target population is 0 for Balanced energy-protein supplementation

Target population is 0 for Cash transfers

Target population is 0 for Lipid-based nutrition supplements

Target population is 0 for Public provision of complementary foods

Target population is 0 for Small quantity lipid-based nutrition supplements
Raw output
self = <nutrition.data.Dataset at 0x709d79cbc3d0>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'MDV_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709da1b23a10>
country = None, region = None, name = 'MDV_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
>           self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)

../nutrition/data.py:1004: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/data.py:683: in __init__
    self.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.ProgramData at 0x709d79e5ed10>
[<class 'nutrition.data.ProgramData'>]
————————————————————————————————... 0x709d79065fd0>
                 [<class 'nutritio [...]
————————————————————————————————————————————————————————————


    def validate(self):
        """ Validate program data """
        invalid = []
        for progname in self.base_prog_set:
            cov = self.base_cov[progname]
            if cov < 0 or cov > 1:
                errormsg = _("Baseline coverage is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            sat = self.sat[progname]
            if sat < 0 or sat > 1:
                errormsg = _("Saturation is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_inc = self.max_inc[progname]
            if max_inc < 0 or max_inc > 1:
                errormsg = _("Maximum increase is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_dec = self.max_dec[progname]
            if max_dec < 0 or max_dec > 1:
                errormsg = _("Maximum decrease is outside the interval (0, 100) for %s") % progname
    
                invalid.append(errormsg)
            cost = self.costs[progname]
            if cost <= 0:
                errormsg = _("Cost is 0 or negative for %s") % progname
                invalid.append(errormsg)
            if progname not in self.prog_target.keys():
                errormsg = _("Target population not defined for %s") % progname
                invalid.append(errormsg)
            elif sum(self.prog_target[progname].values()) == 0:
                errormsg = _("Target population is 0 for %s") % progname
                invalid.append(errormsg)
        if invalid:
            errors = "\n\n".join(invalid)
>           raise Exception(errors)
E           Exception: Target population is 0 for Balanced energy-protein supplementation
E           
E           Target population is 0 for Cash transfers
E           
E           Target population is 0 for Lipid-based nutrition supplements
E           
E           Target population is 0 for Public provision of complementary foods
E           
E           Target population is 0 for Small quantity lipid-based nutrition supplements

../nutrition/data.py:727: Exception

The above exception was the direct cause of the following exception:

path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/en/LiST countries/MDV_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:175: in load_data
    dataset = Dataset(databook=databook, country=country, region=region, name=name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.Dataset at 0x709d79cbc3d0>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'MDV_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709da1b23a10>
country = None, region = None, name = 'MDV_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
            self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)
        except Exception as E:
>           raise Exception("Error in program data: %s" % str(E)) from E
E           Exception: Error in program data: Target population is 0 for Balanced energy-protein supplementation
E           
E           Target population is 0 for Cash transfers
E           
E           Target population is 0 for Lipid-based nutrition supplements
E           
E           Target population is 0 for Public provision of complementary foods
E           
E           Target population is 0 for Small quantity lipid-based nutrition supplements

../nutrition/data.py:1006: Exception

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[en/LiST countries/KAZ_databook.xlsx]

Exception: Error in program data: Target population is 0 for Balanced energy-protein supplementation

Target population is 0 for Cash transfers

Target population is 0 for Lipid-based nutrition supplements

Target population is 0 for Public provision of complementary foods

Target population is 0 for Small quantity lipid-based nutrition supplements
Raw output
self = <nutrition.data.Dataset at 0x774e17164cd0>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'KAZ_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x774e18893d90>
country = None, region = None, name = 'KAZ_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
>           self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)

../nutrition/data.py:1004: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/data.py:683: in __init__
    self.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.ProgramData at 0x774e16e11d50>
[<class 'nutrition.data.ProgramData'>]
————————————————————————————————... 0x774e16b07090>
                 [<class 'nutritio [...]
————————————————————————————————————————————————————————————


    def validate(self):
        """ Validate program data """
        invalid = []
        for progname in self.base_prog_set:
            cov = self.base_cov[progname]
            if cov < 0 or cov > 1:
                errormsg = _("Baseline coverage is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            sat = self.sat[progname]
            if sat < 0 or sat > 1:
                errormsg = _("Saturation is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_inc = self.max_inc[progname]
            if max_inc < 0 or max_inc > 1:
                errormsg = _("Maximum increase is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_dec = self.max_dec[progname]
            if max_dec < 0 or max_dec > 1:
                errormsg = _("Maximum decrease is outside the interval (0, 100) for %s") % progname
    
                invalid.append(errormsg)
            cost = self.costs[progname]
            if cost <= 0:
                errormsg = _("Cost is 0 or negative for %s") % progname
                invalid.append(errormsg)
            if progname not in self.prog_target.keys():
                errormsg = _("Target population not defined for %s") % progname
                invalid.append(errormsg)
            elif sum(self.prog_target[progname].values()) == 0:
                errormsg = _("Target population is 0 for %s") % progname
                invalid.append(errormsg)
        if invalid:
            errors = "\n\n".join(invalid)
>           raise Exception(errors)
E           Exception: Target population is 0 for Balanced energy-protein supplementation
E           
E           Target population is 0 for Cash transfers
E           
E           Target population is 0 for Lipid-based nutrition supplements
E           
E           Target population is 0 for Public provision of complementary foods
E           
E           Target population is 0 for Small quantity lipid-based nutrition supplements

../nutrition/data.py:727: Exception

The above exception was the direct cause of the following exception:

path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/en/LiST countries/KAZ_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:175: in load_data
    dataset = Dataset(databook=databook, country=country, region=region, name=name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.Dataset at 0x774e17164cd0>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'KAZ_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x774e18893d90>
country = None, region = None, name = 'KAZ_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
            self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)
        except Exception as E:
>           raise Exception("Error in program data: %s" % str(E)) from E
E           Exception: Error in program data: Target population is 0 for Balanced energy-protein supplementation
E           
E           Target population is 0 for Cash transfers
E           
E           Target population is 0 for Lipid-based nutrition supplements
E           
E           Target population is 0 for Public provision of complementary foods
E           
E           Target population is 0 for Small quantity lipid-based nutrition supplements

../nutrition/data.py:1006: Exception

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[en/LiST countries/UKR_databook.xlsx]

Exception: Error in program data: Target population is 0 for Balanced energy-protein supplementation

Target population is 0 for Cash transfers

Target population is 0 for Lipid-based nutrition supplements

Target population is 0 for Public provision of complementary foods

Target population is 0 for Small quantity lipid-based nutrition supplements
Raw output
self = <nutrition.data.Dataset at 0x774e171d3d10>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'UKR_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x774e175e2750>
country = None, region = None, name = 'UKR_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
>           self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)

../nutrition/data.py:1004: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/data.py:683: in __init__
    self.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.ProgramData at 0x774e171548d0>
[<class 'nutrition.data.ProgramData'>]
————————————————————————————————... 0x774e16e57090>
                 [<class 'nutritio [...]
————————————————————————————————————————————————————————————


    def validate(self):
        """ Validate program data """
        invalid = []
        for progname in self.base_prog_set:
            cov = self.base_cov[progname]
            if cov < 0 or cov > 1:
                errormsg = _("Baseline coverage is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            sat = self.sat[progname]
            if sat < 0 or sat > 1:
                errormsg = _("Saturation is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_inc = self.max_inc[progname]
            if max_inc < 0 or max_inc > 1:
                errormsg = _("Maximum increase is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_dec = self.max_dec[progname]
            if max_dec < 0 or max_dec > 1:
                errormsg = _("Maximum decrease is outside the interval (0, 100) for %s") % progname
    
                invalid.append(errormsg)
            cost = self.costs[progname]
            if cost <= 0:
                errormsg = _("Cost is 0 or negative for %s") % progname
                invalid.append(errormsg)
            if progname not in self.prog_target.keys():
                errormsg = _("Target population not defined for %s") % progname
                invalid.append(errormsg)
            elif sum(self.prog_target[progname].values()) == 0:
                errormsg = _("Target population is 0 for %s") % progname
                invalid.append(errormsg)
        if invalid:
            errors = "\n\n".join(invalid)
>           raise Exception(errors)
E           Exception: Target population is 0 for Balanced energy-protein supplementation
E           
E           Target population is 0 for Cash transfers
E           
E           Target population is 0 for Lipid-based nutrition supplements
E           
E           Target population is 0 for Public provision of complementary foods
E           
E           Target population is 0 for Small quantity lipid-based nutrition supplements

../nutrition/data.py:727: Exception

The above exception was the direct cause of the following exception:

path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/en/LiST countries/UKR_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:175: in load_data
    dataset = Dataset(databook=databook, country=country, region=region, name=name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.Dataset at 0x774e171d3d10>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'UKR_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x774e175e2750>
country = None, region = None, name = 'UKR_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
            self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)
        except Exception as E:
>           raise Exception("Error in program data: %s" % str(E)) from E
E           Exception: Error in program data: Target population is 0 for Balanced energy-protein supplementation
E           
E           Target population is 0 for Cash transfers
E           
E           Target population is 0 for Lipid-based nutrition supplements
E           
E           Target population is 0 for Public provision of complementary foods
E           
E           Target population is 0 for Small quantity lipid-based nutrition supplements

../nutrition/data.py:1006: Exception

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[en/LiST countries/RUS_databook.xlsx]

Exception: Error in program data: Target population is 0 for Balanced energy-protein supplementation

Target population is 0 for Cash transfers

Target population is 0 for Lipid-based nutrition supplements

Target population is 0 for Public provision of complementary foods

Target population is 0 for Small quantity lipid-based nutrition supplements
Raw output
self = <nutrition.data.Dataset at 0x709d79a8e110>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'RUS_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709d79a8f7d0>
country = None, region = None, name = 'RUS_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
>           self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)

../nutrition/data.py:1004: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/data.py:683: in __init__
    self.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.ProgramData at 0x709d79a7fd50>
[<class 'nutrition.data.ProgramData'>]
————————————————————————————————... 0x709d79273190>
                 [<class 'nutritio [...]
————————————————————————————————————————————————————————————


    def validate(self):
        """ Validate program data """
        invalid = []
        for progname in self.base_prog_set:
            cov = self.base_cov[progname]
            if cov < 0 or cov > 1:
                errormsg = _("Baseline coverage is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            sat = self.sat[progname]
            if sat < 0 or sat > 1:
                errormsg = _("Saturation is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_inc = self.max_inc[progname]
            if max_inc < 0 or max_inc > 1:
                errormsg = _("Maximum increase is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_dec = self.max_dec[progname]
            if max_dec < 0 or max_dec > 1:
                errormsg = _("Maximum decrease is outside the interval (0, 100) for %s") % progname
    
                invalid.append(errormsg)
            cost = self.costs[progname]
            if cost <= 0:
                errormsg = _("Cost is 0 or negative for %s") % progname
                invalid.append(errormsg)
            if progname not in self.prog_target.keys():
                errormsg = _("Target population not defined for %s") % progname
                invalid.append(errormsg)
            elif sum(self.prog_target[progname].values()) == 0:
                errormsg = _("Target population is 0 for %s") % progname
                invalid.append(errormsg)
        if invalid:
            errors = "\n\n".join(invalid)
>           raise Exception(errors)
E           Exception: Target population is 0 for Balanced energy-protein supplementation
E           
E           Target population is 0 for Cash transfers
E           
E           Target population is 0 for Lipid-based nutrition supplements
E           
E           Target population is 0 for Public provision of complementary foods
E           
E           Target population is 0 for Small quantity lipid-based nutrition supplements

../nutrition/data.py:727: Exception

The above exception was the direct cause of the following exception:

path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/en/LiST countries/RUS_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:175: in load_data
    dataset = Dataset(databook=databook, country=country, region=region, name=name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.Dataset at 0x709d79a8e110>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'RUS_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709d79a8f7d0>
country = None, region = None, name = 'RUS_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
            self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)
        except Exception as E:
>           raise Exception("Error in program data: %s" % str(E)) from E
E           Exception: Error in program data: Target population is 0 for Balanced energy-protein supplementation
E           
E           Target population is 0 for Cash transfers
E           
E           Target population is 0 for Lipid-based nutrition supplements
E           
E           Target population is 0 for Public provision of complementary foods
E           
E           Target population is 0 for Small quantity lipid-based nutrition supplements

../nutrition/data.py:1006: Exception

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[en/LiST countries/LCA_databook.xlsx]

Exception: Error in program data: Cost is 0 or negative for Treatment of SAM
Raw output
self = <nutrition.data.Dataset at 0x774e171a1190>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'LCA_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x774e17cb2490>
country = None, region = None, name = 'LCA_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
>           self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)

../nutrition/data.py:1004: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/data.py:683: in __init__
    self.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.ProgramData at 0x774e16cb0310>
[<class 'nutrition.data.ProgramData'>]
————————————————————————————————... 0x774e1718b0d0>
                 [<class 'nutritio [...]
————————————————————————————————————————————————————————————


    def validate(self):
        """ Validate program data """
        invalid = []
        for progname in self.base_prog_set:
            cov = self.base_cov[progname]
            if cov < 0 or cov > 1:
                errormsg = _("Baseline coverage is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            sat = self.sat[progname]
            if sat < 0 or sat > 1:
                errormsg = _("Saturation is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_inc = self.max_inc[progname]
            if max_inc < 0 or max_inc > 1:
                errormsg = _("Maximum increase is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_dec = self.max_dec[progname]
            if max_dec < 0 or max_dec > 1:
                errormsg = _("Maximum decrease is outside the interval (0, 100) for %s") % progname
    
                invalid.append(errormsg)
            cost = self.costs[progname]
            if cost <= 0:
                errormsg = _("Cost is 0 or negative for %s") % progname
                invalid.append(errormsg)
            if progname not in self.prog_target.keys():
                errormsg = _("Target population not defined for %s") % progname
                invalid.append(errormsg)
            elif sum(self.prog_target[progname].values()) == 0:
                errormsg = _("Target population is 0 for %s") % progname
                invalid.append(errormsg)
        if invalid:
            errors = "\n\n".join(invalid)
>           raise Exception(errors)
E           Exception: Cost is 0 or negative for Treatment of SAM

../nutrition/data.py:727: Exception

The above exception was the direct cause of the following exception:

path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/en/LiST countries/LCA_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:175: in load_data
    dataset = Dataset(databook=databook, country=country, region=region, name=name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.Dataset at 0x774e171a1190>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'LCA_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x774e17cb2490>
country = None, region = None, name = 'LCA_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
            self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)
        except Exception as E:
>           raise Exception("Error in program data: %s" % str(E)) from E
E           Exception: Error in program data: Cost is 0 or negative for Treatment of SAM

../nutrition/data.py:1006: Exception

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[en/LiST countries/THA_databook.xlsx]

Exception: Error in program data: Target population is 0 for Balanced energy-protein supplementation

Target population is 0 for Cash transfers

Target population is 0 for Lipid-based nutrition supplements

Target population is 0 for Public provision of complementary foods

Target population is 0 for Small quantity lipid-based nutrition supplements
Raw output
self = <nutrition.data.Dataset at 0x709d78ef3ed0>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'THA_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709d7b0e0390>
country = None, region = None, name = 'THA_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
>           self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)

../nutrition/data.py:1004: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/data.py:683: in __init__
    self.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.ProgramData at 0x709d797c2190>
[<class 'nutrition.data.ProgramData'>]
————————————————————————————————... 0x709d79071c90>
                 [<class 'nutritio [...]
————————————————————————————————————————————————————————————


    def validate(self):
        """ Validate program data """
        invalid = []
        for progname in self.base_prog_set:
            cov = self.base_cov[progname]
            if cov < 0 or cov > 1:
                errormsg = _("Baseline coverage is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            sat = self.sat[progname]
            if sat < 0 or sat > 1:
                errormsg = _("Saturation is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_inc = self.max_inc[progname]
            if max_inc < 0 or max_inc > 1:
                errormsg = _("Maximum increase is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_dec = self.max_dec[progname]
            if max_dec < 0 or max_dec > 1:
                errormsg = _("Maximum decrease is outside the interval (0, 100) for %s") % progname
    
                invalid.append(errormsg)
            cost = self.costs[progname]
            if cost <= 0:
                errormsg = _("Cost is 0 or negative for %s") % progname
                invalid.append(errormsg)
            if progname not in self.prog_target.keys():
                errormsg = _("Target population not defined for %s") % progname
                invalid.append(errormsg)
            elif sum(self.prog_target[progname].values()) == 0:
                errormsg = _("Target population is 0 for %s") % progname
                invalid.append(errormsg)
        if invalid:
            errors = "\n\n".join(invalid)
>           raise Exception(errors)
E           Exception: Target population is 0 for Balanced energy-protein supplementation
E           
E           Target population is 0 for Cash transfers
E           
E           Target population is 0 for Lipid-based nutrition supplements
E           
E           Target population is 0 for Public provision of complementary foods
E           
E           Target population is 0 for Small quantity lipid-based nutrition supplements

../nutrition/data.py:727: Exception

The above exception was the direct cause of the following exception:

path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/en/LiST countries/THA_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:175: in load_data
    dataset = Dataset(databook=databook, country=country, region=region, name=name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.Dataset at 0x709d78ef3ed0>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'THA_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709d7b0e0390>
country = None, region = None, name = 'THA_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
            self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)
        except Exception as E:
>           raise Exception("Error in program data: %s" % str(E)) from E
E           Exception: Error in program data: Target population is 0 for Balanced energy-protein supplementation
E           
E           Target population is 0 for Cash transfers
E           
E           Target population is 0 for Lipid-based nutrition supplements
E           
E           Target population is 0 for Public provision of complementary foods
E           
E           Target population is 0 for Small quantity lipid-based nutrition supplements

../nutrition/data.py:1006: Exception

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[en/LiST countries/AZE_databook.xlsx]

Exception: Error in program data: Target population is 0 for Balanced energy-protein supplementation

Target population is 0 for Cash transfers

Target population is 0 for Lipid-based nutrition supplements

Target population is 0 for Public provision of complementary foods

Target population is 0 for Small quantity lipid-based nutrition supplements
Raw output
self = <nutrition.data.Dataset at 0x709d7989eb50>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'AZE_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709d793f93d0>
country = None, region = None, name = 'AZE_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
>           self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)

../nutrition/data.py:1004: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/data.py:683: in __init__
    self.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.ProgramData at 0x709d79448a90>
[<class 'nutrition.data.ProgramData'>]
————————————————————————————————... 0x709d7977fbd0>
                 [<class 'nutritio [...]
————————————————————————————————————————————————————————————


    def validate(self):
        """ Validate program data """
        invalid = []
        for progname in self.base_prog_set:
            cov = self.base_cov[progname]
            if cov < 0 or cov > 1:
                errormsg = _("Baseline coverage is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            sat = self.sat[progname]
            if sat < 0 or sat > 1:
                errormsg = _("Saturation is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_inc = self.max_inc[progname]
            if max_inc < 0 or max_inc > 1:
                errormsg = _("Maximum increase is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_dec = self.max_dec[progname]
            if max_dec < 0 or max_dec > 1:
                errormsg = _("Maximum decrease is outside the interval (0, 100) for %s") % progname
    
                invalid.append(errormsg)
            cost = self.costs[progname]
            if cost <= 0:
                errormsg = _("Cost is 0 or negative for %s") % progname
                invalid.append(errormsg)
            if progname not in self.prog_target.keys():
                errormsg = _("Target population not defined for %s") % progname
                invalid.append(errormsg)
            elif sum(self.prog_target[progname].values()) == 0:
                errormsg = _("Target population is 0 for %s") % progname
                invalid.append(errormsg)
        if invalid:
            errors = "\n\n".join(invalid)
>           raise Exception(errors)
E           Exception: Target population is 0 for Balanced energy-protein supplementation
E           
E           Target population is 0 for Cash transfers
E           
E           Target population is 0 for Lipid-based nutrition supplements
E           
E           Target population is 0 for Public provision of complementary foods
E           
E           Target population is 0 for Small quantity lipid-based nutrition supplements

../nutrition/data.py:727: Exception

The above exception was the direct cause of the following exception:

path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/en/LiST countries/AZE_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:175: in load_data
    dataset = Dataset(databook=databook, country=country, region=region, name=name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.Dataset at 0x709d7989eb50>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'AZE_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709d793f93d0>
country = None, region = None, name = 'AZE_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
            self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)
        except Exception as E:
>           raise Exception("Error in program data: %s" % str(E)) from E
E           Exception: Error in program data: Target population is 0 for Balanced energy-protein supplementation
E           
E           Target population is 0 for Cash transfers
E           
E           Target population is 0 for Lipid-based nutrition supplements
E           
E           Target population is 0 for Public provision of complementary foods
E           
E           Target population is 0 for Small quantity lipid-based nutrition supplements

../nutrition/data.py:1006: Exception

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[en/LiST countries/BLR_databook.xlsx]

Exception: Error in program data: Target population is 0 for Balanced energy-protein supplementation

Target population is 0 for Cash transfers

Target population is 0 for Lipid-based nutrition supplements

Target population is 0 for Public provision of complementary foods

Target population is 0 for Small quantity lipid-based nutrition supplements
Raw output
self = <nutrition.data.Dataset at 0x774e172e2990>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'BLR_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x774e17109e90>
country = None, region = None, name = 'BLR_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
>           self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)

../nutrition/data.py:1004: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/data.py:683: in __init__
    self.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.ProgramData at 0x774e16a8e110>
[<class 'nutrition.data.ProgramData'>]
————————————————————————————————... 0x774e16a68d10>
                 [<class 'nutritio [...]
————————————————————————————————————————————————————————————


    def validate(self):
        """ Validate program data """
        invalid = []
        for progname in self.base_prog_set:
            cov = self.base_cov[progname]
            if cov < 0 or cov > 1:
                errormsg = _("Baseline coverage is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            sat = self.sat[progname]
            if sat < 0 or sat > 1:
                errormsg = _("Saturation is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_inc = self.max_inc[progname]
            if max_inc < 0 or max_inc > 1:
                errormsg = _("Maximum increase is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_dec = self.max_dec[progname]
            if max_dec < 0 or max_dec > 1:
                errormsg = _("Maximum decrease is outside the interval (0, 100) for %s") % progname
    
                invalid.append(errormsg)
            cost = self.costs[progname]
            if cost <= 0:
                errormsg = _("Cost is 0 or negative for %s") % progname
                invalid.append(errormsg)
            if progname not in self.prog_target.keys():
                errormsg = _("Target population not defined for %s") % progname
                invalid.append(errormsg)
            elif sum(self.prog_target[progname].values()) == 0:
                errormsg = _("Target population is 0 for %s") % progname
                invalid.append(errormsg)
        if invalid:
            errors = "\n\n".join(invalid)
>           raise Exception(errors)
E           Exception: Target population is 0 for Balanced energy-protein supplementation
E           
E           Target population is 0 for Cash transfers
E           
E           Target population is 0 for Lipid-based nutrition supplements
E           
E           Target population is 0 for Public provision of complementary foods
E           
E           Target population is 0 for Small quantity lipid-based nutrition supplements

../nutrition/data.py:727: Exception

The above exception was the direct cause of the following exception:

path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/en/LiST countries/BLR_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:175: in load_data
    dataset = Dataset(databook=databook, country=country, region=region, name=name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.Dataset at 0x774e172e2990>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'BLR_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x774e17109e90>
country = None, region = None, name = 'BLR_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
            self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)
        except Exception as E:
>           raise Exception("Error in program data: %s" % str(E)) from E
E           Exception: Error in program data: Target population is 0 for Balanced energy-protein supplementation
E           
E           Target population is 0 for Cash transfers
E           
E           Target population is 0 for Lipid-based nutrition supplements
E           
E           Target population is 0 for Public provision of complementary foods
E           
E           Target population is 0 for Small quantity lipid-based nutrition supplements

../nutrition/data.py:1006: Exception

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[en/LiST countries/MYS_databook.xlsx]

Exception: Error in program data: Target population is 0 for Balanced energy-protein supplementation

Target population is 0 for Cash transfers

Target population is 0 for Lipid-based nutrition supplements

Target population is 0 for Public provision of complementary foods

Target population is 0 for Small quantity lipid-based nutrition supplements
Raw output
self = <nutrition.data.Dataset at 0x709d79865210>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'MYS_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709d7a454c90>
country = None, region = None, name = 'MYS_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
>           self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)

../nutrition/data.py:1004: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/data.py:683: in __init__
    self.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.ProgramData at 0x709d799cfe50>
[<class 'nutrition.data.ProgramData'>]
————————————————————————————————... 0x709d79490a90>
                 [<class 'nutritio [...]
————————————————————————————————————————————————————————————


    def validate(self):
        """ Validate program data """
        invalid = []
        for progname in self.base_prog_set:
            cov = self.base_cov[progname]
            if cov < 0 or cov > 1:
                errormsg = _("Baseline coverage is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            sat = self.sat[progname]
            if sat < 0 or sat > 1:
                errormsg = _("Saturation is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_inc = self.max_inc[progname]
            if max_inc < 0 or max_inc > 1:
                errormsg = _("Maximum increase is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_dec = self.max_dec[progname]
            if max_dec < 0 or max_dec > 1:
                errormsg = _("Maximum decrease is outside the interval (0, 100) for %s") % progname
    
                invalid.append(errormsg)
            cost = self.costs[progname]
            if cost <= 0:
                errormsg = _("Cost is 0 or negative for %s") % progname
                invalid.append(errormsg)
            if progname not in self.prog_target.keys():
                errormsg = _("Target population not defined for %s") % progname
                invalid.append(errormsg)
            elif sum(self.prog_target[progname].values()) == 0:
                errormsg = _("Target population is 0 for %s") % progname
                invalid.append(errormsg)
        if invalid:
            errors = "\n\n".join(invalid)
>           raise Exception(errors)
E           Exception: Target population is 0 for Balanced energy-protein supplementation
E           
E           Target population is 0 for Cash transfers
E           
E           Target population is 0 for Lipid-based nutrition supplements
E           
E           Target population is 0 for Public provision of complementary foods
E           
E           Target population is 0 for Small quantity lipid-based nutrition supplements

../nutrition/data.py:727: Exception

The above exception was the direct cause of the following exception:

path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/en/LiST countries/MYS_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:175: in load_data
    dataset = Dataset(databook=databook, country=country, region=region, name=name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.Dataset at 0x709d79865210>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'MYS_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709d7a454c90>
country = None, region = None, name = 'MYS_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
            self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)
        except Exception as E:
>           raise Exception("Error in program data: %s" % str(E)) from E
E           Exception: Error in program data: Target population is 0 for Balanced energy-protein supplementation
E           
E           Target population is 0 for Cash transfers
E           
E           Target population is 0 for Lipid-based nutrition supplements
E           
E           Target population is 0 for Public provision of complementary foods
E           
E           Target population is 0 for Small quantity lipid-based nutrition supplements

../nutrition/data.py:1006: Exception

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[es/LiST countries/BLR_databook.xlsx]

Exception: Error in program data: La población objetivo es 0 para Suplemento energético-proteico equilibrado

La población objetivo es 0 para Transferencias de efectivo

La población objetivo es 0 para Suplementos nutricionales a base de lípidos

La población objetivo es 0 para Suministro público de alimentos complementarios

La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades
Raw output
self = <nutrition.data.Dataset at 0x709d7992eb90>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'BLR_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709d797f5410>
country = None, region = None, name = 'BLR_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
>           self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)

../nutrition/data.py:1004: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/data.py:683: in __init__
    self.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.ProgramData at 0x709d792d5f10>
[<class 'nutrition.data.ProgramData'>]
————————————————————————————————... 0x709d79447450>
                 [<class 'nutritio [...]
————————————————————————————————————————————————————————————


    def validate(self):
        """ Validate program data """
        invalid = []
        for progname in self.base_prog_set:
            cov = self.base_cov[progname]
            if cov < 0 or cov > 1:
                errormsg = _("Baseline coverage is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            sat = self.sat[progname]
            if sat < 0 or sat > 1:
                errormsg = _("Saturation is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_inc = self.max_inc[progname]
            if max_inc < 0 or max_inc > 1:
                errormsg = _("Maximum increase is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_dec = self.max_dec[progname]
            if max_dec < 0 or max_dec > 1:
                errormsg = _("Maximum decrease is outside the interval (0, 100) for %s") % progname
    
                invalid.append(errormsg)
            cost = self.costs[progname]
            if cost <= 0:
                errormsg = _("Cost is 0 or negative for %s") % progname
                invalid.append(errormsg)
            if progname not in self.prog_target.keys():
                errormsg = _("Target population not defined for %s") % progname
                invalid.append(errormsg)
            elif sum(self.prog_target[progname].values()) == 0:
                errormsg = _("Target population is 0 for %s") % progname
                invalid.append(errormsg)
        if invalid:
            errors = "\n\n".join(invalid)
>           raise Exception(errors)
E           Exception: La población objetivo es 0 para Suplemento energético-proteico equilibrado
E           
E           La población objetivo es 0 para Transferencias de efectivo
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos
E           
E           La población objetivo es 0 para Suministro público de alimentos complementarios
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades

../nutrition/data.py:727: Exception

The above exception was the direct cause of the following exception:

path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/es/LiST countries/BLR_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:175: in load_data
    dataset = Dataset(databook=databook, country=country, region=region, name=name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.Dataset at 0x709d7992eb90>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'BLR_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709d797f5410>
country = None, region = None, name = 'BLR_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
            self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)
        except Exception as E:
>           raise Exception("Error in program data: %s" % str(E)) from E
E           Exception: Error in program data: La población objetivo es 0 para Suplemento energético-proteico equilibrado
E           
E           La población objetivo es 0 para Transferencias de efectivo
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos
E           
E           La población objetivo es 0 para Suministro público de alimentos complementarios
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades

../nutrition/data.py:1006: Exception

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[en/LiST countries/TUR_databook.xlsx]

ZeroDivisionError: float division by zero
Raw output
path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/en/LiST countries/TUR_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:184: in load_data
    self.add_model(name, growth=growth)  # add model associated with the dataset or datasets
../nutrition/utils.py:85: in wrapper
    return f(*args, **kwargs)
../nutrition/project.py:372: in add_model
    model = Model(dataset, t, growth=growth)
../nutrition/model.py:25: in __init__
    self._set_progs(self.prog_info.base_progset())
../nutrition/model.py:71: in _set_progs
    self.prog_info.set_init_covs(self.pops)
../nutrition/programs.py:661: in set_init_covs
    prog.set_pop_sizes(pops)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.programs.Program at 0x774e1702c850>
[<class 'nutrition.programs.Program'>, <class 'sciris.sc_printing.prett...             years: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
————————————————————————————————————————————————————————————

pops = [<nutrition.populations.Children at 0x774e16a33450>
[<class 'nutrition.populations.Children'>, <class 'nutrition.popul...0x774e16b78ad0>
              [<class 'nutrition.s [...]
————————————————————————————————————————————————————————————
]

    def set_pop_sizes(self, pops):
        self._set_restrpop(pops)
        self._set_unrestrpop(pops)
        # this accounts for different fractions within age bands
>       self.sat_unrestr = self.restr_popsize / self.unrestr_popsize
E       ZeroDivisionError: float division by zero

../nutrition/programs.py:112: ZeroDivisionError

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[en/LiST countries/JOR_databook.xlsx]

ZeroDivisionError: float division by zero
Raw output
path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/en/LiST countries/JOR_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:184: in load_data
    self.add_model(name, growth=growth)  # add model associated with the dataset or datasets
../nutrition/utils.py:85: in wrapper
    return f(*args, **kwargs)
../nutrition/project.py:372: in add_model
    model = Model(dataset, t, growth=growth)
../nutrition/model.py:25: in __init__
    self._set_progs(self.prog_info.base_progset())
../nutrition/model.py:71: in _set_progs
    self.prog_info.set_init_covs(self.pops)
../nutrition/programs.py:661: in set_init_covs
    prog.set_pop_sizes(pops)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.programs.Program at 0x774e170e9fd0>
[<class 'nutrition.programs.Program'>, <class 'sciris.sc_printing.prett...             years: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
————————————————————————————————————————————————————————————

pops = [<nutrition.populations.Children at 0x774e16b2e010>
[<class 'nutrition.populations.Children'>, <class 'nutrition.popul...0x774e171be690>
              [<class 'nutrition.s [...]
————————————————————————————————————————————————————————————
]

    def set_pop_sizes(self, pops):
        self._set_restrpop(pops)
        self._set_unrestrpop(pops)
        # this accounts for different fractions within age bands
>       self.sat_unrestr = self.restr_popsize / self.unrestr_popsize
E       ZeroDivisionError: float division by zero

../nutrition/programs.py:112: ZeroDivisionError

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[es/LiST countries/MDV_databook.xlsx]

Exception: Error in program data: La población objetivo es 0 para Suplemento energético-proteico equilibrado

La población objetivo es 0 para Transferencias de efectivo

La población objetivo es 0 para Suplementos nutricionales a base de lípidos

La población objetivo es 0 para Suministro público de alimentos complementarios

La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades
Raw output
self = <nutrition.data.Dataset at 0x709d7928e010>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'MDV_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709d794429d0>
country = None, region = None, name = 'MDV_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
>           self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)

../nutrition/data.py:1004: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/data.py:683: in __init__
    self.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.ProgramData at 0x709d795e2a50>
[<class 'nutrition.data.ProgramData'>]
————————————————————————————————... 0x709d78e30a90>
                 [<class 'nutritio [...]
————————————————————————————————————————————————————————————


    def validate(self):
        """ Validate program data """
        invalid = []
        for progname in self.base_prog_set:
            cov = self.base_cov[progname]
            if cov < 0 or cov > 1:
                errormsg = _("Baseline coverage is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            sat = self.sat[progname]
            if sat < 0 or sat > 1:
                errormsg = _("Saturation is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_inc = self.max_inc[progname]
            if max_inc < 0 or max_inc > 1:
                errormsg = _("Maximum increase is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_dec = self.max_dec[progname]
            if max_dec < 0 or max_dec > 1:
                errormsg = _("Maximum decrease is outside the interval (0, 100) for %s") % progname
    
                invalid.append(errormsg)
            cost = self.costs[progname]
            if cost <= 0:
                errormsg = _("Cost is 0 or negative for %s") % progname
                invalid.append(errormsg)
            if progname not in self.prog_target.keys():
                errormsg = _("Target population not defined for %s") % progname
                invalid.append(errormsg)
            elif sum(self.prog_target[progname].values()) == 0:
                errormsg = _("Target population is 0 for %s") % progname
                invalid.append(errormsg)
        if invalid:
            errors = "\n\n".join(invalid)
>           raise Exception(errors)
E           Exception: La población objetivo es 0 para Suplemento energético-proteico equilibrado
E           
E           La población objetivo es 0 para Transferencias de efectivo
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos
E           
E           La población objetivo es 0 para Suministro público de alimentos complementarios
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades

../nutrition/data.py:727: Exception

The above exception was the direct cause of the following exception:

path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/es/LiST countries/MDV_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:175: in load_data
    dataset = Dataset(databook=databook, country=country, region=region, name=name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.Dataset at 0x709d7928e010>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'MDV_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709d794429d0>
country = None, region = None, name = 'MDV_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
            self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)
        except Exception as E:
>           raise Exception("Error in program data: %s" % str(E)) from E
E           Exception: Error in program data: La población objetivo es 0 para Suplemento energético-proteico equilibrado
E           
E           La población objetivo es 0 para Transferencias de efectivo
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos
E           
E           La población objetivo es 0 para Suministro público de alimentos complementarios
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades

../nutrition/data.py:1006: Exception

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[es/LiST countries/RUS_databook.xlsx]

Exception: Error in program data: La población objetivo es 0 para Suplemento energético-proteico equilibrado

La población objetivo es 0 para Transferencias de efectivo

La población objetivo es 0 para Suplementos nutricionales a base de lípidos

La población objetivo es 0 para Suministro público de alimentos complementarios

La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades
Raw output
self = <nutrition.data.Dataset at 0x709d79697a10>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'RUS_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709d79679d90>
country = None, region = None, name = 'RUS_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
>           self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)

../nutrition/data.py:1004: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/data.py:683: in __init__
    self.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.ProgramData at 0x709d7924ba50>
[<class 'nutrition.data.ProgramData'>]
————————————————————————————————... 0x709d79344890>
                 [<class 'nutritio [...]
————————————————————————————————————————————————————————————


    def validate(self):
        """ Validate program data """
        invalid = []
        for progname in self.base_prog_set:
            cov = self.base_cov[progname]
            if cov < 0 or cov > 1:
                errormsg = _("Baseline coverage is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            sat = self.sat[progname]
            if sat < 0 or sat > 1:
                errormsg = _("Saturation is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_inc = self.max_inc[progname]
            if max_inc < 0 or max_inc > 1:
                errormsg = _("Maximum increase is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_dec = self.max_dec[progname]
            if max_dec < 0 or max_dec > 1:
                errormsg = _("Maximum decrease is outside the interval (0, 100) for %s") % progname
    
                invalid.append(errormsg)
            cost = self.costs[progname]
            if cost <= 0:
                errormsg = _("Cost is 0 or negative for %s") % progname
                invalid.append(errormsg)
            if progname not in self.prog_target.keys():
                errormsg = _("Target population not defined for %s") % progname
                invalid.append(errormsg)
            elif sum(self.prog_target[progname].values()) == 0:
                errormsg = _("Target population is 0 for %s") % progname
                invalid.append(errormsg)
        if invalid:
            errors = "\n\n".join(invalid)
>           raise Exception(errors)
E           Exception: La población objetivo es 0 para Suplemento energético-proteico equilibrado
E           
E           La población objetivo es 0 para Transferencias de efectivo
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos
E           
E           La población objetivo es 0 para Suministro público de alimentos complementarios
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades

../nutrition/data.py:727: Exception

The above exception was the direct cause of the following exception:

path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/es/LiST countries/RUS_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:175: in load_data
    dataset = Dataset(databook=databook, country=country, region=region, name=name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.Dataset at 0x709d79697a10>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'RUS_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709d79679d90>
country = None, region = None, name = 'RUS_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
            self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)
        except Exception as E:
>           raise Exception("Error in program data: %s" % str(E)) from E
E           Exception: Error in program data: La población objetivo es 0 para Suplemento energético-proteico equilibrado
E           
E           La población objetivo es 0 para Transferencias de efectivo
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos
E           
E           La población objetivo es 0 para Suministro público de alimentos complementarios
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades

../nutrition/data.py:1006: Exception

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[en/LiST countries/BIH_databook.xlsx]

ZeroDivisionError: float division by zero
Raw output
path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/en/LiST countries/BIH_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:184: in load_data
    self.add_model(name, growth=growth)  # add model associated with the dataset or datasets
../nutrition/utils.py:85: in wrapper
    return f(*args, **kwargs)
../nutrition/project.py:372: in add_model
    model = Model(dataset, t, growth=growth)
../nutrition/model.py:25: in __init__
    self._set_progs(self.prog_info.base_progset())
../nutrition/model.py:71: in _set_progs
    self.prog_info.set_init_covs(self.pops)
../nutrition/programs.py:661: in set_init_covs
    prog.set_pop_sizes(pops)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.programs.Program at 0x774e170db510>
[<class 'nutrition.programs.Program'>, <class 'sciris.sc_printing.prett...             years: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
————————————————————————————————————————————————————————————

pops = [<nutrition.populations.Children at 0x774e16b0b450>
[<class 'nutrition.populations.Children'>, <class 'nutrition.popul...0x774e16e58ad0>
              [<class 'nutrition.s [...]
————————————————————————————————————————————————————————————
]

    def set_pop_sizes(self, pops):
        self._set_restrpop(pops)
        self._set_unrestrpop(pops)
        # this accounts for different fractions within age bands
>       self.sat_unrestr = self.restr_popsize / self.unrestr_popsize
E       ZeroDivisionError: float division by zero

../nutrition/programs.py:112: ZeroDivisionError

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[en/LiST countries/TON_databook.xlsx]

Exception: Error in program data: Target population is 0 for Oral rehydration salts

Target population is 0 for Zinc for treatment + ORS
Raw output
self = <nutrition.data.Dataset at 0x774e16279990>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'TON_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x774e168d4e10>
country = None, region = None, name = 'TON_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
>           self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)

../nutrition/data.py:1004: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/data.py:683: in __init__
    self.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.ProgramData at 0x774e16baa010>
[<class 'nutrition.data.ProgramData'>]
————————————————————————————————... 0x774e16386490>
                 [<class 'nutritio [...]
————————————————————————————————————————————————————————————


    def validate(self):
        """ Validate program data """
        invalid = []
        for progname in self.base_prog_set:
            cov = self.base_cov[progname]
            if cov < 0 or cov > 1:
                errormsg = _("Baseline coverage is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            sat = self.sat[progname]
            if sat < 0 or sat > 1:
                errormsg = _("Saturation is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_inc = self.max_inc[progname]
            if max_inc < 0 or max_inc > 1:
                errormsg = _("Maximum increase is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_dec = self.max_dec[progname]
            if max_dec < 0 or max_dec > 1:
                errormsg = _("Maximum decrease is outside the interval (0, 100) for %s") % progname
    
                invalid.append(errormsg)
            cost = self.costs[progname]
            if cost <= 0:
                errormsg = _("Cost is 0 or negative for %s") % progname
                invalid.append(errormsg)
            if progname not in self.prog_target.keys():
                errormsg = _("Target population not defined for %s") % progname
                invalid.append(errormsg)
            elif sum(self.prog_target[progname].values()) == 0:
                errormsg = _("Target population is 0 for %s") % progname
                invalid.append(errormsg)
        if invalid:
            errors = "\n\n".join(invalid)
>           raise Exception(errors)
E           Exception: Target population is 0 for Oral rehydration salts
E           
E           Target population is 0 for Zinc for treatment + ORS

../nutrition/data.py:727: Exception

The above exception was the direct cause of the following exception:

path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/en/LiST countries/TON_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:175: in load_data
    dataset = Dataset(databook=databook, country=country, region=region, name=name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.Dataset at 0x774e16279990>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'TON_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x774e168d4e10>
country = None, region = None, name = 'TON_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
            self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)
        except Exception as E:
>           raise Exception("Error in program data: %s" % str(E)) from E
E           Exception: Error in program data: Target population is 0 for Oral rehydration salts
E           
E           Target population is 0 for Zinc for treatment + ORS

../nutrition/data.py:1006: Exception

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[es/LiST countries/KAZ_databook.xlsx]

Exception: Error in program data: La población objetivo es 0 para Suplemento energético-proteico equilibrado

La población objetivo es 0 para Transferencias de efectivo

La población objetivo es 0 para Suplementos nutricionales a base de lípidos

La población objetivo es 0 para Suministro público de alimentos complementarios

La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades
Raw output
self = <nutrition.data.Dataset at 0x774e17156690>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'KAZ_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x774e16c809d0>
country = None, region = None, name = 'KAZ_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
>           self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)

../nutrition/data.py:1004: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/data.py:683: in __init__
    self.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.ProgramData at 0x774e16435ad0>
[<class 'nutrition.data.ProgramData'>]
————————————————————————————————... 0x774e16434b10>
                 [<class 'nutritio [...]
————————————————————————————————————————————————————————————


    def validate(self):
        """ Validate program data """
        invalid = []
        for progname in self.base_prog_set:
            cov = self.base_cov[progname]
            if cov < 0 or cov > 1:
                errormsg = _("Baseline coverage is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            sat = self.sat[progname]
            if sat < 0 or sat > 1:
                errormsg = _("Saturation is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_inc = self.max_inc[progname]
            if max_inc < 0 or max_inc > 1:
                errormsg = _("Maximum increase is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_dec = self.max_dec[progname]
            if max_dec < 0 or max_dec > 1:
                errormsg = _("Maximum decrease is outside the interval (0, 100) for %s") % progname
    
                invalid.append(errormsg)
            cost = self.costs[progname]
            if cost <= 0:
                errormsg = _("Cost is 0 or negative for %s") % progname
                invalid.append(errormsg)
            if progname not in self.prog_target.keys():
                errormsg = _("Target population not defined for %s") % progname
                invalid.append(errormsg)
            elif sum(self.prog_target[progname].values()) == 0:
                errormsg = _("Target population is 0 for %s") % progname
                invalid.append(errormsg)
        if invalid:
            errors = "\n\n".join(invalid)
>           raise Exception(errors)
E           Exception: La población objetivo es 0 para Suplemento energético-proteico equilibrado
E           
E           La población objetivo es 0 para Transferencias de efectivo
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos
E           
E           La población objetivo es 0 para Suministro público de alimentos complementarios
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades

../nutrition/data.py:727: Exception

The above exception was the direct cause of the following exception:

path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/es/LiST countries/KAZ_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:175: in load_data
    dataset = Dataset(databook=databook, country=country, region=region, name=name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.Dataset at 0x774e17156690>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'KAZ_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x774e16c809d0>
country = None, region = None, name = 'KAZ_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
            self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)
        except Exception as E:
>           raise Exception("Error in program data: %s" % str(E)) from E
E           Exception: Error in program data: La población objetivo es 0 para Suplemento energético-proteico equilibrado
E           
E           La población objetivo es 0 para Transferencias de efectivo
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos
E           
E           La población objetivo es 0 para Suministro público de alimentos complementarios
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades

../nutrition/data.py:1006: Exception

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[es/LiST countries/UKR_databook.xlsx]

Exception: Error in program data: La población objetivo es 0 para Suplemento energético-proteico equilibrado

La población objetivo es 0 para Transferencias de efectivo

La población objetivo es 0 para Suplementos nutricionales a base de lípidos

La población objetivo es 0 para Suministro público de alimentos complementarios

La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades
Raw output
self = <nutrition.data.Dataset at 0x774e16463810>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'UKR_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x774e168d87d0>
country = None, region = None, name = 'UKR_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
>           self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)

../nutrition/data.py:1004: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/data.py:683: in __init__
    self.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.ProgramData at 0x774e1629ea10>
[<class 'nutrition.data.ProgramData'>]
————————————————————————————————... 0x774e168b1cd0>
                 [<class 'nutritio [...]
————————————————————————————————————————————————————————————


    def validate(self):
        """ Validate program data """
        invalid = []
        for progname in self.base_prog_set:
            cov = self.base_cov[progname]
            if cov < 0 or cov > 1:
                errormsg = _("Baseline coverage is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            sat = self.sat[progname]
            if sat < 0 or sat > 1:
                errormsg = _("Saturation is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_inc = self.max_inc[progname]
            if max_inc < 0 or max_inc > 1:
                errormsg = _("Maximum increase is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_dec = self.max_dec[progname]
            if max_dec < 0 or max_dec > 1:
                errormsg = _("Maximum decrease is outside the interval (0, 100) for %s") % progname
    
                invalid.append(errormsg)
            cost = self.costs[progname]
            if cost <= 0:
                errormsg = _("Cost is 0 or negative for %s") % progname
                invalid.append(errormsg)
            if progname not in self.prog_target.keys():
                errormsg = _("Target population not defined for %s") % progname
                invalid.append(errormsg)
            elif sum(self.prog_target[progname].values()) == 0:
                errormsg = _("Target population is 0 for %s") % progname
                invalid.append(errormsg)
        if invalid:
            errors = "\n\n".join(invalid)
>           raise Exception(errors)
E           Exception: La población objetivo es 0 para Suplemento energético-proteico equilibrado
E           
E           La población objetivo es 0 para Transferencias de efectivo
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos
E           
E           La población objetivo es 0 para Suministro público de alimentos complementarios
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades

../nutrition/data.py:727: Exception

The above exception was the direct cause of the following exception:

path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/es/LiST countries/UKR_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:175: in load_data
    dataset = Dataset(databook=databook, country=country, region=region, name=name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.Dataset at 0x774e16463810>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'UKR_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x774e168d87d0>
country = None, region = None, name = 'UKR_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
            self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)
        except Exception as E:
>           raise Exception("Error in program data: %s" % str(E)) from E
E           Exception: Error in program data: La población objetivo es 0 para Suplemento energético-proteico equilibrado
E           
E           La población objetivo es 0 para Transferencias de efectivo
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos
E           
E           La población objetivo es 0 para Suministro público de alimentos complementarios
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades

../nutrition/data.py:1006: Exception

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[es/LiST countries/THA_databook.xlsx]

Exception: Error in program data: La población objetivo es 0 para Suplemento energético-proteico equilibrado

La población objetivo es 0 para Transferencias de efectivo

La población objetivo es 0 para Suplementos nutricionales a base de lípidos

La población objetivo es 0 para Suministro público de alimentos complementarios

La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades
Raw output
self = <nutrition.data.Dataset at 0x709d7923ae50>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'THA_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709d79be4c90>
country = None, region = None, name = 'THA_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
>           self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)

../nutrition/data.py:1004: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/data.py:683: in __init__
    self.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.ProgramData at 0x709d79a7a450>
[<class 'nutrition.data.ProgramData'>]
————————————————————————————————... 0x709d7981a5d0>
                 [<class 'nutritio [...]
————————————————————————————————————————————————————————————


    def validate(self):
        """ Validate program data """
        invalid = []
        for progname in self.base_prog_set:
            cov = self.base_cov[progname]
            if cov < 0 or cov > 1:
                errormsg = _("Baseline coverage is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            sat = self.sat[progname]
            if sat < 0 or sat > 1:
                errormsg = _("Saturation is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_inc = self.max_inc[progname]
            if max_inc < 0 or max_inc > 1:
                errormsg = _("Maximum increase is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_dec = self.max_dec[progname]
            if max_dec < 0 or max_dec > 1:
                errormsg = _("Maximum decrease is outside the interval (0, 100) for %s") % progname
    
                invalid.append(errormsg)
            cost = self.costs[progname]
            if cost <= 0:
                errormsg = _("Cost is 0 or negative for %s") % progname
                invalid.append(errormsg)
            if progname not in self.prog_target.keys():
                errormsg = _("Target population not defined for %s") % progname
                invalid.append(errormsg)
            elif sum(self.prog_target[progname].values()) == 0:
                errormsg = _("Target population is 0 for %s") % progname
                invalid.append(errormsg)
        if invalid:
            errors = "\n\n".join(invalid)
>           raise Exception(errors)
E           Exception: La población objetivo es 0 para Suplemento energético-proteico equilibrado
E           
E           La población objetivo es 0 para Transferencias de efectivo
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos
E           
E           La población objetivo es 0 para Suministro público de alimentos complementarios
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades

../nutrition/data.py:727: Exception

The above exception was the direct cause of the following exception:

path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/es/LiST countries/THA_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:175: in load_data
    dataset = Dataset(databook=databook, country=country, region=region, name=name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.Dataset at 0x709d7923ae50>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'THA_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709d79be4c90>
country = None, region = None, name = 'THA_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
            self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)
        except Exception as E:
>           raise Exception("Error in program data: %s" % str(E)) from E
E           Exception: Error in program data: La población objetivo es 0 para Suplemento energético-proteico equilibrado
E           
E           La población objetivo es 0 para Transferencias de efectivo
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos
E           
E           La población objetivo es 0 para Suministro público de alimentos complementarios
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades

../nutrition/data.py:1006: Exception

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[es/LiST countries/LCA_databook.xlsx]

Exception: Error in program data: El costo es 0 o negativo para Tratamiento de la MAS
Raw output
self = <nutrition.data.Dataset at 0x774e1721e690>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'LCA_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x774e16802ad0>
country = None, region = None, name = 'LCA_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
>           self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)

../nutrition/data.py:1004: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/data.py:683: in __init__
    self.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.ProgramData at 0x774e16a08b90>
[<class 'nutrition.data.ProgramData'>]
————————————————————————————————... 0x774e1639f090>
                 [<class 'nutritio [...]
————————————————————————————————————————————————————————————


    def validate(self):
        """ Validate program data """
        invalid = []
        for progname in self.base_prog_set:
            cov = self.base_cov[progname]
            if cov < 0 or cov > 1:
                errormsg = _("Baseline coverage is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            sat = self.sat[progname]
            if sat < 0 or sat > 1:
                errormsg = _("Saturation is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_inc = self.max_inc[progname]
            if max_inc < 0 or max_inc > 1:
                errormsg = _("Maximum increase is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_dec = self.max_dec[progname]
            if max_dec < 0 or max_dec > 1:
                errormsg = _("Maximum decrease is outside the interval (0, 100) for %s") % progname
    
                invalid.append(errormsg)
            cost = self.costs[progname]
            if cost <= 0:
                errormsg = _("Cost is 0 or negative for %s") % progname
                invalid.append(errormsg)
            if progname not in self.prog_target.keys():
                errormsg = _("Target population not defined for %s") % progname
                invalid.append(errormsg)
            elif sum(self.prog_target[progname].values()) == 0:
                errormsg = _("Target population is 0 for %s") % progname
                invalid.append(errormsg)
        if invalid:
            errors = "\n\n".join(invalid)
>           raise Exception(errors)
E           Exception: El costo es 0 o negativo para Tratamiento de la MAS

../nutrition/data.py:727: Exception

The above exception was the direct cause of the following exception:

path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/es/LiST countries/LCA_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:175: in load_data
    dataset = Dataset(databook=databook, country=country, region=region, name=name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.Dataset at 0x774e1721e690>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'LCA_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x774e16802ad0>
country = None, region = None, name = 'LCA_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
            self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)
        except Exception as E:
>           raise Exception("Error in program data: %s" % str(E)) from E
E           Exception: Error in program data: El costo es 0 o negativo para Tratamiento de la MAS

../nutrition/data.py:1006: Exception

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[es/LiST countries/AZE_databook.xlsx]

Exception: Error in program data: La población objetivo es 0 para Suplemento energético-proteico equilibrado

La población objetivo es 0 para Transferencias de efectivo

La población objetivo es 0 para Suplementos nutricionales a base de lípidos

La población objetivo es 0 para Suministro público de alimentos complementarios

La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades
Raw output
self = <nutrition.data.Dataset at 0x709d7992c650>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'AZE_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709d7992ebd0>
country = None, region = None, name = 'AZE_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
>           self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)

../nutrition/data.py:1004: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/data.py:683: in __init__
    self.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.ProgramData at 0x709d799f5610>
[<class 'nutrition.data.ProgramData'>]
————————————————————————————————... 0x709d78effa90>
                 [<class 'nutritio [...]
————————————————————————————————————————————————————————————


    def validate(self):
        """ Validate program data """
        invalid = []
        for progname in self.base_prog_set:
            cov = self.base_cov[progname]
            if cov < 0 or cov > 1:
                errormsg = _("Baseline coverage is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            sat = self.sat[progname]
            if sat < 0 or sat > 1:
                errormsg = _("Saturation is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_inc = self.max_inc[progname]
            if max_inc < 0 or max_inc > 1:
                errormsg = _("Maximum increase is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_dec = self.max_dec[progname]
            if max_dec < 0 or max_dec > 1:
                errormsg = _("Maximum decrease is outside the interval (0, 100) for %s") % progname
    
                invalid.append(errormsg)
            cost = self.costs[progname]
            if cost <= 0:
                errormsg = _("Cost is 0 or negative for %s") % progname
                invalid.append(errormsg)
            if progname not in self.prog_target.keys():
                errormsg = _("Target population not defined for %s") % progname
                invalid.append(errormsg)
            elif sum(self.prog_target[progname].values()) == 0:
                errormsg = _("Target population is 0 for %s") % progname
                invalid.append(errormsg)
        if invalid:
            errors = "\n\n".join(invalid)
>           raise Exception(errors)
E           Exception: La población objetivo es 0 para Suplemento energético-proteico equilibrado
E           
E           La población objetivo es 0 para Transferencias de efectivo
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos
E           
E           La población objetivo es 0 para Suministro público de alimentos complementarios
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades

../nutrition/data.py:727: Exception

The above exception was the direct cause of the following exception:

path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/es/LiST countries/AZE_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:175: in load_data
    dataset = Dataset(databook=databook, country=country, region=region, name=name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.Dataset at 0x709d7992c650>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'AZE_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709d7992ebd0>
country = None, region = None, name = 'AZE_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
            self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)
        except Exception as E:
>           raise Exception("Error in program data: %s" % str(E)) from E
E           Exception: Error in program data: La población objetivo es 0 para Suplemento energético-proteico equilibrado
E           
E           La población objetivo es 0 para Transferencias de efectivo
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos
E           
E           La población objetivo es 0 para Suministro público de alimentos complementarios
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades

../nutrition/data.py:1006: Exception

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[es/LiST countries/MYS_databook.xlsx]

Exception: Error in program data: La población objetivo es 0 para Suplemento energético-proteico equilibrado

La población objetivo es 0 para Transferencias de efectivo

La población objetivo es 0 para Suplementos nutricionales a base de lípidos

La población objetivo es 0 para Suministro público de alimentos complementarios

La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades
Raw output
self = <nutrition.data.Dataset at 0x709d797abf10>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'MYS_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709d797a8490>
country = None, region = None, name = 'MYS_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
>           self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)

../nutrition/data.py:1004: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/data.py:683: in __init__
    self.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.ProgramData at 0x709d79404b90>
[<class 'nutrition.data.ProgramData'>]
————————————————————————————————... 0x709d78a8b190>
                 [<class 'nutritio [...]
————————————————————————————————————————————————————————————


    def validate(self):
        """ Validate program data """
        invalid = []
        for progname in self.base_prog_set:
            cov = self.base_cov[progname]
            if cov < 0 or cov > 1:
                errormsg = _("Baseline coverage is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            sat = self.sat[progname]
            if sat < 0 or sat > 1:
                errormsg = _("Saturation is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_inc = self.max_inc[progname]
            if max_inc < 0 or max_inc > 1:
                errormsg = _("Maximum increase is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_dec = self.max_dec[progname]
            if max_dec < 0 or max_dec > 1:
                errormsg = _("Maximum decrease is outside the interval (0, 100) for %s") % progname
    
                invalid.append(errormsg)
            cost = self.costs[progname]
            if cost <= 0:
                errormsg = _("Cost is 0 or negative for %s") % progname
                invalid.append(errormsg)
            if progname not in self.prog_target.keys():
                errormsg = _("Target population not defined for %s") % progname
                invalid.append(errormsg)
            elif sum(self.prog_target[progname].values()) == 0:
                errormsg = _("Target population is 0 for %s") % progname
                invalid.append(errormsg)
        if invalid:
            errors = "\n\n".join(invalid)
>           raise Exception(errors)
E           Exception: La población objetivo es 0 para Suplemento energético-proteico equilibrado
E           
E           La población objetivo es 0 para Transferencias de efectivo
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos
E           
E           La población objetivo es 0 para Suministro público de alimentos complementarios
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades

../nutrition/data.py:727: Exception

The above exception was the direct cause of the following exception:

path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/es/LiST countries/MYS_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:175: in load_data
    dataset = Dataset(databook=databook, country=country, region=region, name=name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.Dataset at 0x709d797abf10>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'MYS_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x709d797a8490>
country = None, region = None, name = 'MYS_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
            self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)
        except Exception as E:
>           raise Exception("Error in program data: %s" % str(E)) from E
E           Exception: Error in program data: La población objetivo es 0 para Suplemento energético-proteico equilibrado
E           
E           La población objetivo es 0 para Transferencias de efectivo
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos
E           
E           La población objetivo es 0 para Suministro público de alimentos complementarios
E           
E           La población objetivo es 0 para Suplementos nutricionales a base de lípidos en pequeñas cantidades

../nutrition/data.py:1006: Exception

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[es/LiST countries/TUR_databook.xlsx]

ZeroDivisionError: float division by zero
Raw output
path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/es/LiST countries/TUR_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:184: in load_data
    self.add_model(name, growth=growth)  # add model associated with the dataset or datasets
../nutrition/utils.py:85: in wrapper
    return f(*args, **kwargs)
../nutrition/project.py:372: in add_model
    model = Model(dataset, t, growth=growth)
../nutrition/model.py:25: in __init__
    self._set_progs(self.prog_info.base_progset())
../nutrition/model.py:71: in _set_progs
    self.prog_info.set_init_covs(self.pops)
../nutrition/programs.py:661: in set_init_covs
    prog.set_pop_sizes(pops)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.programs.Program at 0x709d78d2f610>
[<class 'nutrition.programs.Program'>, <class 'sciris.sc_printing.prett...             years: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
————————————————————————————————————————————————————————————

pops = [<nutrition.populations.Children at 0x709d78ec45d0>
[<class 'nutrition.populations.Children'>, <class 'nutrition.popul...0x709d78eed1d0>
              [<class 'nutrition.s [...]
————————————————————————————————————————————————————————————
]

    def set_pop_sizes(self, pops):
        self._set_restrpop(pops)
        self._set_unrestrpop(pops)
        # this accounts for different fractions within age bands
>       self.sat_unrestr = self.restr_popsize / self.unrestr_popsize
E       ZeroDivisionError: float division by zero

../nutrition/programs.py:112: ZeroDivisionError

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[es/LiST countries/JOR_databook.xlsx]

ZeroDivisionError: float division by zero
Raw output
path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/es/LiST countries/JOR_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:184: in load_data
    self.add_model(name, growth=growth)  # add model associated with the dataset or datasets
../nutrition/utils.py:85: in wrapper
    return f(*args, **kwargs)
../nutrition/project.py:372: in add_model
    model = Model(dataset, t, growth=growth)
../nutrition/model.py:25: in __init__
    self._set_progs(self.prog_info.base_progset())
../nutrition/model.py:71: in _set_progs
    self.prog_info.set_init_covs(self.pops)
../nutrition/programs.py:661: in set_init_covs
    prog.set_pop_sizes(pops)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.programs.Program at 0x709d797aba10>
[<class 'nutrition.programs.Program'>, <class 'sciris.sc_printing.prett...             years: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
————————————————————————————————————————————————————————————

pops = [<nutrition.populations.Children at 0x709d791657d0>
[<class 'nutrition.populations.Children'>, <class 'nutrition.popul...0x709d78e35290>
              [<class 'nutrition.s [...]
————————————————————————————————————————————————————————————
]

    def set_pop_sizes(self, pops):
        self._set_restrpop(pops)
        self._set_unrestrpop(pops)
        # this accounts for different fractions within age bands
>       self.sat_unrestr = self.restr_popsize / self.unrestr_popsize
E       ZeroDivisionError: float division by zero

../nutrition/programs.py:112: ZeroDivisionError

Check failure on line 14 in tests/test_tox_databooks.py

See this annotation in the file changed.

@github-actions github-actions / JUnit Test Report

test_tox_databooks.test_databook[fr/LiST countries/LCA_databook.xlsx]

Exception: Error in program data: Le coût est égal à 0 ou négatif pour Traitement de la MAS
Raw output
self = <nutrition.data.Dataset at 0x774e16d32b90>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'LCA_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x774e16d729d0>
country = None, region = None, name = 'LCA_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
>           self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)

../nutrition/data.py:1004: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/data.py:683: in __init__
    self.validate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.ProgramData at 0x774e1605e850>
[<class 'nutrition.data.ProgramData'>]
————————————————————————————————... 0x774e16337090>
                 [<class 'nutritio [...]
————————————————————————————————————————————————————————————


    def validate(self):
        """ Validate program data """
        invalid = []
        for progname in self.base_prog_set:
            cov = self.base_cov[progname]
            if cov < 0 or cov > 1:
                errormsg = _("Baseline coverage is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            sat = self.sat[progname]
            if sat < 0 or sat > 1:
                errormsg = _("Saturation is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_inc = self.max_inc[progname]
            if max_inc < 0 or max_inc > 1:
                errormsg = _("Maximum increase is outside the interval (0, 100) for %s") % progname
                invalid.append(errormsg)
            max_dec = self.max_dec[progname]
            if max_dec < 0 or max_dec > 1:
                errormsg = _("Maximum decrease is outside the interval (0, 100) for %s") % progname
    
                invalid.append(errormsg)
            cost = self.costs[progname]
            if cost <= 0:
                errormsg = _("Cost is 0 or negative for %s") % progname
                invalid.append(errormsg)
            if progname not in self.prog_target.keys():
                errormsg = _("Target population not defined for %s") % progname
                invalid.append(errormsg)
            elif sum(self.prog_target[progname].values()) == 0:
                errormsg = _("Target population is 0 for %s") % progname
                invalid.append(errormsg)
        if invalid:
            errors = "\n\n".join(invalid)
>           raise Exception(errors)
E           Exception: Le coût est égal à 0 ou négatif pour Traitement de la MAS

../nutrition/data.py:727: Exception

The above exception was the direct cause of the following exception:

path = PosixPath('/home/runner/work/Nutrition/Nutrition/inputs/fr/LiST countries/LCA_databook.xlsx')

    @pytest.mark.parametrize('path', excel_files, ids=lambda x: str(x.relative_to(inputdir)))
    def test_databook(path):
        P = nu.Project("test")
>       P.load_data(inputspath=path)

test_tox_databooks.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nutrition/project.py:175: in load_data
    dataset = Dataset(databook=databook, country=country, region=region, name=name)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nutrition.data.Dataset at 0x774e16d32b90>
[<class 'nutrition.data.Dataset'>]
————————————————————————————————————————...]
            name: 'LCA_databook'
          region: None
————————————————————————————————————————————————————————————

databook = <pandas.io.excel._base.ExcelFile object at 0x774e16d729d0>
country = None, region = None, name = 'LCA_databook'

    def __init__(self, databook: pandas.ExcelFile, country=None, region=None, name=None):
        """
        :param databook: Databook that is being used in the model
        :param country: The country of interest for data
        :param region: The region of interest in the country (in geospatial optimization)
        :param name:
        """
    
        self.country = country
        self.region = region
        self.name = name
    
        self.calcscache = CalcCellCache()
    
        # Read them into actual data
        try:
            self.demographic_data = DemographicData(databook, self.calcscache)
        except Exception as E:
            raise Exception("Error in databook: %s" % str(E)) from E
    
        try:
            self.prog_data = ProgramData(databook, self.demographic_data, self.calcscache)
        except Exception as E:
>           raise Exception("Error in program data: %s" % str(E)) from E
E           Exception: Error in program data: Le coût est égal à 0 ou négatif pour Traitement de la MAS

../nutrition/data.py:1006: Exception