Skip to content

Commit

Permalink
Update tests / paths etc
Browse files Browse the repository at this point in the history
  • Loading branch information
jvivian committed Oct 28, 2024
1 parent 6d0a841 commit be6471e
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 52 deletions.
2 changes: 1 addition & 1 deletion coverage.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" ?>
<coverage version="7.4.3" timestamp="1729480086814" lines-valid="319" lines-covered="302" line-rate="0.9467" branches-valid="96" branches-covered="82" branch-rate="0.8542" complexity="0">
<coverage version="7.4.3" timestamp="1730151898557" lines-valid="319" lines-covered="302" line-rate="0.9467" branches-valid="96" branches-covered="82" branch-rate="0.8542" complexity="0">
<!-- Generated by coverage.py: https://coverage.readthedocs.io/en/7.4.3 -->
<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
<sources>
Expand Down
66 changes: 33 additions & 33 deletions data/processed/df_paths.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
data/raw/economic/GDP/gdp_current_dollars.csv
data/raw/economic/UI/ar203_output.csv
data/raw/economic/consumption/consumption.csv
data/raw/economic/consumption_durable_goods/consumption_durable_goods.csv
data/raw/economic/consumption_nondurable_goods/consumption_nondurable_goods.csv
data/raw/economic/consumption_services/consumption_services.csv
data/raw/economic/consumption_total_goods/consumption_total_goods.csv
data/raw/economic/employment/CE16OV_output.csv
data/raw/economic/employment/PAYEMS_output.csv
data/raw/economic/inflation/CPIAUCSL_output.csv
data/raw/economic/inflation/PCEPILFE_output.csv
data/raw/economic/inflation/PCEPI_output.csv
data/raw/economic/interest_rates/rates_output.csv
data/raw/economic/investment/K1TTOTL1ES000_output.csv
data/raw/economic/investment/RPFI_output.csv
data/raw/economic/productivity/labor-productivity-by-state-and-region_output.csv
data/raw/economic/unemployment/ststdsadata_output.csv
data/raw/intervention/american_rescue_plan/fiscalrecoveryfunds-statefunding1-CSV_output.csv
data/raw/intervention/cares/cares_state_allocation_output.csv
data/raw/intervention/ppp/PPP_states_and_territories_output.csv
data/raw/pandemic/cases/CDC_state_cases_and_deaths_output.csv
data/raw/pandemic/cases/JHU_time_series_cases_output.csv
data/raw/pandemic/deaths/time_series_covid19_deaths_US_output_FIXED - time_series_covid19_deaths_US_output.csv
data/raw/pandemic/vaccinations/19_Vaccinations_in_the_United_States_Jurisdiction_output_output.csv
data/raw/pandemic/vaccinations/time_series_covid19_vaccine_us_output.csv
data/raw/state_mandates/UWashington/USstatesCov19distancingpolicyBETA_complete_output.csv
data/raw/state_mandates/mask_mandates/U.S._State_and_Territorial_Public_Mask_Mandates_From_April_8__2020_through_August_15__2021_by_State_by_Day_output.csv
data/raw/economic/inflation/pcpiMvMd.csv
data/raw/economic/interest_rates/FEDFUNDS_output.csv
data/raw/economic/inflation/pcpiMvMd.csv
data/raw/economic/interest_rates/FEDFUNDS_output.csv
data/raw/state_mandates/shelter_in_place/U.S._State_and_Territorial_Stay-At-Home_Orders__March_15__2020___August_15__2021_by_County_by_Day_output.csv
data/raw/pandemic/cases/CDC_Case_Surveillance.csv
../data/raw/economic/GDP/gdp_current_dollars.csv
../data/raw/economic/UI/ar203_output.csv
../data/raw/economic/consumption/consumption.csv
../data/raw/economic/consumption_durable_goods/consumption_durable_goods.csv
../data/raw/economic/consumption_nondurable_goods/consumption_nondurable_goods.csv
../data/raw/economic/consumption_services/consumption_services.csv
../data/raw/economic/consumption_total_goods/consumption_total_goods.csv
../data/raw/economic/employment/CE16OV_output.csv
../data/raw/economic/employment/PAYEMS_output.csv
../data/raw/economic/inflation/CPIAUCSL_output.csv
../data/raw/economic/inflation/PCEPILFE_output.csv
../data/raw/economic/inflation/PCEPI_output.csv
../data/raw/economic/interest_rates/rates_output.csv
../data/raw/economic/investment/K1TTOTL1ES000_output.csv
../data/raw/economic/investment/RPFI_output.csv
../data/raw/economic/productivity/labor-productivity-by-state-and-region_output.csv
../data/raw/economic/unemployment/ststdsadata_output.csv
../data/raw/intervention/american_rescue_plan/fiscalrecoveryfunds-statefunding1-CSV_output.csv
../data/raw/intervention/cares/cares_state_allocation_output.csv
../data/raw/intervention/ppp/PPP_states_and_territories_output.csv
../data/raw/pandemic/cases/CDC_state_cases_and_deaths_output.csv
../data/raw/pandemic/cases/JHU_time_series_cases_output.csv
../data/raw/pandemic/deaths/time_series_covid19_deaths_US_output_FIXED - time_series_covid19_deaths_US_output.csv
../data/raw/pandemic/vaccinations/19_Vaccinations_in_the_United_States_Jurisdiction_output_output.csv
../data/raw/pandemic/vaccinations/time_series_covid19_vaccine_us_output.csv
../data/raw/state_mandates/UWashington/USstatesCov19distancingpolicyBETA_complete_output.csv
../data/raw/state_mandates/mask_mandates/U.S._State_and_Territorial_Public_Mask_Mandates_From_April_8__2020_through_August_15__2021_by_State_by_Day_output.csv
../data/raw/economic/inflation/pcpiMvMd.csv
../data/raw/economic/interest_rates/FEDFUNDS_output.csv
../data/raw/economic/inflation/pcpiMvMd.csv
../data/raw/economic/interest_rates/FEDFUNDS_output.csv
../data/raw/state_mandates/shelter_in_place/U.S._State_and_Territorial_Stay-At-Home_Orders__March_15__2020___August_15__2021_by_County_by_Day_output.csv
../data/raw/pandemic/cases/CDC_Case_Surveillance.csv
2 changes: 1 addition & 1 deletion dfmdash/covid19.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from dfmdash.constants import NAME_MAP

ROOT_DIR = Path(__file__).parent.absolute()
DATA_DIR = ROOT_DIR / "data/processed"
DATA_DIR = ROOT_DIR / "../data/processed"


def _get_raw_df() -> pd.DataFrame:
Expand Down
4 changes: 1 addition & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import shutil
import os
from pathlib import Path

import pytest
from typer.testing import CliRunner

from dfmdash.cli import app
from dfmdash.covid19 import DATA_DIR

runner = CliRunner()


# TODO: Change to be test.h5ad with small state subset
def test_run_dfm(tmpdir):
result = runner.invoke(app, ["run", str(DATA_DIR / "test.h5ad"), str(tmpdir), "--batch", "State"])
Expand Down
10 changes: 5 additions & 5 deletions tests/test_covid19.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

from dfmdash.covid19 import (
_get_raw_df,
get_raw,
get_df,
get_project_h5ad,
get_govt_fund_dist,
add_datetime,
adjust_inflation,
adjust_pandemic_response,
add_datetime,
fix_names,
get_df,
get_govt_fund_dist,
get_project_h5ad,
get_raw,
)


Expand Down
4 changes: 3 additions & 1 deletion tests/test_dfm.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import shutil
import unittest
from pathlib import Path
from dfmdash.dfm import ModelRunner

from anndata import AnnData

from dfmdash.covid19 import get_project_h5ad
from dfmdash.dfm import ModelRunner

COLUMNS = ["PCE", "CPIU", "Hosp1", "Hosp2"]
STATES = ["AK", "CA"]
Expand Down
14 changes: 8 additions & 6 deletions tests/test_io.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import shutil
import pandas as pd
import numpy as np
from pathlib import Path

import numpy as np
import pandas as pd
import pytest
from anndata import AnnData
from dfmdash.io import DataLoader

from dfmdash.covid19 import DATA_DIR
import pytest
from dfmdash.io import DataLoader


@pytest.fixture()
def dfs():
data = pd.read_csv(DATA_DIR / "data.csv")
factors = pd.read_csv(DATA_DIR / "factors.csv", index_col=0)
metadata = pd.read_csv(DATA_DIR / "metadata.csv", index_col=0)
factors = pd.read_csv(DATA_DIR / "../factors.csv", index_col=0)
metadata = pd.read_csv(DATA_DIR / "../metadata.csv", index_col=0)
return data, factors, metadata


Expand Down
2 changes: 1 addition & 1 deletion tests/test_processing.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from functools import reduce
from pathlib import Path

import pandas as pd
import pytest
from pathlib import Path

from dfmdash.covid19 import get_project_h5ad
from dfmdash.processing import DataProcessor, is_constant
Expand Down
2 changes: 1 addition & 1 deletion tests/test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@pytest.fixture
def runs_dir() -> pd.DataFrame:
return ROOT_DIR / "data" / "example-data"
return ROOT_DIR / "../data" / "example-data"


@pytest.fixture
Expand Down

0 comments on commit be6471e

Please sign in to comment.