SOOPManager#

class stixcore.soop.manager.SOOPManager(data_root, *, mock_api=False)[source]#

Bases: object

Manages LTP files provided by GFTS

Attributes Summary

SOOP_FILE_FILTER

SOOP_FILE_REGEX

data_root

Get the data path root directory.

Methods Summary

add_soop_file_to_index(path, *[, rebuild_index])

download_all_soops_from_api(ltpname, ...)

find_observations(*, start[, end, otype])

Search for all observations in the index.

find_soops(*, start[, end])

Search for all SOOPs in the index.

get_keywords(*, start[, end, otype])

Searches for corresponding entries (SOOPs and Observations) in the index LTPs.

rebuild_index()

Attributes Documentation

SOOP_FILE_FILTER = 'SSTX_observation_timeline_export_*.json'#
SOOP_FILE_REGEX = re.compile('.*SSTX_observation_timeline_export_.*.json$')#
data_root#

Get the data path root directory.

Returns:

pathlib.Path – path of the root directory

Methods Documentation

add_soop_file_to_index(path, *, rebuild_index=True, **args)[source]#
download_all_soops_from_api(ltpname, version, destination)[source]#
find_observations(*, start, end=None, otype=SoopObservationType.ALL)[source]#

Search for all observations in the index.

Parameters:
  • start (datetime) – start time to look for overlapping observations in utc time

  • end (datetime, optional) – end time to look for overlapping observations in utc time, by default None ()

  • otype (SoopObservationType, optional) – filter for specific type, by default SoopObservationType.ALL

Returns:

list – list of found SOOPObservation in all indexed LTP overlapping the given timeperiod/point and matching the SoopObservationType.

find_soops(*, start, end=None)[source]#

Search for all SOOPs in the index.

Parameters:
  • start (datetime) – start time to look for overlapping SOOPs in utc time

  • end (datetime, optional) – end time to look for overlapping SOOPs in utc time, by default None ()

Returns:

list – list of found SOOP in all indexed LTP overlapping the given timeperiod/point

get_keywords(*, start, end=None, otype=SoopObservationType.ALL)[source]#

Searches for corresponding entries (SOOPs and Observations) in the index LTPs.

Based on all found entries for the filter parameters a list of HeaderKeyword is generated combining all available information.

Parameters:
  • start (datetime) – start time to look for overlapping observations and SOOPs in utc time

  • end (datetime, optional) – end time to look for overlapping observations and SOOPs in utc time, by default None ()

  • otype (SoopObservationType, optional) – filter for specific type of observations, by default SoopObservationType.ALL

Returns:

list – A list of HeaderKeyword

Raises:

ValueError – if no SOOPs or Observations where found in the index LTPs for the given filter settings.

rebuild_index()[source]#