コード例 #1
0
    def _fill_dataset_db_model(self, dataset: Dataset):
        """ Fills a Dataset db record from the ISOMetadata data

        Args:
            dataset (Dataset): The old/empty object
        Returns:
             dataset (Dataset): The dataset object
        """
        dataset.language_code = self.language
        dataset.character_set_code = self.character_set_code or "utf8"
        dataset.hierarchy_level_code = self.hierarchy_level
        dataset.update_frequency_code = self.update_frequency
        dataset.update_frequency_code = self.update_frequency
        dataset.legal_restriction_code = None
        dataset.date_stamp = self.date_stamp
        dataset.metadata_standard_name = self.md_standard_name
        dataset.metadata_standard_version = self.md_standard_version
        dataset.reference_system_code = self.ref_system
        dataset.reference_system_version = self.ref_system_version
        dataset.reference_system_authority_title = self.ref_system_authority
        dataset.md_identifier_code = self.file_identifier
        dataset.distribution_function_code = self.distribution_function or "dataset"
        dataset.lineage_statement = self.lineage
        dataset.legal_restriction_other_constraints = self.access_constraints
        dataset.use_limitation = self.use_limitation

        return dataset
コード例 #2
0
    def _fill_metadata_dataset_quality_form(data: dict, metadata: Metadata, dataset: Dataset, user: MrMapUser):
        """ Fills form data into Metadata/Dataset records

        Args:
            data (dict): Cleaned form data
            metadata (dict): The metadata record
            dataset (dict): The dataset record
            user: The performing user
        Returns:

        """
        dataset.update_frequency_code = data.get("maintenance_and_update_frequency", None)
        dataset.lineage_statement = data.get("lineage_statement", None)
コード例 #3
0
 def _create_dataset_from_md_metadata(self, md_metadata: Element,
                                      metadata: Metadata) -> Dataset:
     """ Creates a Dataset record from xml data
     Args:
         md_metadata (Element): The xml element which holds the data
         metadata (Metadata): The related metadata element
     Returns:
         dataset (Dataset): The dataset record
     """
     dataset = Dataset()
     dataset.language_code = metadata.language_code
     dataset.language_code_list_url = xml_helper.try_get_attribute_from_xml_element(
         md_metadata, "codeList",
         ".//" + GENERIC_NAMESPACE_TEMPLATE.format("language") + "/" +
         GENERIC_NAMESPACE_TEMPLATE.format("LanguageCode"))
     dataset.character_set_code = xml_helper.try_get_text_from_xml_element(
         md_metadata,
         ".//" + GENERIC_NAMESPACE_TEMPLATE.format("characterSet") + "/" +
         GENERIC_NAMESPACE_TEMPLATE.format("MD_CharacterSetCode"))
     dataset.character_set_code_list_url = xml_helper.try_get_attribute_from_xml_element(
         md_metadata, "codeList",
         ".//" + GENERIC_NAMESPACE_TEMPLATE.format("characterSet") + "/" +
         GENERIC_NAMESPACE_TEMPLATE.format("MD_CharacterSetCode"))
     dataset.date_stamp = xml_helper.try_get_text_from_xml_element(
         md_metadata,
         ".//" + GENERIC_NAMESPACE_TEMPLATE.format("dateStamp") + "/" +
         GENERIC_NAMESPACE_TEMPLATE.format("Date"))
     dataset.metadata_standard_name = xml_helper.try_get_text_from_xml_element(
         md_metadata,
         ".//" + GENERIC_NAMESPACE_TEMPLATE.format("metadataStandardName") +
         "/" + GENERIC_NAMESPACE_TEMPLATE.format("CharacterString"))
     dataset.metadata_standard_version = xml_helper.try_get_text_from_xml_element(
         md_metadata, ".//" +
         GENERIC_NAMESPACE_TEMPLATE.format("metadataStandardVersion") +
         "/" + GENERIC_NAMESPACE_TEMPLATE.format("CharacterString"))
     dataset.update_frequency_code = xml_helper.try_get_text_from_xml_element(
         md_metadata, ".//" +
         GENERIC_NAMESPACE_TEMPLATE.format("MD_MaintenanceFrequencyCode"))
     dataset.update_frequency_code_list_url = xml_helper.try_get_attribute_from_xml_element(
         md_metadata, "codeList", ".//" +
         GENERIC_NAMESPACE_TEMPLATE.format("MD_MaintenanceFrequencyCode"))
     dataset.use_limitation = xml_helper.try_get_text_from_xml_element(
         md_metadata,
         ".//" + GENERIC_NAMESPACE_TEMPLATE.format("useLimitation") + "/" +
         GENERIC_NAMESPACE_TEMPLATE.format("CharacterString"))
     dataset.lineage_statement = xml_helper.try_get_text_from_xml_element(
         md_metadata,
         ".//" + GENERIC_NAMESPACE_TEMPLATE.format("statement") + "/" +
         GENERIC_NAMESPACE_TEMPLATE.format("CharacterString"))
     return dataset