From f765655b88f5b4efc9618949ca0224085a5b8c92 Mon Sep 17 00:00:00 2001 From: aporr Date: Thu, 14 May 2026 16:10:40 -0400 Subject: [PATCH 1/2] Refer to the region consisting of Franklin and Delaware counties as FRADEL rather than MPO region --- morpc/census/geos.py | 4 ++-- morpc/morpc.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/morpc/census/geos.py b/morpc/census/geos.py index b15286f..70a0146 100644 --- a/morpc/census/geos.py +++ b/morpc/census/geos.py @@ -69,9 +69,9 @@ "for": f"county:{','.join([morpc.CONST_COUNTY_NAME_TO_ID[x][2:6] for x in morpc.CONST_REGIONS['Mobility Region']])}" } }, - {"regionmpo":{ + {"regionfradel":{ "in": "state:39", - "for": f"county:{','.join([morpc.CONST_COUNTY_NAME_TO_ID[x][2:6] for x in morpc.CONST_REGIONS['MPO Region']])}" + "for": f"county:{','.join([morpc.CONST_COUNTY_NAME_TO_ID[x][2:6] for x in morpc.CONST_REGIONS['FRADEL']])}" }} ] diff --git a/morpc/morpc.py b/morpc/morpc.py index 61e4fc0..d5856bd 100644 --- a/morpc/morpc.py +++ b/morpc/morpc.py @@ -178,7 +178,7 @@ CONST_REGIONS["CEDS Region"] = CONST_REGIONS["REGIONCEDS"] CONST_REGIONS["CBSA"] = CONST_REGIONS["REGION7"] + ["Hocking","Morrow","Perry"] CONST_REGIONS['Mobility Region'] = CONST_REGIONS['REGION7'] + ['Logan', 'Fayette'] -CONST_REGIONS['MPO Region'] = ['Delaware', 'Franklin'] +CONST_REGIONS['FRADEL'] = ['Delaware', 'Franklin'] # Region identifiers # Note that the Columbus MSA already has a GEOID that is defined by the Census Bureau. See CONST_COLUMBUS_MSA_ID above. @@ -196,7 +196,7 @@ # The following regions are comprised of collections of whole counties. Not all region definitions are county-based, # for example the MPO region. -CONST_REGIONS_COUNTYBASED = ["REGION15","REGION10","REGION7","REGIONCEDS","REGIONCORPO","REGIONONECBUS","CBSA"] +CONST_REGIONS_COUNTYBASED = ["REGION15","REGION10","REGION7","REGIONCEDS","REGIONCORPO","REGIONONECBUS","CBSA","FRADEL"] # County name abbreviations ## CONST_COUNTY_ABBREV maps the full county name to its three-letter abbreviation From 4eba16e5c74c60f2cd1f1570554c2cc8d6401deb Mon Sep 17 00:00:00 2001 From: aporr Date: Thu, 14 May 2026 17:04:31 -0400 Subject: [PATCH 2/2] Revert handling of missing files in cast_field_types Not sure if the reverted change was intentional or not but it was incorrectly raising an exception for me when the columns in my dataframe matched the columns in the schema. --- morpc/frictionless/frictionless.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/morpc/frictionless/frictionless.py b/morpc/frictionless/frictionless.py index 1c0729e..a6ed90d 100644 --- a/morpc/frictionless/frictionless.py +++ b/morpc/frictionless/frictionless.py @@ -172,18 +172,21 @@ def cast_field_types(df, schema, forceInteger:bool=False, forceInt64:bool=False, for nullValue in schema.missing_values: outDF = outDF.replace(nullValue, None) - if(handleMissingFields == "ignore"): - logger.info(f"Ignoring missing fields") - elif(handleMissingFields == "add"): - logger.info("Adding missing fields which is not present in dataframe") - outDF = add_missing_fields(df, schema) - else: - logger.error("Fields in schema is not present in dataframe. To handle missing fields, see argument handleMissingFields.") - raise RuntimeError - for field in schema.fields: fieldName = field.name - fieldType = field.type + fieldType = field.type + if(not fieldName in df.columns): + if(handleMissingFields == "ignore"): + logger.info("Skipping field {} which is not present in dataframe".format(fieldName)) + continue + elif(handleMissingFields == "add"): + logger.info("Adding field {} which is not present in dataframe".format(fieldName)) + add_missing_fields(df, schema, fieldNames=fieldName, verbose=False) + continue + else: + logger.error("Field {} is not present in dataframe. To handle missing fields, see argument handleMissingFields.".format(fieldName)) + raise RuntimeError + logger.debug("Casting field {} as type {}.".format(fieldName, fieldType)) # The following section is necessary because the pandas "int" type does not support null values. If null values are present, # the field must be cast as "Int64" instead.