diff --git a/src/pds/registry/utils/geostac/templates/product-external-template.xml b/src/pds/registry/utils/geostac/templates/product-external-template.xml index 026282e..aa9393d 100644 --- a/src/pds/registry/utils/geostac/templates/product-external-template.xml +++ b/src/pds/registry/utils/geostac/templates/product-external-template.xml @@ -88,4 +88,12 @@ {{encoding_standard}} + + + + urn:nasa:pds:context:target:satellite.earth.moon + data_to_target + + + diff --git a/src/pds/registry/utils/treks/product_service_builder.py b/src/pds/registry/utils/treks/product_service_builder.py index b81d36f..427e5d5 100644 --- a/src/pds/registry/utils/treks/product_service_builder.py +++ b/src/pds/registry/utils/treks/product_service_builder.py @@ -29,6 +29,7 @@ def __init__(self, data, target, save_xml=False, dest="xml_files", verbose=False # get target info self.target_type = None + self.target_lid = None try: name = self.target.capitalize() pds_query_url = \ @@ -36,6 +37,7 @@ def __init__(self, data, target, save_xml=False, dest="xml_files", verbose=False response = requests.get(pds_query_url, timeout=30) # search type of first hit self.target_type = response.json()["data"][0]["properties"]["pds:Target.pds:type"][0] + self.target_lid = response.json()["data"][0]["properties"]["lid"][0] except Exception: if self.verbose: @@ -51,7 +53,7 @@ def create_pds4_xml(self): identification_area, lidvid = self.create_identification_area() observation_area = self.create_observation_area() service = self.create_service() - # TODO: add reference list? + reference_list = self.create_reference_list() # create root root = Et.Element("Product_Service") @@ -71,6 +73,7 @@ def create_pds4_xml(self): root.append(identification_area) root.append(observation_area) root.append(service) + root.append(reference_list) tree = Et.ElementTree(root) @@ -389,6 +392,19 @@ def create_service(self): return service + def create_reference_list(self): + """Creates Reference_Area for pds4 labeel. + + :return: Reference_List section of pds4 xml + """ + reference_list = Et.Element("Reference_List") + + internal_reference = Et.SubElement(reference_list, "Internal_Reference") + Et.SubElement(internal_reference, "lid_reference").text = self.target_lid + Et.SubElement(internal_reference, "reference_type").text = "data_to_target" + + return reference_list + def get_fgdc(self): """Utility function to get fgdc metadata xml.