chap_core package

Subpackages

Submodules

chap_core.alarms module

class chap_core.alarms.OutbreakParameters(*, endemic_factor: float, probability_threshold: float)[source]

Bases: BaseModel

endemic_factor: float
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

probability_threshold: float
chap_core.alarms.outbreak_prediction(parameters: OutbreakParameters, case_samples: Iterable[float]) bool[source]

chap_core.api module

class chap_core.api.AreaPolygons(shape_file: str)[source]

Bases: object

shape_file: str
class chap_core.api.DummyControl[source]

Bases: object

property current_control
set_status(status)[source]
class chap_core.api.PredictionData(area_polygons: chap_core.api.AreaPolygons = None, health_data: chap_core.spatio_temporal_data.temporal_dataclass.DataSet[bionumpy.bnpdataclass.bnpdataclass.HealthData] = None, climate_data: chap_core.spatio_temporal_data.temporal_dataclass.DataSet[bionumpy.bnpdataclass.bnpdataclass.ClimateData] = None, population_data: chap_core.spatio_temporal_data.temporal_dataclass.DataSet[bionumpy.bnpdataclass.bnpdataclass.HealthPopulationData] = None, disease_id: str | None = None, features: List[object] = None)[source]

Bases: object

area_polygons: AreaPolygons = None
climate_data: DataSet[ClimateData] = None
disease_id: str | None = None
features: List[object] = None
health_data: DataSet[HealthData] = None
population_data: DataSet[HealthPopulationData] = None
chap_core.api.extract_disease_name(health_data: dict) str[source]
chap_core.api.forecast(model_name: str, dataset_name: Literal['hydro_met_subset', 'hydromet_clean', 'hydromet_10', 'hydromet_5_filtered', 'laos_full_data', 'uganda_data', 'ISIMIP_dengue_harmonized'], n_months: int, model_path: str | None = None)[source]

chap_core.api_types module

class chap_core.api_types.BackTestParams(*, nPeriods: int, nSplits: int, stride: int)

Bases: DBModel

model_config: ClassVar[ConfigDict] = {'alias_generator': <function to_camel>, 'from_attributes': True, 'populate_by_name': True, 'registry': PydanticUndefined, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

n_periods: int
n_splits: int
stride: int
class chap_core.api_types.DataElement(*, pe: str, ou: str, value: float | None)

Bases: BaseModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

ou: str
pe: str
value: float | None
class chap_core.api_types.DataElementV2(*, period: str, orgUnit: str, value: float | None)

Bases: BaseModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

orgUnit: str
period: str
value: float | None
class chap_core.api_types.DataList(*, featureId: str, dhis2Id: str, data: Annotated[list[DataElement], MinLen(min_length=1)])

Bases: BaseModel

data: list[DataElement]
dhis2Id: str
featureId: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class chap_core.api_types.DataListV2(*, featureId: str, dataElement: str, data: Annotated[list[DataElementV2], MinLen(min_length=1)])

Bases: BaseModel

data: list[DataElementV2]
dataElement: str
featureId: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class chap_core.api_types.EvaluationEntry(*, orgUnit: str, period: str, quantile: float, value: float, splitPeriod: str)

Bases: PredictionEntry

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

splitPeriod: str
class chap_core.api_types.EvaluationResponse(*, actualCases: DataList, predictions: list[EvaluationEntry])

Bases: BaseModel

actualCases: DataList
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_dump(**kwargs)

Override to handle special types during serialization

predictions: list[EvaluationEntry]
class chap_core.api_types.FeatureCollectionModel(*, type: str = 'FeatureCollection', features: list[FeatureModel])

Bases: FeatureCollectionModel

features: list[FeatureModel]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class chap_core.api_types.FeatureModel(*, type: str = 'Feature', properties: dict[str, ~typing.Any] | None = <factory>, geometry: ~pydantic_geojson.point.PointModel | ~pydantic_geojson.multi_point.MultiPointModel | ~pydantic_geojson.line_string.LineStringModel | ~pydantic_geojson.multi_line_string.MultiLineStringModel | ~pydantic_geojson.polygon.PolygonModel | ~pydantic_geojson.multi_polygon.MultiPolygonModel, id: str | None = None)

Bases: FeatureModel

id: str | None
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

properties: dict[str, Any] | None
class chap_core.api_types.PeriodObservation(*, time_period: str)

Bases: BaseModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

time_period: str
class chap_core.api_types.PredictionEntry(*, orgUnit: str, period: str, quantile: float, value: float)

Bases: BaseModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

orgUnit: str
period: str
quantile: float
value: float
class chap_core.api_types.PredictionRequest(*, orgUnitsGeoJson: FeatureCollectionModel, features: list[DataList], estimator_id: str = 'chap_ewars_monthly', n_periods: int = 3, include_data: bool = False)

Bases: RequestV2

include_data: bool
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

n_periods: int
class chap_core.api_types.RequestV1(*, orgUnitsGeoJson: FeatureCollectionModel, features: list[DataList])

Bases: BaseModel

features: list[DataList]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

orgUnitsGeoJson: FeatureCollectionModel
class chap_core.api_types.RequestV2(*, orgUnitsGeoJson: FeatureCollectionModel, features: list[DataList], estimator_id: str = 'chap_ewars_monthly')

Bases: RequestV1

estimator_id: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

chap_core.cli module

Console script for chap_core.

class chap_core.cli.AreaPolygons[source]

Bases: object

chap_core.cli.append_to_csv(file_object, data_frame: DataFrame)[source]
chap_core.cli.base_args(func, *args, **kwargs)[source]

Decorator that adds some base arguments to a command

chap_core.cli.evaluate(model_name: Literal['MultiRegionPoissonModel', 'MultiRegionNaivePredictor'] | str, dataset_name: Literal['hydro_met_subset', 'hydromet_clean', 'hydromet_10', 'hydromet_5_filtered', 'laos_full_data', 'uganda_data', 'ISIMIP_dengue_harmonized'] | None = None, dataset_country: str | None = None, dataset_csv: Path | None = None, polygons_json: Path | None = None, polygons_id_field: str | None = 'id', prediction_length: int = 6, n_splits: int = 7, report_filename: str | None = 'target/report.pdf', ignore_environment: bool = False, debug: bool = False, log_file: str | None = None, run_directory_type: Literal['latest', 'timestamp', 'use_existing'] | None = 'timestamp', model_configuration_yaml: str | None = None, is_chapkit_model: bool = False)[source]
chap_core.cli.evaluate_hpo(model_name: Literal['MultiRegionPoissonModel', 'MultiRegionNaivePredictor'] | str, dataset_name: Literal['hydro_met_subset', 'hydromet_clean', 'hydromet_10', 'hydromet_5_filtered', 'laos_full_data', 'uganda_data', 'ISIMIP_dengue_harmonized'] | None = None, dataset_country: str | None = None, dataset_csv: Path | None = None, polygons_json: Path | None = None, polygons_id_field: str | None = 'id', prediction_length: int = 3, n_splits: int = 7, report_filename: str | None = 'target/report.pdf', ignore_environment: bool = False, debug: bool = False, log_file: str | None = None, run_directory_type: Literal['latest', 'timestamp', 'use_existing'] | None = 'timestamp', model_configuration_yaml: str | None = None, metric: str | None = 'MSE', direction: Literal['maximize', 'minimize'] = 'minimize', evaluate_hpo: bool | None = True)[source]

Same as evaluate, but has three added arguments and a if check on argument evaluate_hpo.

chap_core.cli.forecast(model_name: str, dataset_name: Literal['hydro_met_subset', 'hydromet_clean', 'hydromet_10', 'hydromet_5_filtered', 'laos_full_data', 'uganda_data', 'ISIMIP_dengue_harmonized'], n_months: int, model_path: str | None = None, out_path: str | None = PosixPath('.'))[source]

Forecast n_months ahead using the given model and dataset

Parameters:

model_name: Name of the model to use, set to external to use an external model and specify the external model with model_path dataset_name: Name of the dataset to use, e.g. hydromet_5_filtered n_months: int: Number of months to forecast ahead model_path: Optional[str]: Path to the model if model_name is external. Can ge a github repo url starting with https://github.com and ending with .git or a path to a local directory. out_path: Optional[str]: Path to save the output file, default is the current directory

chap_core.cli.main()[source]
chap_core.cli.main_function()[source]

This function should just be type hinted with common types, and it will run as a command line function Simple function<

>>> main()
chap_core.cli.multi_forecast(model_name: str, dataset_name: Literal['hydro_met_subset', 'hydromet_clean', 'hydromet_10', 'hydromet_5_filtered', 'laos_full_data', 'uganda_data', 'ISIMIP_dengue_harmonized'], n_months: int, pre_train_months: int, out_path: Path = PosixPath('.'))[source]
chap_core.cli.plot_dataset(data_filename: Path, plot_name: str = 'standardized_feature_plot')[source]
chap_core.cli.sanity_check_model(model_url: str, use_local_environement: bool = False, dataset_path=None, model_config_path: str = None)[source]

Check that a model can be loaded, trained and used to make predictions

chap_core.cli.serve(seedfile: str | None = None, debug: bool = False, auto_reload: bool = False)[source]

Start CHAP as a backend server

chap_core.cli.test(**base_kwargs)[source]

Simple test-command to check that the chap command works

chap_core.cli.write_open_api_spec(out_path: str)[source]

Write the OpenAPI spec to a file

chap_core.climate_predictor module

class chap_core.climate_predictor.FetcherNd(historical_data: DataSet[SimpleClimateData])[source]

Bases: object

get_future_weather(period_range: PeriodRange) DataSet[SimpleClimateData][source]
class chap_core.climate_predictor.FutureWeatherFetcher[source]

Bases: object

get_future_weather(period_range: PeriodRange) DataSet[SimpleClimateData][source]
class chap_core.climate_predictor.MonthlyClimatePredictor[source]

Bases: object

predict(time_period: PeriodRange)[source]
train(train_data: DataSet[ClimateData])[source]
class chap_core.climate_predictor.QuickForecastFetcher(historical_data: DataSet[SimpleClimateData])[source]

Bases: object

get_future_weather(period_range: PeriodRange) DataSet[SimpleClimateData][source]
class chap_core.climate_predictor.SeasonalForecastFetcher(folder_path)[source]

Bases: object

get_future_weather(period_range: PeriodRange) DataSet[SimpleClimateData][source]
class chap_core.climate_predictor.WeeklyClimatePredictor[source]

Bases: MonthlyClimatePredictor

chap_core.climate_predictor.get_climate_predictor(train_data: DataSet[ClimateData])[source]

chap_core.datatypes module

class chap_core.datatypes.ClimateHealthTimeSeriesModel(*, time_period: str | Period, rainfall: float, mean_temperature: float, disease_cases: int)[source]

Bases: BaseModel

disease_cases: int
mean_temperature: float
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

classmethod parse_time_period(data: str | Period) Period[source]
rainfall: float
time_period: str | Period
class chap_core.datatypes.Location(latitude: float, longitude: float)[source]

Bases: Shape

latitude: float
longitude: float
class chap_core.datatypes.Quantile(low: float, high: float, size: float)[source]

Bases: object

high: float
low: float
size: float
class chap_core.datatypes.Shape[source]

Bases: object

chap_core.datatypes.add_field(data: BNPDataClass, new_class: type, **field_data)[source]
chap_core.datatypes.create_tsdataclass(field_names)[source]
chap_core.datatypes.remove_field(data: BNPDataClass, field_name, new_class=None)[source]
chap_core.datatypes.tsdataclass(cls)[source]

chap_core.docker_helper_functions module

chap_core.docker_helper_functions.create_docker_image(dockerfile_directory: Path | str)[source]

Creates a docker image based on path to a directory that should contain a Dockerfile. Uses the final directory name as the name for the image (e.g. /path/to/name/ -> name) Returns the name.

chap_core.docker_helper_functions.docker_image_from_fo(fileobject, name)[source]
chap_core.docker_helper_functions.run_command_through_docker_container(docker_image_name: str, working_directory: str, command: str, remove_after_run: bool = False)[source]

chap_core.exceptions module

exception chap_core.exceptions.CommandLineException[source]

Bases: Exception

exception chap_core.exceptions.GEEError[source]

Bases: Exception

exception chap_core.exceptions.InvalidDateError[source]

Bases: Exception

exception chap_core.exceptions.InvalidModelException[source]

Bases: Exception

exception chap_core.exceptions.ModelConfigurationException[source]

Bases: Exception

exception chap_core.exceptions.ModelFailedException[source]

Bases: Exception

exception chap_core.exceptions.NoPredictionsError[source]

Bases: Exception

chap_core.geojson module

class chap_core.geojson.LocationMapping(ordered_locations)[source]

Bases: object

index_to_name(item)[source]
name_to_index(name)[source]
class chap_core.geojson.NeighbourGraph(regions, graph)[source]

Bases: object

classmethod from_geojson_file(geo_json_file: IO)[source]
to_graph_file(graph_filename: str | Path)[source]
chap_core.geojson.geojson_to_graph(geojson_filename: str | IO, graph_filename: str | Path)[source]
chap_core.geojson.geojson_to_shape(geojson_filename: str, shape_filename: str | Path)[source]

chap_core.geometry module

class chap_core.geometry.PFeatureCollectionModel(*, type: str = 'FeatureCollection', features: list[PFeatureModel])[source]

Bases: FeatureCollectionModel

features: list[PFeatureModel]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class chap_core.geometry.PFeatureModel(*, type: str = 'Feature', properties: dict, geometry: PointModel | MultiPointModel | LineStringModel | MultiLineStringModel | PolygonModel | MultiPolygonModel)[source]

Bases: FeatureModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

properties: dict
class chap_core.geometry.Polygons(polygons)[source]

Bases: object

property bbox
property data: FeatureCollectionModel
feature_collection()[source]
filter_locations(locations: list[str])[source]

Filter the polygons to only include the specified locations

classmethod from_file(filename, id_property='id')[source]
classmethod from_geojson(geojson: dict, id_property: str = 'id')[source]
get_parent_dict()[source]
get_predecessors_map(predecessors: list[str])[source]
id_to_name_tuple_dict() Dict[str, Tuple[str]][source]

Returns a dictionary with the id as key and a tuple with the name and parent as value

to_file(filename)[source]
to_geojson()[source]
chap_core.geometry.add_id(feature, admin_level=1, lookup_dict=None)[source]
chap_core.geometry.get_all_data()[source]
chap_core.geometry.get_area_polygons(country: str, regions: list[str] = None, admin_level: int = 1) FeatureCollectionModel[source]

Get the polygons for the specified regions in the specified country (only ADMIN1 supported) Returns only the regions that are found in the data Name is put in the id field of the feature

Parameters

countrystr

The country name

regionslist[str], optional

Filtering which regions to get the polygons for based on region name

admin_levelint

Which administrative level to get polygons for (0 for country, 1 for admin-1, etc)

Returns

FeatureCollectionModel

The polygons for the specified regions

chap_core.geometry.get_country_data(country, admin_level) PFeatureCollectionModel[source]
chap_core.geometry.get_country_data_file(country: str, level=1)[source]
chap_core.geometry.get_data_file(country_code: str, level=1)[source]
chap_core.geometry.normalize_name(name: str) str[source]

chap_core.geoutils module

Utility functions for working with geometries.

chap_core.geoutils.buffer_feature(feature: FeatureModel, distance: float)[source]

Creates a buffer around a FeatureModel object. Features with point and line geometries will become polygons.

Parameters

featureFeatureModel

A FeatureModel object representing a feature with a geometry.

distancefloat

The distance to buffer around the geometry, given in the same coordinate system units as the feature geometry. For latitude-longitude geometries, a distance of 0.1 is approximately 10 km at the equator but increases towards the poles.

Returns

FeatureModel

A FeatureModel object with the buffered geometry.

chap_core.geoutils.buffer_point_features(collection: FeatureCollectionModel, distance: float)[source]

For a given FeatureCollection, creates a buffer around point-type FeatureModel objects. Features with polygon or line geometries remain unaltered.

Parameters

collectionFeatureCollectionModel

A FeatureCollectionModel object representing a feature collection.

distancefloat

The distance to buffer around the geometry, given in the same coordinate system units as the feature geometry. For latitude-longitude geometries, a distance of 0.1 is approximately 10 km at the equator but increases towards the poles.

Returns

FeatureCollectionModel

A new FeatureCollectionModel object with any point geometries converted to polygon buffers.

chap_core.geoutils.feature_bbox(feature: FeatureModel)[source]

Calculates the bounding box for a FeatureModel object.

Parameters

featureFeatureModel

A FeatureModel object representing a feature with a geometry.

Returns

tuple

A 4-tuple in the form of (xmin,ymin,xmax,ymax)

chap_core.geoutils.inspect_feature_collection(collection)[source]

Inspect and return statistics of the contents of a FeatureModelCollection object.

Parameters

collectionFeatureModelCollection

A FeatureModelCollection object representing a feature collection.

Returns

dict

A dict object with basic count statistics of the different geometry types contained in the FeatureModelCollection.

chap_core.geoutils.render(polygons: Polygons)[source]

Simple utility to render a Polygons object on a map for inspecting and debugging purposes.

Parameters

polygonsPolygons

A Polygons object representing the set of polygons to be rendered.

Returns

PIL.Image.Image

The rendered map image.

chap_core.geoutils.simplify_topology(polygons: Polygons, threshold=None) Polygons[source]

Simplifies a Polygons object while preserving topology between adjacent polygons.

Parameters

polygonsPolygons

A Polygons object representing the set of polygons to be simplified.

thresholdfloat, optional

Coordinate distance threshold used to simplify/round coordinates. If None, the distance threshold will be automatically calculated relative to the bounding box of all polygons, specifically one-thousandth of the longest of the bounding box width or height. The threshold distance is specified in coordinate units. For latitude-longitude coordinates, the threshold should be specified in decimal degrees, where 0.01 decimal degrees is roughly 1 km at the equator but increases towards the poles. For more accurate thresholds, the Polygons object should be created using projected coordinates instead of latitude-longitude.

Returns

Polygons

A simplified Polygons object with preserved topology.

chap_core.internal_state module

class chap_core.internal_state.Control(controls)[source]

Bases: object

cancel()[source]
property current_control
get_progress()[source]
get_status()[source]
set_status(status)[source]
class chap_core.internal_state.InternalState(control: chap_core.internal_state.Control | None, current_data: dict, model_path: str | None = None, current_job: chap_core.worker.interface.Job | None = None)[source]

Bases: object

control: Control | None
current_data: dict
current_job: Job | None = None
is_ready()[source]
model_path: str | None = None

chap_core.log_config module

chap_core.log_config.initialize_logging(debug: bool = None, log_file: str = None)[source]

Initialize logging configuration.

Args:

debug: If True, set log level to DEBUG. If None, auto-detect from CHAP_DEBUG environment variable. log_file: Optional log file path (currently not used).

chap_core.log_config.is_debug_mode() bool[source]

Check if CHAP_DEBUG environment variable is set to enable debug mode.

Returns:

bool: True if CHAP_DEBUG is set to “true”, “1”, or “yes” (case-insensitive).

chap_core.model_spec module

class chap_core.model_spec.EwarsParamSpec(*, n_weeks: Annotated[int, Gt(gt=0)], alpha: float)[source]

Bases: ParameterSpec

alpha: float
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

n_weeks: Annotated[int, Gt(gt=0)]
class chap_core.model_spec.ModelSpec(*, name: str, parameters: dict, features: list[Feature], period: PeriodType = PeriodType.any, description: str = 'No Description yet', author: str = 'Unknown Author', targets: str = 'disease_cases')[source]

Bases: BaseModel

author: str
description: str
features: list[Feature]
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str
parameters: dict
period: PeriodType
targets: str
class chap_core.model_spec.ParameterSpec[source]

Bases: BaseModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class chap_core.model_spec.PeriodType(*values)[source]

Bases: Enum

any = 'any'
month = 'month'
week = 'week'
year = 'year'
chap_core.model_spec.get_dataclass(model_class) type[TimeSeriesData][source]

chap_core.pandas_adaptors module

chap_core.pandas_adaptors.get_time_period(df, year_name, month_name=None, day_name=None, week_name=None)[source]

chap_core.rbased_docker module

chap_core.rbased_docker.create_image(r_packages, image_name='r-custom-image')[source]

Create a Docker image with R installed and the specified R packages.

Parameters:

r_packages (list): A list of R packages to install (e.g., [‘dplyr’, ‘fable’]). image_name (str): Name of the Docker image to create.

chap_core.training_control module

class chap_core.training_control.PrintingTrainingControl[source]

Bases: TrainingControl

register_progress(n_sampled)[source]
set_status(status)[source]
class chap_core.training_control.TrainingControl[source]

Bases: object

cancel()[source]
get_progress()[source]
get_status()[source]
is_cancelled()[source]
register_progress(n_sampled)[source]
set_status(status)[source]
set_total_samples(total_samples)[source]

chap_core.util module

chap_core.util.conda_available()[source]
chap_core.util.docker_available()[source]
chap_core.util.interpolate_nans(y)[source]
chap_core.util.load_redis(db=0)[source]
chap_core.util.nan_helper(y)[source]

Helper to handle indices and logical indices of NaNs.

Input:
  • y, 1d numpy array with possible NaNs

Output:
  • nans, logical indices of NaNs

  • index, a function, with signature indices= index(logical_indices), to convert logical indices of NaNs to ‘equivalent’ indices

Example:
>>> # linear interpolation of NaNs
>>> nans, x = nan_helper(y)
>>> y[nans] = np.interp(x(nans), x(~nans), y[~nans])
chap_core.util.pyenv_available()[source]
chap_core.util.redis_available()[source]

chap_core.validators module

chap_core.validators.validate_training_data(dataset: DataSet, estimator: Estimator | None) None[source]

Validate the training data

Module contents

Top-level package for chap-core.

class chap_core.ModelTemplateInterface[source]

Bases: ABC

get_default_model() ConfiguredModel[source]
abstractmethod get_model(model_configuration: ModelConfiguration | None = None) ConfiguredModel[source]
abstractmethod get_schema() ModelTemplateInformation[source]
chap_core.get_temp_dir() Path[source]

Get the temporary directory for build and test artifacts.

Returns temporary directory path for storing build artifacts, test outputs, model files, and other temporary files. Creates the directory if it doesn’t exist.

Returns

Path

Path to the temporary directory (default: ‘target/’)

chap_core.is_debug_mode() bool[source]

Check if CHAP_DEBUG environment variable is set to enable debug mode.

Returns:

bool: True if CHAP_DEBUG is set to “true”, “1”, or “yes” (case-insensitive).