diff --git a/transfers/util.py b/transfers/util.py index 7b56bcacc..fff89b753 100644 --- a/transfers/util.py +++ b/transfers/util.py @@ -270,14 +270,55 @@ def make_location(row: pd.Series) -> Location: return location +def make_lu_to_lexicon_mapper(): + lu_tables = [ + # "LU_AltitudeDatum", # the code is the value, so no need for mapping + "LU_AltitudeMethod", # CODE/MEANING + "LU_CollectionMethod", # CODE/MEANING + "LU_ConstructionMethod", # CODE/MEANING + "LU_CoordinateAccuracy", # CODE/MEANING + # "LU_CoordinateDatum", # the code is the value, so no need for mapping + "LU_CoordinateMethod", # CODE/MEANING + "LU_CurrentUse", # CODE/MEANING + "LU_DataQuality", # CODE/MEANING + "LU_DataSource", # CODE/MEANING + "LU_Depth_CompletionSource", # CODE/MEANING + "LU_Discharge_ChemistrySource", # CODE/MEANING + # "LU_FieldNoteTypes", # not being used in the transfers since there are no records + # "LU_Formations", # needs to be cleaned before it can be used + "LU_LevelStatus", # CODE/MEANING + # "LU_Lithology", # needs to be cleaned before it can be used + "LU_MajorAnalyte", # CODE/MEANING + "LU_MeasurementMethod", # CODE/MEANING + # "LU_MeasuringAgency", # the abreviation is what is used in the new schema + "LU_MinorTraceAnalyte", # CODE/MEANING + "LU_MonitoringStatus", # CODE/MEANING + "LU_SampleType", # CODE/MEANING + "LU_SiteType", # CODE/MEANING + "LU_Status", # CODE/MEANING + ] + + mappers = {} + + for lu_table in lu_tables: + table = read_csv(lu_table) + + for i, row in table.iterrows(): + if lu_table == "LU_Formations": + code = row.Code + meaning = row.Meaning + else: + code = row.CODE + meaning = row.MEANING + + mappers.update({f"{lu_table}:{code}": meaning}) + return mappers + + +lu_to_lexicon_map = make_lu_to_lexicon_mapper() + + if __name__ == "__main__": - # quad = get_quad_name_from_point(-106.5, 34.2) - # print(quad) - # state = get_state_from_point(-106.5, 34.2) - # print(state) - # county = get_county_from_point(-106.5, 34.2) - # print(county) - z = get_epqs_elevation(-106.5, 34.2) - print(z) + print(lu_to_lexicon_map) # ============= EOF =============================================