Skip to content

MetadataService

Handles Metadata Retrieval workflow.

backend.services.metadata_service.MetadataService

Service responsible for: - Fetching metadata from remote source - Parsing metadata - Discovering new files - Persisting metadata into database

get_metadata_by_active_slot

get_metadata_by_active_slot(instrument, slot_service)

Fetch metadata for current active slot.

:param instrument: instrument used for observation :param slot_service: slot service instance :return: list of metadata files domain entities

get_metadata_by_downlink(instrument, downlink_start_utc, downlink_end_utc)

returns file metadata for a given time window and instrument

:param instrument: instrument used for observation :param downlink_start_utc: start timestamp (UTC) :param downlink_end_utc: end timestamp (UTC) :return: list of file metadata domain entities

get_metadata_by_observation

get_metadata_by_observation(instrument, observation_start_utc, observation_end_utc)

get metadata for the instrument and observation time window

:param instrument: instrument used for observation :param observation_start_utc: start observation timestamp in UTC :param observation_end_utc: end observation timestamp in UTC :return: list of file metadata domain entities

get_metadata_by_slots

get_metadata_by_slots(instrument, slots)

returns files metadata entities for a given slot and instrument

:param instrument: instrument used for observation :param slots: list of slots domain entities :return: list of file metadata entities

read_metadata

read_metadata(raw_file_name)

Fetch metadata using raw file name

:param raw_file_name: raw file name primary key :return: returns complete file metadata

sync_metadata

sync_metadata(instrument, cancel_event, downlink_start_utc=None, downlink_end_utc=None)

Fetch metadata from remote source and update database.

If downlink_start_utc is not provided, it is inferred from DB (latest available record). If downlink_end_utc is not provided, current UTC time is used.

:param instrument: instrument to sync (C2/C3) :param downlink_start_utc: start datetime (UTC optional) :param downlink_end_utc: end datetime (UTC optional) :return: number of new records inserted

sync_metadata_by_slots

sync_metadata_by_slots(instrument, slots, cancel_event)

Sync metadata for given slots. takes start date of earliest slot and end date of latest slot.

:param instrument: instrument used for observation :param slots: list of slots domain entities :return: number of files metadata inserted into db