Skip to main content

pipe_breaks.common package

Submodules

pipe_breaks.common.buildings_affected module

pipe_breaks.common.buildings_affected.buildings_affected_by_watermain(asset_id)

pipe_breaks.common.buildings_affected.main()

pipe_breaks.common.create_and_clean module

pipe_breaks.common.create_and_clean.dataset_for_surv_analysis()

[summary]

  • Returns:[description]
  • Return type:[type]

pipe_breaks.common.db_connection module

pipe_breaks.common.db_connection.check()

Functions checks to see if a connection to the database can be established or not

pipe_breaks.common.fake_data_generation module

pipe_breaks.common.fake_spacetime_processing module

pipe_breaks.common.fill_data module

pipe_breaks.common.functions module

This file is intended to hold definitions for a variety of functions that are important and widely applicable to scripts that are relevant to pipe breaks applications.

pipe_breaks.common.functions.drop_dup_keep_highest(df)

Drop duplicate mains whilst keeping the highest score.

  • Parameters:df (pd.Dataframe) – a dataframe containing mains and their scores.
  • Returns: a dataframe with duplicate mains removed.
  • Return type: pd.Dataframe

pipe_breaks.common.functions.get_grid_row_col(gridnum, columns)

pipe_breaks.common.functions.print_metrics(y, y_pred)

pipe_breaks.common.functions.read_data(csv_path, x_cols, y_col)

pipe_breaks.common.functions.write_csv_df(path, filename, df, index=False)

This function checks if a .csv already exists in the specified location and requests a rename of the output data in cases where a .csv already exists.

  • Parameters:
    • path (str) – path where the output file will be saved
    • filename (str) – name of the output file
    • df (pd.DataFrame) – input DataFrame
    • index (bool**, optional) – _description_. Defaults to False.
  • Returns: None

pipe_breaks.common.mean_values_filler module

pipe_breaks.common.plot_data module

pipe_breaks.common.plotting module

pipe_breaks.common.plotting.make_barplot()

pipe_breaks.common.plotting.make_heatmap()

pipe_breaks.common.plotting.make_scatter(args)

pipe_breaks.common.processing module

This file is intended to process data from utilities for input to the various algorithms in the pipe_breaks project folder.

The relevant data should be stored in two tables: : - one with breaks data

  • one with mains data

The format for both tables should follow the standardized format that has been established. See the “Standard Table Creation” document for more information. — Copyright Global Quality Corp. 2021

2021-01-26 v1.0 @ericvaags 2021-02-19 v1.1 @ericvaags 2021-02-24 v1.2 @ericvaags 2021-02-25 v1.3 @SudarshanPillai 2021-03-03 v1.4 @ericvaags 2021-03-08 v1.5 @ericvaags 2021-03-18 v1.6 @ericvaags

pipe_breaks.common.processing.add_days(dt, days)

[summary]

  • Parameters:
    • dt ([type]) – [description]
    • days ([type]) – [description]
  • Returns:[description]
  • Return type:[type]

pipe_breaks.common.processing.all_unbroken_pipes()

[summary]

  • Returns:[description]
  • Return type:[type]

pipe_breaks.common.processing.calculate_days_num(df)

[summary]

  • Parameters:df ([type]) – [description]
  • Returns:[description]
  • Return type:[type]

pipe_breaks.common.processing.dataset_for_break_date_greater_0_cluster()

[summary]

  • Returns:[description]
  • Return type:[type]

pipe_breaks.common.processing.dataset_for_num_prev_breaks_greater_0()

[summary]

  • Returns:[description]
  • Return type:[type]

pipe_breaks.common.processing.dataset_for_num_prev_breaks_greater_0_cluster()

[summary]

  • Returns:[description]
  • Return type:[type]

pipe_breaks.common.processing.dataset_for_surv_analysis()

[summary]

  • Returns:[description]
  • Return type:[type]

pipe_breaks.common.processing.days_between(d1, d2)

The function returns the days between d1 and d2

  • Parameters:
    • d1 (int) – date 1 in epoch time format
    • d2 (int) – date 2 in epoch time format
  • Returns: number of days between two dates
  • Return type: int

pipe_breaks.common.processing.diameter_conversion(d)

pipe_breaks.common.processing.load_dataset()

pipe_breaks.common.processing.main()

pipe_breaks.common.processing.process_full_dataset()

[summary]

  • Returns:[description]
  • Return type:[type]

pipe_breaks.common.processing.test_break_data()

[summary]

  • Returns:[description]
  • Return type:[type]

pipe_breaks.common.processing_old module

pipe_breaks.common.spacetime_processing module

This file is intended to process data from spacetime analysis of utility data for input to the convolutional neural networks, generative adversarial networks, or any algorithm that is used to predict breaks in space and time.

The relevant data should be stored in one table: : - count of the number of breaks for each grid square over time (i.e., the output of the ‘Visualize Spacetime Cube in 3D’ tool in ArcMap)

The user will also need to know the number of rows and columns that were included as part of the spacetime analysis in order to define the grid row and columns (see the spacetime_processing/settings.py file to input these values)

2021-02-05 @ericvaags

pipe_breaks.common.sqlconnection module

pipe_breaks.common.sqlconnection.get_connection(path: str)

Put the connection in cache to reuse if path does not change between Streamlit reruns. NB : https://stackoverflow.com/questions/48218065/programmingerror-sqlite-objects-created-in-a-thread-can-only-be-used-in-that-sa

Module contents