sdwis_drink_water.data_praser

Module Contents

Classes

Parser

SDWISJSONParser

[

ResultDataParser

class sdwis_drink_water.data_praser.Parser
abstract parse(payload, *args, **kwargs)

Parse the response payload and return the result.

class sdwis_drink_water.data_praser.SDWISJSONParser

Bases: Parser

[

“pwsid”: “010502003”, “sample_id”: “01050200317607”, “primacy_agency_code”: “01”, “epa_region”: “01”, “sar_id”: 18509157, “contaminant_code”: “PB90”, “result_sign_code”: “=”, “sample_measure”: 0.029, “unit_of_measure”: “mg/L”

}, {

“pwsid”: “041210001”, “sample_id”: “041461”, “primacy_agency_code”: “04”, “epa_region”: “04”, “sar_id”: 17717185, “contaminant_code”: “PB90”, “result_sign_code”: null, “sample_measure”: 0.031, “unit_of_measure”: “mg/L”

}
parse(payload, *args, **kwargs)

Parse the response payload and return the result.

parse_count_result(count_result)
class sdwis_drink_water.data_praser.ResultDataParser(data)
get_first_n_records(n)

Return the first n records from the data.

count()

Return the first n records from the data.

show()

Return the first n records from the data.

_get_column_values(key)

Extract all values for a given key from the data.

_get_column_values_with_records(key)

Extract all values for a given key from the data along with their corresponding records.

find_max(key)

Find the maximum value(s) and corresponding records for a given key.

find_min(key)

Find the minimum value(s) and corresponding records for a given key.

_parse_condition(condition)
_filter_by_condition(condition)
find_min_with_condition(key, condition)
find_max_with_condition(key, condition)
find_by_condition(condition)

Find records that match a condition like ‘KEY>value’.

get_all_keys()

Return a set of all keys in the data.

export_data(filename, format_type='csv')

Export data to a file in the specified format.

intersect_with(other_data)

Find the intersection of the current data with the specified data. :param other_data: The specified data to intersect with. :type other_data: ResultDataParser

Returns:

New instance containing the intersecting records.

Return type:

ResultDataParser

difference_with(other_data)

Find the difference between the current data and specified data. :param other_data: The specified data to compare with. :type other_data: ResultDataParser

Returns:

New instance containing the difference.

Return type:

ResultDataParser

merge_with(other_data)

Merge the current data with the specified data. :param other_data: The specified data to merge with. :type other_data: ResultDataParser

Returns:

New instance containing the merged data.

Return type:

ResultDataParser

remove_key(key_to_remove)

Remove a specified key from all data records. :param key_to_remove: The key to be removed from the data records. :type key_to_remove: str

Returns:

New instance with the key removed from all records.

Return type:

ResultDataParser