openforis-whisp 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,39 @@
1
+ import logging
2
+ import sys
3
+
4
+ BASE_MSG_FORMAT = (
5
+ "[%(filename)s | %(funcName)s() | l.%(lineno)s] %(levelname)s: %(message)s"
6
+ )
7
+
8
+
9
+ class StdoutLogger:
10
+ def __init__(self, name: str, msg_format: str = BASE_MSG_FORMAT) -> None:
11
+
12
+ self.handler = logging.StreamHandler(sys.stdout)
13
+ self.handler.setFormatter(logging.Formatter(msg_format))
14
+ self.handler.setLevel(logging.DEBUG)
15
+ self.logger = logging.getLogger(name)
16
+ self.logger.addHandler(self.handler)
17
+ self.logger.propagate = False
18
+
19
+
20
+ class FileLogger:
21
+ def __init__(
22
+ self,
23
+ log_filepath: str,
24
+ msg_format: str = BASE_MSG_FORMAT,
25
+ log_to_stdout: bool = True,
26
+ ) -> None:
27
+
28
+ self.handler = logging.FileHandler(log_filepath)
29
+ self.handler.setFormatter(logging.Formatter(msg_format))
30
+ self.handler.setLevel(logging.DEBUG)
31
+ self.logger = logging.getLogger(f"{__name__}.file_logger_{log_filepath}")
32
+ self.logger.addHandler(self.handler)
33
+ self.logger.propagate = False
34
+
35
+ if log_to_stdout:
36
+ self.stdout_handler = logging.StreamHandler(sys.stdout)
37
+ self.stdout_handler.setFormatter(logging.Formatter(msg_format))
38
+ self.stdout_handler.setLevel(logging.DEBUG)
39
+ self.logger.addHandler(self.stdout_handler)
@@ -0,0 +1,15 @@
1
+ """
2
+ !!! BAD PRACTICE, ALWAYS IMPORT YOUR MODULES EXPLICITELY !!!
3
+
4
+ Module to gather all parameters.
5
+
6
+ If you use a module import all the functions here you only have 1 call to make
7
+ """
8
+
9
+ # from .config_runtime import *
10
+
11
+ # from .config_asr_url_info import *
12
+
13
+ # from .config_asr_credentials import *
14
+
15
+ # from parameters.config_ceo import *
@@ -0,0 +1,47 @@
1
+ from pathlib import Path
2
+
3
+ # unit choice ("ha" or "percent")
4
+ percent_or_ha = "ha"
5
+
6
+ # output column names
7
+ # The names need to align with whisp/parameters/lookup_context_and_metadata.csv
8
+ geometry_area_column = "Area"
9
+
10
+ stats_unit_type_column = "Unit"
11
+
12
+ iso3_country_column = "Country"
13
+
14
+ iso2_country_column = "ProducerCountry"
15
+
16
+ admin_1_column = "Admin_Level_1"
17
+
18
+ centroid_x_coord_column = "Centroid_lon"
19
+
20
+ centroid_y_coord_column = "Centroid_lat"
21
+
22
+ geo_id_column = "external_id"
23
+
24
+ geometry_type_column = "Geometry_type"
25
+
26
+ plot_id_column = "plotId"
27
+
28
+ water_flag = "In_waterbody"
29
+
30
+ geometry_column = "geo" # geometry column name, stored as a string.
31
+
32
+ # reformatting numbers to decimal places (e.g. '%.3f' is 3 dp)
33
+ geometry_area_column_formatting = "%.3f"
34
+
35
+ stats_area_columns_formatting = "%.3f"
36
+
37
+ stats_percent_columns_formatting = "%.0f"
38
+
39
+ # lookup path - for dataset info
40
+ DEFAULT_GEE_DATASETS_LOOKUP_TABLE_PATH = (
41
+ Path(__file__).parent / "lookup_gee_datasets.csv"
42
+ )
43
+
44
+ # lookup path - for dataset info
45
+ DEFAULT_CONTEXT_LOOKUP_TABLE_PATH = (
46
+ Path(__file__).parent / "lookup_context_and_metadata.csv"
47
+ )
@@ -0,0 +1,13 @@
1
+ name,order,theme,use_for_risk,exclude_from_input,exclude_from_output,col_type,is_nullable,is_required,corresponding_variable
2
+ plotId,-10,context_and_metadata,NA,NA,0,string,1,0,plot_id_column
3
+ external_id,-9,context_and_metadata,NA,NA,0,string,1,0,geo_id_column
4
+ Area,-8,context_and_metadata,NA,NA,0,float32,1,1,geometry_area_column
5
+ Geometry_type,-7,context_and_metadata,NA,NA,0,string,1,1,geometry_type_column
6
+ Country,-6,context_and_metadata,NA,NA,0,string,1,1,iso3_country_column
7
+ ProducerCountry,-5,context_and_metadata,NA,NA,0,string,1,1,iso2_country_column
8
+ Admin_Level_1,-4,context_and_metadata,NA,NA,0,string,1,1,admin_1_column
9
+ Centroid_lon,-3,context_and_metadata,NA,NA,0,float64,1,1,centroid_x_coord_column
10
+ Centroid_lat,-2,context_and_metadata,NA,NA,0,float64,1,1,centroid_y_coord_column
11
+ Unit,-1,context_and_metadata,NA,NA,0,string,1,1,stats_unit_type_column
12
+ In_waterbody,0,context_and_metadata,0,NA,0,bool,1,1,water_flag
13
+ geo,9999,context_and_metadata,0,NA,0,string,1,1,geometry_column
@@ -0,0 +1,155 @@
1
+ name,order,theme,use_for_risk,exclude_from_output,col_type,is_nullable,is_required,corresponding_variable
2
+ EUFO_2020,10,treecover,1,0,float32,1,0,jrc_gfc_2020_prep
3
+ GLAD_Primary,20,treecover,1,0,float32,1,0,glad_pht_prep
4
+ TMF_undist,30,treecover,1,0,float32,1,0,jrc_tmf_undisturbed_prep
5
+ JAXA_FNF_2020,40,treecover,1,0,float32,1,0,jaxa_forest_prep
6
+ GFC_TC_2020,50,treecover,1,0,float32,1,0,glad_gfc_10pc_prep
7
+ Forest_FDaP,60,treecover,1,0,float32,1,0,glad_gfc_10pc_prep
8
+ ESA_TC_2020,70,treecover,1,0,float32,1,0,esa_worldcover_trees_prep
9
+ TMF_plant,80,commodities,1,0,float32,1,0,jrc_tmf_plantation_prep
10
+ Oil_palm_Descals,90,commodities,1,0,float32,1,0,creaf_descals_palm_prep
11
+ Oil_palm_FDaP,100,commodities,1,0,float32,1,0,fdap_palm_prep
12
+ Cocoa_FDaP,110,commodities,1,0,float32,1,0,fdap_cocoa
13
+ Cocoa_ETH,120,commodities,1,0,float32,1,0,eth_kalischek_cocoa_prep
14
+ Cocoa_bnetd,130,commodities,1,0,float32,1,0,civ_ocs2020_prep
15
+ Rubber_FDaP,140,commodities,1,0,float32,1,0,fdap_rubber_prep
16
+ Rubber_RBGE,150,commodities,1,0,float32,1,0,rbge_rubber_prep
17
+ WDPA,160,ancilliary,0,1,bool,1,0,wcmc_wdpa_protection_prep
18
+ KBA,170,ancilliary,0,1,bool,1,0,birdlife_kbas_biodiversity_prep
19
+ TMF_def_2000,180,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
20
+ TMF_def_2001,190,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
21
+ TMF_def_2002,200,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
22
+ TMF_def_2003,210,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
23
+ TMF_def_2004,220,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
24
+ TMF_def_2005,230,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
25
+ TMF_def_2006,240,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
26
+ TMF_def_2007,250,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
27
+ TMF_def_2008,260,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
28
+ TMF_def_2009,270,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
29
+ TMF_def_2010,280,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
30
+ TMF_def_2011,290,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
31
+ TMF_def_2012,300,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
32
+ TMF_def_2013,310,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
33
+ TMF_def_2014,320,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
34
+ TMF_def_2015,330,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
35
+ TMF_def_2016,340,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
36
+ TMF_def_2017,350,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
37
+ TMF_def_2018,360,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
38
+ TMF_def_2019,370,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
39
+ TMF_def_2020,380,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
40
+ TMF_def_2021,390,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
41
+ TMF_def_2022,400,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
42
+ TMF_def_2023,410,disturbance_before,0,0,float32,1,0,tmf_def_per_year_prep
43
+ TMF_deg_2000,420,disturbance_before,0,0,float32,1,0,tmf_deg_per_year_prep
44
+ TMF_deg_2001,430,disturbance_before,0,0,float32,1,0,tmf_deg_per_year_prep
45
+ TMF_deg_2002,440,disturbance_before,0,0,float32,1,0,tmf_deg_per_year_prep
46
+ TMF_deg_2003,450,disturbance_before,0,0,float32,1,0,tmf_deg_per_year_prep
47
+ TMF_deg_2004,460,disturbance_before,0,0,float32,1,0,tmf_deg_per_year_prep
48
+ TMF_deg_2005,470,disturbance_before,0,0,float32,1,0,tmf_deg_per_year_prep
49
+ TMF_deg_2006,480,disturbance_before,0,0,float32,1,0,tmf_deg_per_year_prep
50
+ TMF_deg_2007,490,disturbance_before,0,0,float32,1,0,tmf_deg_per_year_prep
51
+ TMF_deg_2008,500,disturbance_before,0,0,float32,1,0,tmf_deg_per_year_prep
52
+ TMF_deg_2009,510,disturbance_before,0,0,float32,1,0,tmf_deg_per_year_prep
53
+ TMF_deg_2010,520,disturbance_before,0,0,float32,1,0,tmf_deg_per_year_prep
54
+ TMF_deg_2011,530,disturbance_before,0,0,float32,1,0,tmf_deg_per_year_prep
55
+ TMF_deg_2012,540,disturbance_before,0,0,float32,1,0,tmf_deg_per_year_prep
56
+ TMF_deg_2013,550,disturbance_before,0,0,float32,1,0,tmf_deg_per_year_prep
57
+ TMF_deg_2014,560,disturbance_before,0,0,float32,1,0,tmf_deg_per_year_prep
58
+ TMF_deg_2015,570,disturbance_before,0,0,float32,1,0,tmf_deg_per_year_prep
59
+ TMF_deg_2016,580,disturbance_before,0,0,float32,1,0,tmf_deg_per_year_prep
60
+ TMF_deg_2017,590,disturbance_before,0,0,float32,1,0,tmf_deg_per_year_prep
61
+ TMF_deg_2018,600,disturbance_before,0,0,float32,1,0,tmf_deg_per_year_prep
62
+ TMF_deg_2019,610,disturbance_before,0,0,float32,1,0,tmf_deg_per_year_prep
63
+ TMF_deg_2020,620,disturbance_before,0,0,float32,1,0,tmf_deg_per_year_prep
64
+ TMF_deg_2021,630,disturbance_after,0,0,float32,1,0,tmf_deg_per_year_prep
65
+ TMF_deg_2022,640,disturbance_after,0,0,float32,1,0,tmf_deg_per_year_prep
66
+ TMF_deg_2023,650,disturbance_after,0,0,float32,1,0,tmf_deg_per_year_prep
67
+ GFC_loss_year_2001,660,disturbance_before,0,0,float32,1,0,glad_gfc_loss_per_year_prep
68
+ GFC_loss_year_2002,670,disturbance_before,0,0,float32,1,0,glad_gfc_loss_per_year_prep
69
+ GFC_loss_year_2003,680,disturbance_before,0,0,float32,1,0,glad_gfc_loss_per_year_prep
70
+ GFC_loss_year_2004,690,disturbance_before,0,0,float32,1,0,glad_gfc_loss_per_year_prep
71
+ GFC_loss_year_2005,700,disturbance_before,0,0,float32,1,0,glad_gfc_loss_per_year_prep
72
+ GFC_loss_year_2006,710,disturbance_before,0,0,float32,1,0,glad_gfc_loss_per_year_prep
73
+ GFC_loss_year_2007,720,disturbance_before,0,0,float32,1,0,glad_gfc_loss_per_year_prep
74
+ GFC_loss_year_2008,730,disturbance_before,0,0,float32,1,0,glad_gfc_loss_per_year_prep
75
+ GFC_loss_year_2009,740,disturbance_before,0,0,float32,1,0,glad_gfc_loss_per_year_prep
76
+ GFC_loss_year_2010,750,disturbance_before,0,0,float32,1,0,glad_gfc_loss_per_year_prep
77
+ GFC_loss_year_2011,760,disturbance_before,0,0,float32,1,0,glad_gfc_loss_per_year_prep
78
+ GFC_loss_year_2012,770,disturbance_before,0,0,float32,1,0,glad_gfc_loss_per_year_prep
79
+ GFC_loss_year_2013,780,disturbance_before,0,0,float32,1,0,glad_gfc_loss_per_year_prep
80
+ GFC_loss_year_2014,790,disturbance_before,0,0,float32,1,0,glad_gfc_loss_per_year_prep
81
+ GFC_loss_year_2015,800,disturbance_before,0,0,float32,1,0,glad_gfc_loss_per_year_prep
82
+ GFC_loss_year_2016,810,disturbance_before,0,0,float32,1,0,glad_gfc_loss_per_year_prep
83
+ GFC_loss_year_2017,820,disturbance_before,0,0,float32,1,0,glad_gfc_loss_per_year_prep
84
+ GFC_loss_year_2018,830,disturbance_before,0,0,float32,1,0,glad_gfc_loss_per_year_prep
85
+ GFC_loss_year_2019,840,disturbance_before,0,0,float32,1,0,glad_gfc_loss_per_year_prep
86
+ GFC_loss_year_2020,850,disturbance_before,0,0,float32,1,0,glad_gfc_loss_per_year_prep
87
+ GFC_loss_year_2021,860,disturbance_after,0,0,float32,1,0,glad_gfc_loss_per_year_prep
88
+ GFC_loss_year_2022,870,disturbance_after,0,0,float32,1,0,glad_gfc_loss_per_year_prep
89
+ GFC_loss_year_2023,880,disturbance_after,0,0,float32,1,0,glad_gfc_loss_per_year_prep
90
+ RADD_year_2019,890,disturbance_before,0,0,float32,1,0,radd_year_prep
91
+ RADD_year_2020,900,disturbance_before,0,0,float32,1,0,radd_year_prep
92
+ RADD_year_2021,910,disturbance_after,0,0,float32,1,0,radd_year_prep
93
+ RADD_year_2022,920,disturbance_after,0,0,float32,1,0,radd_year_prep
94
+ RADD_year_2023,930,disturbance_after,0,0,float32,1,0,radd_year_prep
95
+ RADD_year_2024,940,disturbance_after,0,0,float32,1,0,radd_year_prep
96
+ RADD_year_2025,941,disturbance_after,0,0,float32,1,0,radd_year_prep
97
+ DIST_year_2024,945,disturbance_after,0,1,float32,1,0,glad_dist_year_prep
98
+ DIST_year_2025,946,disturbance_after,0,1,float32,1,0,glad_dist_year_prep
99
+ ESA_fire_2001,950,disturbance_before,0,0,float32,1,0,esa_fire_prep
100
+ ESA_fire_2002,960,disturbance_before,0,0,float32,1,0,esa_fire_prep
101
+ ESA_fire_2003,970,disturbance_before,0,0,float32,1,0,esa_fire_prep
102
+ ESA_fire_2004,980,disturbance_before,0,0,float32,1,0,esa_fire_prep
103
+ ESA_fire_2005,990,disturbance_before,0,0,float32,1,0,esa_fire_prep
104
+ ESA_fire_2006,1000,disturbance_before,0,0,float32,1,0,esa_fire_prep
105
+ ESA_fire_2007,1010,disturbance_before,0,0,float32,1,0,esa_fire_prep
106
+ ESA_fire_2008,1020,disturbance_before,0,0,float32,1,0,esa_fire_prep
107
+ ESA_fire_2009,1030,disturbance_before,0,0,float32,1,0,esa_fire_prep
108
+ ESA_fire_2010,1040,disturbance_before,0,0,float32,1,0,esa_fire_prep
109
+ ESA_fire_2011,1050,disturbance_before,0,0,float32,1,0,esa_fire_prep
110
+ ESA_fire_2012,1060,disturbance_before,0,0,float32,1,0,esa_fire_prep
111
+ ESA_fire_2013,1070,disturbance_before,0,0,float32,1,0,esa_fire_prep
112
+ ESA_fire_2014,1080,disturbance_before,0,0,float32,1,0,esa_fire_prep
113
+ ESA_fire_2015,1090,disturbance_before,0,0,float32,1,0,esa_fire_prep
114
+ ESA_fire_2016,1100,disturbance_before,0,0,float32,1,0,esa_fire_prep
115
+ ESA_fire_2017,1110,disturbance_before,0,0,float32,1,0,esa_fire_prep
116
+ ESA_fire_2018,1120,disturbance_before,0,0,float32,1,0,esa_fire_prep
117
+ ESA_fire_2019,1130,disturbance_before,0,0,float32,1,0,esa_fire_prep
118
+ ESA_fire_2020,1140,disturbance_before,0,0,float32,1,0,esa_fire_prep
119
+ MODIS_fire_2000,1150,disturbance_before,0,0,float32,1,0,modis_fire_prep
120
+ MODIS_fire_2001,1160,disturbance_before,0,0,float32,1,0,modis_fire_prep
121
+ MODIS_fire_2002,1170,disturbance_before,0,0,float32,1,0,modis_fire_prep
122
+ MODIS_fire_2003,1180,disturbance_before,0,0,float32,1,0,modis_fire_prep
123
+ MODIS_fire_2004,1190,disturbance_before,0,0,float32,1,0,modis_fire_prep
124
+ MODIS_fire_2005,1200,disturbance_before,0,0,float32,1,0,modis_fire_prep
125
+ MODIS_fire_2006,1210,disturbance_before,0,0,float32,1,0,modis_fire_prep
126
+ MODIS_fire_2007,1220,disturbance_before,0,0,float32,1,0,modis_fire_prep
127
+ MODIS_fire_2008,1230,disturbance_before,0,0,float32,1,0,modis_fire_prep
128
+ MODIS_fire_2009,1240,disturbance_before,0,0,float32,1,0,modis_fire_prep
129
+ MODIS_fire_2010,1250,disturbance_before,0,0,float32,1,0,modis_fire_prep
130
+ MODIS_fire_2011,1260,disturbance_before,0,0,float32,1,0,modis_fire_prep
131
+ MODIS_fire_2012,1270,disturbance_before,0,0,float32,1,0,modis_fire_prep
132
+ MODIS_fire_2013,1280,disturbance_before,0,0,float32,1,0,modis_fire_prep
133
+ MODIS_fire_2014,1290,disturbance_before,0,0,float32,1,0,modis_fire_prep
134
+ MODIS_fire_2015,1300,disturbance_before,0,0,float32,1,0,modis_fire_prep
135
+ MODIS_fire_2016,1310,disturbance_before,0,0,float32,1,0,modis_fire_prep
136
+ MODIS_fire_2017,1320,disturbance_before,0,0,float32,1,0,modis_fire_prep
137
+ MODIS_fire_2018,1330,disturbance_before,0,0,float32,1,0,modis_fire_prep
138
+ MODIS_fire_2019,1340,disturbance_before,0,0,float32,1,0,modis_fire_prep
139
+ MODIS_fire_2020,1350,disturbance_before,0,0,float32,1,0,modis_fire_prep
140
+ MODIS_fire_2021,1360,disturbance_after,0,0,float32,1,0,modis_fire_prep
141
+ MODIS_fire_2022,1370,disturbance_after,0,0,float32,1,0,modis_fire_prep
142
+ MODIS_fire_2023,1380,disturbance_after,0,0,float32,1,0,modis_fire_prep
143
+ MODIS_fire_2024,1390,disturbance_after,0,0,float32,1,0,modis_fire_prep
144
+ TMF_deg_before_2020,1400,disturbance_before,1,0,float32,1,0,tmf_deg_before_2020_prep
145
+ TMF_def_before_2020,1410,disturbance_before,1,0,float32,1,0,tmf_def_before_2020_prep
146
+ GFC_loss_before_2020,1420,disturbance_before,1,0,float32,1,0,glad_gfc_loss_before_2020_prep
147
+ ESA_fire_before_2020,1430,disturbance_before,1,0,float32,1,0,esa_fire_before_2020_prep
148
+ MODIS_fire_before_2020,1440,disturbance_before,1,0,float32,1,0,modis_fire_before_2020_prep
149
+ RADD_before_2020,1450,disturbance_before,1,0,float32,1,0,radd_before_2020_prep
150
+ TMF_deg_after_2020,1460,disturbance_after,1,0,float32,1,0,tmf_deg_after_2020_prep
151
+ TMF_def_after_2020,1470,disturbance_after,1,0,float32,1,0,tmf_def_after_2020_prep
152
+ GFC_loss_after_2020,1480,disturbance_after,1,0,float32,1,0,glad_gfc_loss_after_2020_prep
153
+ MODIS_fire_after_2020,1490,disturbance_after,1,0,float32,1,0,modis_fire_after_2020_prep
154
+ RADD_after_2020,1500,disturbance_after,1,0,float32,1,0,RADD_after_2020_prep
155
+ DIST_after_2020,1600,disturbance_after,1,1,float32,1,0,glad_dist_after_2020_prep
@@ -0,0 +1,77 @@
1
+ import pandera as pa
2
+ from pandera.typing import DataFrame, Series
3
+
4
+ # Define a schema for validating a DataFrame related to GEE (Google Earth Engine) datasets.
5
+ class DataLookupSchema(pa.DataFrameModel):
6
+
7
+ # Ensure the name is unique
8
+ name: Series[str] = pa.Field(unique=True, nullable=False)
9
+ order: Series[int] = pa.Field(nullable=False)
10
+ theme: Series[str] = pa.Field(nullable=True)
11
+
12
+ # Define fields without checks
13
+ use_for_risk: Series[pa.Int | bool] = pa.Field(nullable=True)
14
+ exclude_from_output: Series[pa.Int | bool] = pa.Field(nullable=False)
15
+
16
+ # Define col_type without checks
17
+ col_type: Series[str] = pa.Field(nullable=False)
18
+
19
+ is_nullable: Series[pa.Int | bool] = pa.Field(nullable=False)
20
+ is_required: Series[pa.Int | bool] = pa.Field(nullable=False)
21
+
22
+ corresponding_variable: Series[str] = pa.Field(nullable=True)
23
+
24
+
25
+ # For type annotation - not used for validation yet
26
+ data_lookup_type = DataFrame[DataLookupSchema]
27
+
28
+
29
+ # checks (below) not working currently so using without
30
+
31
+
32
+ # import pandera as pa
33
+ # from pandera.typing import DataFrame, Series
34
+
35
+ # # Define a schema for validating a DataFrame related to GEE (Google Earth Engine) datasets.
36
+ # class DataLookupSchema(pa.DataFrameModel):
37
+
38
+ # # Ensure the name is unique
39
+ # name: Series[str] = pa.Field(unique=True, nullable=False)
40
+ # order: Series[int] = pa.Field(nullable=False)
41
+ # theme: Series[str] = pa.Field(nullable=True)
42
+
43
+ # # Restrict use_for_risk to 0 or 1, either as int or bool
44
+ # use_for_risk: Series[pa.Int | bool] = pa.Field(
45
+ # checks=pa.Check.isin([0, 1]), # Using 'checks' keyword argument
46
+ # nullable=True
47
+ # )
48
+
49
+ # # Restrict exclude_from_input and exclude_from_output to 0 or 1
50
+ # exclude_from_input: Series[pa.Int | bool] = pa.Field(
51
+ # checks=pa.Check.isin([0, 1]),
52
+ # nullable=False
53
+ # )
54
+ # exclude_from_output: Series[pa.Int | bool] = pa.Field(
55
+ # checks=pa.Check.isin([0, 1]),
56
+ # nullable=False
57
+ # )
58
+
59
+ # # Restrict col_type to specific values
60
+ # col_type: Series[str] = pa.Field(
61
+ # checks=pa.Check.isin(['int', 'int64', 'string', 'float32', 'float64', 'bool']),
62
+ # nullable=False
63
+ # )
64
+
65
+ # is_nullable: Series[pa.Int | bool] = pa.Field(
66
+ # checks=pa.Check.isin([0, 1]),
67
+ # nullable=False
68
+ # )
69
+ # is_required: Series[pa.Int | bool] = pa.Field(
70
+ # checks=pa.Check.isin([0, 1]),
71
+ # nullable=False
72
+ # )
73
+
74
+ # corresponding_variable: Series[str] = pa.Field(nullable=True)
75
+
76
+ # # For type annotation
77
+ # data_lookup_type = DataFrame[DataLookupSchema]