process_index_data

astro_metadata_translator.indexing.process_index_data(content: MutableMapping[str, Any], *, force_metadata: Literal[True], force_dict: Literal[False]) MutableMapping[str, Any]
astro_metadata_translator.indexing.process_index_data(content: MutableMapping[str, Any], *, force_metadata: Literal[False], force_dict: Literal[True]) MutableMapping[str, MutableMapping[str, Any] | ObservationInfo]
astro_metadata_translator.indexing.process_index_data(content: MutableMapping[str, Any], *, force_metadata: bool = False, force_dict: bool = False) ObservationGroup | MutableMapping[str, MutableMapping[str, Any] | ObservationInfo]

Process the content read from a JSON index file.

Parameters:
contentdict

Data structure stored in JSON index file converted to simple python form.

force_metadatabool, optional

By default the content returned will match the original form that was used for the index. If this parameter is True an index of ObservationInfo will be returned as if it was simple dict content.

force_dictbool, optional

If True the structure returned will always be a dict keyed by filename.

Returns:
indexObservationGroup or dict of [str, dict]

If the index file referred to ObservationInfo this will return an ObservationGroup, otherwise a dict will be returned with the keys being paths to files and the values being the keys and values stored in the index (with common information merged in). This can be overridden using the force_metadata parameter. If force_dict is True a dict will be returned with filename keys even if the index file refers to ObservationInfo (the values will be ObservationInfo unless force_metadata is True).

Notes

File keys will be relative to the location of the index file.