data_extraction_transformation/scripts/jsonfy_specific_timeseries.py [24:52]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        df[y_column] = df[y_column].apply(lambda x: 1 if x in true_alerting_mapping else 0)
        df = df.sort_values(by='push_timestamp', ascending=True)
        indices = df.index[df[y_column] == 1].tolist()
        indices.sort()
        new_entry = {
            "1": indices
        }
        annotations[signature_id] = new_entry
        n_obs = len(df)
        json_df = {
            "name": signature_id,
            "longname": f"{signature_id} timeseries",
            "n_obs": n_obs,
            "n_dim": 1,
            "time": {
                "type": "string",
                "format": "%Y-%m-%d %H:%M:%S",
                "index": list(range(n_obs)),
                "raw": df['push_timestamp'].tolist()
            },
            "series": [
                {
                    "label": "Timeseries",
                    "type": "float",
                    "raw": df['value'].tolist()
                }
            ]
        }
        signature_json_file = signature_id + ".json"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



data_extraction_transformation/scripts/one_time_use_scripts/jsonfy-one-timeseries.py [18:46]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
df[y_column] = df[y_column].apply(lambda x: 1 if x in true_alerting_mapping else 0)
df = df.sort_values(by='push_timestamp', ascending=True)
indices = df.index[df[y_column] == 1].tolist()
indices.sort()
new_entry = {
    "1": indices
}
annotations[signature_id] = new_entry
n_obs = len(df)
json_df = {
    "name": signature_id,
    "longname": f"{signature_id} timeseries",
    "n_obs": n_obs,
    "n_dim": 1,
    "time": {
        "type": "string",
        "format": "%Y-%m-%d %H:%M:%S",
        "index": list(range(n_obs)),
        "raw": df['push_timestamp'].tolist()
    },
    "series": [
        {
            "label": "Timeseries",
            "type": "float",
            "raw": df['value'].tolist()
        }
    ]
}
signature_json_file = signature_id + ".json"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



