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:
- content
dict
Data structure stored in JSON index file converted to simple python form.
- force_metadata
bool
, optional By default the content returned will match the original form that was used for the index. If this parameter is
True
an index ofObservationInfo
will be returned as if it was simple dict content.- force_dict
bool
, optional If
True
the structure returned will always be a dict keyed by filename.
- content
- Returns:
- index
ObservationGroup
ordict
of [str
,dict
] If the index file referred to
ObservationInfo
this will return anObservationGroup
, otherwise adict
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 theforce_metadata
parameter. Ifforce_dict
isTrue
adict
will be returned with filename keys even if the index file refers toObservationInfo
(the values will beObservationInfo
unlessforce_metadata
isTrue
).
- index
Notes
File keys will be relative to the location of the index file.