def _populateItemWithPodaacMetadata()

in libraries/edge/opensearch/atomresponsebysolr.py [0:0]


    def _populateItemWithPodaacMetadata(self, doc, item, multiValuedElementsKeys):
        ignoreElementsEndingWith = ('-Full', '-Long')
        multiValuedElements = defaultdict(list)
        for docKey in list(doc.keys()):
            if docKey.startswith(multiValuedElementsKeys):
                multiValuedElements[docKey.split('-', 1)[0]].append(docKey)
            elif not docKey.endswith(ignoreElementsEndingWith):
                if len(doc[docKey]) > 1:
                    item.append({'namespace': 'podaac', 'name': self._camelCaseStripHyphen(docKey), 'value': [{'namespace': 'podaac', 'name': 'value', 'value': x} for x in doc[docKey]]})
                else:
                    item.append({'namespace': 'podaac', 'name': self._camelCaseStripHyphen(docKey), 'value': doc[docKey][0]})
        for multiValuedKey in multiValuedElements:
            for i, x in enumerate(doc[multiValuedElements[multiValuedKey][0]]):
                values = []
                for key in multiValuedElements[multiValuedKey]:
                    if not key.endswith(ignoreElementsEndingWith):
                        values.append({'namespace': 'podaac', 'name': self._camelCaseStripHyphen(key.split('-', 1)[1]), 'value': doc[key][i]})
                item.append({'namespace': 'podaac', 'name': self._camelCaseStripHyphen(multiValuedKey), 'value': values})