예제 #1
0
    def migrate_interpreted_genome_rd_to_v6(
            json_dict,
            assembly=None,
            interpretation_request_version=None,
            panel_source='panelapp'):
        """
        :type json_dict: dict
        :type assembly: Assembly
        :type interpretation_request_version: int
        :type panel_source: str
        :rtype: InterpretedGenome_6_0_0
        """
        types = [
            InterpretedGenome_6_0_0, InterpretedGenomeRD_5_0_0,
            InterpretedGenomeRD_4_0_0, InterpretedGenomeRD_3_0_0,
            InterpretedGenomeRD_2_1_0
        ]
        migrations = [
            lambda x: x, lambda x: MigrateReports500To600(
            ).migrate_interpreted_genome_rd(x, panel_source=panel_source),
            lambda x: MigrateReports400To500().migrate_interpreted_genome_rd(
                x,
                assembly=assembly,
                interpretation_request_version=interpretation_request_version),
            MigrateReports3To4().migrate_interpreted_genome_rd,
            Migration21To3().migrate_interpreted_genome
        ]

        return MigrationHelpers.migrate(json_dict, types, migrations)
예제 #2
0
    def migrate_interpretation_request_rd_to_interpreted_genome_v6(
            json_dict, assembly):
        """
        :type json_dict: dict
        :type assembly: Assembly
        :rtype: InterpretedGenomeRD_6_0_0
        """
        types = [
            InterpretationRequestRD_6_0_0, InterpretationRequestRD_5_0_0,
            InterpretationRequestRD_4_0_0, InterpretationRequestRD_3_0_0,
            InterpretationRequestRD_2_1_0
        ]
        migrations = [
            lambda x: x,
            MigrateReports500To600().migrate_interpreted_genome_rd,
            lambda x: MigrateReports400To500(
            ).migrate_interpretation_request_rd_to_interpreted_genome_rd(
                old_instance=x,
                assembly=assembly,
                interpretation_service="tiering",
                reference_database_versions={},
                software_versions={}),
            MigrateReports3To4().migrate_interpretation_request_rd,
            Migration21To3().migrate_interpretation_request
        ]

        return MigrationHelpers.migrate(json_dict, types, migrations)
예제 #3
0
    def test_migrate_clinical_report_rd(self):
        """Also tested with real data"""
        old_instance = GenericFactoryAvro.get_factory_avro(
            self.old_model.ClinicalReportRD, VERSION_210, fill_nullables=False
        ).create()  # reports_3_0_0.InterpretationRequestRD
        self._validate(old_instance)
        migrated_instance = Migration21To3().migrate_clinical_report(
            old_instance)
        self._validate(migrated_instance)

        old_instance = GenericFactoryAvro.get_factory_avro(
            self.old_model.ClinicalReportRD, VERSION_210, fill_nullables=True
        ).create()  # reports_3_0_0.InterpretationRequestRD
        self._validate(old_instance)
        migrated_instance = Migration21To3().migrate_clinical_report(
            old_instance)
        self._validate(migrated_instance)
예제 #4
0
    def migrate_clinical_report_rd_to_v6(json_dict, assembly=None):
        """
        :type json_dict: dict
        :type assembly: Assembly
        :rtype: ClinicalReportRD_6_0_0
        """
        types = [
            ClinicalReport_6_0_0, ClinicalReportRD_5_0_0,
            ClinicalReportRD_4_0_0, ClinicalReportRD_3_0_0,
            ClinicalReportRD_2_1_0
        ]
        migrations = [
            lambda x: x,
            MigrateReports500To600().migrate_clinical_report_rd,
            lambda x: MigrateReports400To500().migrate_clinical_report_rd(
                old_instance=x, assembly=assembly),
            MigrateReports3To4().migrate_clinical_report_rd,
            Migration21To3().migrate_clinical_report
        ]

        return MigrationHelpers.migrate(json_dict, types, migrations)
예제 #5
0
 def migrate_interpretation_request_rd_to_v6(json_dict, assembly=None):
     """
     :type json_dict: dict
     :type assembly: Assembly
     :rtype: InterpretationRequestRD_6_0_0
     """
     types = [
         InterpretationRequestRD_6_0_0,
         InterpretationRequestRD_5_0_0,
         InterpretationRequestRD_4_0_0,
         InterpretationRequestRD_3_0_0,
         InterpretationRequestRD_2_1_0
     ]
     migrations = [
         MigrationHelpers.set_version_to_6_0_0,  # needed because 5 is valid as 6
         MigrateReports500To600().migrate_interpretation_request_rd,
         lambda x: MigrateReports400To500().migrate_interpretation_request_rd(old_instance=x, assembly=assembly),
         MigrateReports3To4().migrate_interpretation_request_rd,
         Migration21To3().migrate_interpretation_request
     ]
     return MigrationHelpers.migrate(json_dict, types, migrations)