Repository: IN-CORE/pyincore (language: python)

Issue:
update repair and restoration calculations to use expression based curves
Once the repair curves in database are migrated to new expression based format, we must update the calculation so it evaluates the expression instead of performing own calculation based on current alpha and beta values

Links to service change: https://github.com/IN-CORE/incore-services/pull/48


Discussion / hints:

Fix patch:
diff --git a/pyincore/__init__.py b/pyincore/__init__.py
index d4303cf68..8d6e5c24f 100644
--- a/pyincore/__init__.py
+++ b/pyincore/__init__.py
@@ -24,7 +24,7 @@
 from pyincore.utils.cgeoutputprocess import CGEOutputProcess
 from pyincore.dataset import Dataset, InventoryDataset, DamageRatioDataset
 from pyincore.models.fragilitycurveset import FragilityCurveSet
-from pyincore.models.fragilitycurve import FragilityCurve
+from pyincore.models.dfr3curve import DFR3Curve
 from pyincore.models.mappingset import MappingSet
 from pyincore.models.mapping import Mapping
 from pyincore.networkdata import NetworkData
diff --git a/pyincore/analyses/bridgedamage/bridgedamage.py b/pyincore/analyses/bridgedamage/bridgedamage.py
index 65249803f..5d9d86501 100644
--- a/pyincore/analyses/bridgedamage/bridgedamage.py
+++ b/pyincore/analyses/bridgedamage/bridgedamage.py
@@ -13,7 +13,7 @@
 from pyincore import AnalysisUtil, GeoUtil
 from pyincore import BaseAnalysis, HazardService, FragilityService
 from pyincore.analyses.bridgedamage.bridgeutil import BridgeUtil
-from pyincore.models.fragilitycurve import FragilityCurve
+from pyincore.models.dfr3curve import DFR3Curve
 
 
 class BridgeDamage(BaseAnalysis):
@@ -175,7 +175,7 @@ def bridge_damage_analysis_bulk_input(self, bridges, hazard_type,
             dmg_intervals = dict()
             selected_fragility_set = fragility_set[bridge["id"]]
 
-            if isinstance(selected_fragility_set.fragility_curves[0], FragilityCurve):
+            if isinstance(selected_fragility_set.fragility_curves[0], DFR3Curve):
                 # Supports multiple demand types in same fragility
                 hazard_val = AnalysisUtil.update_precision_of_lists(hazard_vals[i]["hazardValues"])
                 input_demand_types = hazard_vals[i]["demands"]
diff --git a/pyincore/analyses/buildingdamage/buildingdamage.py b/pyincore/analyses/buildingdamage/buildingdamage.py
index 99751bb35..67847dfb4 100755
--- a/pyincore/analyses/buildingdamage/buildingdamage.py
+++ b/pyincore/analyses/buildingdamage/buildingdamage.py
@@ -11,7 +11,7 @@
 from pyincore import BaseAnalysis, HazardService, \
     FragilityService, AnalysisUtil, GeoUtil
 from pyincore.analyses.buildingdamage.buildingutil import BuildingUtil
-from pyincore.models.fragilitycurve import FragilityCurve
+from pyincore.models.dfr3curve import DFR3Curve
 
 
 class BuildingDamage(BaseAnalysis):
@@ -171,7 +171,7 @@ def building_damage_analysis_bulk_input(self, buildings, retrofit_strategy, haza
             selected_fragility_set = fragility_sets[b_id]
 
             # TODO: Once all fragilities are migrated to new format, we can remove this condition
-            if isinstance(selected_fragility_set.fragility_curves[0], FragilityCurve):
+            if isinstance(selected_fragility_set.fragility_curves[0], DFR3Curve):
                 # Supports multiple demand types in same fragility
                 b_haz_vals = AnalysisUtil.update_precision_of_lists(hazard_vals[i]["hazardValues"])
                 b_demands = hazard_vals[i]["demands"]
@@ -190,7 +190,7 @@ def building_damage_analysis_bulk_input(self, buildings, retrofit_strategy, haza
                     building_args = selected_fragility_set.construct_expression_args_from_inventory(b)
 
                     building_period = selected_fragility_set.fragility_curves[0].get_building_period(
-                        selected_fragility_set.fragility_curve_parameters, **building_args)
+                        selected_fragility_set.curve_parameters, **building_args)
 
                     dmg_probability = selected_fragility_set.calculate_limit_state(
                         hval_dict, **building_args, period=building_period)
diff --git a/pyincore/analyses/epfdamage/epfdamage.py b/pyincore/analyses/epfdamage/epfdamage.py
index f1d8dd5bd..9f757edf6 100644
--- a/pyincore/analyses/epfdamage/epfdamage.py
+++ b/pyincore/analyses/epfdamage/epfdamage.py
@@ -9,7 +9,7 @@
 
 from pyincore import AnalysisUtil, GeoUtil
 from pyincore import BaseAnalysis, HazardService, FragilityService
-from pyincore.models.fragilitycurve import FragilityCurve
+from pyincore.models.dfr3curve import DFR3Curve
 
 
 class EpfDamage(BaseAnalysis):
@@ -199,7 +199,7 @@ def epf_damage_analysis_bulk_input(self, epfs, hazard_type, hazard_dataset_id):
             damage_result = dict()
             selected_fragility_set = fragility_set[epf["id"]]
 
-            if isinstance(selected_fragility_set.fragility_curves[0], FragilityCurve):
+            if isinstance(selected_fragility_set.fragility_curves[0], DFR3Curve):
                 hazard_val = AnalysisUtil.update_precision_of_lists(hazard_vals[i]["hazardValues"])
                 input_demand_types = hazard_vals[i]["demands"]
                 input_demand_units = hazard_vals[i]["units"]
@@ -218,7 +218,7 @@ def epf_damage_analysis_bulk_input(self, epfs, hazard_type, hazard_dataset_id):
                 if liquefaction_resp is not None:
                     fragility_set_liq = fragility_sets_liq[epf["id"]]
 
-                    if isinstance(fragility_set_liq.fragility_curves[0], FragilityCurve):
+                    if isinstance(fragility_set_liq.fragility_curves[0], DFR3Curve):
                         liq_hazard_vals = AnalysisUtil.update_precision_of_lists(liquefaction_resp[i]["pgdValues"])
                         liq_demand_types = liquefaction_resp[i]["demands"]
                         liq_demand_units = liquefaction_resp[i]["units"]
diff --git a/pyincore/analyses/nonstructbuildingdamage/nonstructbuildingdamage.py b/pyincore/analyses/nonstructbuildingdamage/nonstructbuildingdamage.py
index beef894fc..d7566dc9d 100644
--- a/pyincore/analyses/nonstructbuildingdamage/nonstructbuildingdamage.py
+++ b/pyincore/analyses/nonstructbuildingdamage/nonstructbuildingdamage.py
@@ -10,7 +10,7 @@
 from pyincore import BaseAnalysis, HazardService, FragilityService
 from pyincore.analyses.nonstructbuildingdamage.nonstructbuildingutil import \
     NonStructBuildingUtil
-from pyincore.models.fragilitycurve import FragilityCurve
+from pyincore.models.dfr3curve import DFR3Curve
 
 
 class NonStructBuildingDamage(BaseAnalysis):
@@ -203,7 +203,7 @@ def building_damage_analysis_bulk_input(self, buildings):
 
             ###############
             # AS
-            if isinstance(fragility_set_as.fragility_curves[0], FragilityCurve):
+            if isinstance(fragility_set_as.fragility_curves[0], DFR3Curve):
                 hazard_vals_as = AnalysisUtil.update_precision_of_lists(hazard_resp_as[i]["hazardValues"])
                 demand_types_as = hazard_resp_as[i]["demands"]
                 demand_units_as = hazard_resp_as[i]["units"]
@@ -232,7 +232,7 @@ def building_damage_analysis_bulk_input(self, buildings):
 
             ###############
             # DS
-            if isinstance(fragility_set_ds.fragility_curves[0], FragilityCurve):
+            if isinstance(fragility_set_ds.fragility_curves[0], DFR3Curve):
                 hazard_vals_ds = AnalysisUtil.update_precision_of_lists(hazard_resp_ds[i]["hazardValues"])
                 demand_types_ds = hazard_resp_ds[i]["demands"]
                 demand_units_ds = hazard_resp_ds[i]["units"]
diff --git a/pyincore/analyses/pipelinedamage/pipelinedamage.py b/pyincore/analyses/pipelinedamage/pipelinedamage.py
index 751eb221c..803d936c4 100644
--- a/pyincore/analyses/pipelinedamage/pipelinedamage.py
+++ b/pyincore/analyses/pipelinedamage/pipelinedamage.py
@@ -12,7 +12,7 @@
 
 from pyincore import BaseAnalysis, HazardService, FragilityService, \
     FragilityCurveSet, AnalysisUtil, GeoUtil
-from pyincore.models.fragilitycurve import FragilityCurve
+from pyincore.models.dfr3curve import DFR3Curve
 
 
 class PipelineDamage(BaseAnalysis):
@@ -162,7 +162,7 @@ def pipeline_damage_analysis_bulk_input(self, pipelines, hazard_type,
             fragility_set = fragility_sets[pipeline["id"]]
 
             # TODO: Once all fragilities are migrated to new format, we can remove this condition
-            if isinstance(fragility_set.fragility_curves[0], FragilityCurve):
+            if isinstance(fragility_set.fragility_curves[0], DFR3Curve):
                 # Supports multiple demand types in same fragility
                 haz_vals = AnalysisUtil.update_precision_of_lists(hazard_vals[i]["hazardValues"])
                 demand_types = hazard_vals[i]["demands"]
diff --git a/pyincore/analyses/pipelinedamagerepairrate/pipelinedamagerepairrate.py b/pyincore/analyses/pipelinedamagerepairrate/pipelinedamagerepairrate.py
index a8ac64d75..38cfef43a 100644
--- a/pyincore/analyses/pipelinedamagerepairrate/pipelinedamagerepairrate.py
+++ b/pyincore/analyses/pipelinedamagerepairrate/pipelinedamagerepairrate.py
@@ -18,7 +18,7 @@
     AnalysisUtil, GeoUtil
 from pyincore.analyses.pipelinedamagerepairrate.pipelineutil import \
     PipelineUtil
-from pyincore.models.fragilitycurve import FragilityCurve
+from pyincore.models.dfr3curve import DFR3Curve
 
 
 class PipelineDamageRepairRate(BaseAnalysis):
@@ -226,7 +226,7 @@ def pipeline_damage_analysis_bulk_input(self, pipelines, hazard_type,
             fragility_curve = fragility_set.fragility_curves[0]
 
             # TODO: Once all fragilities are migrated to new format, we can remove this condition
-            if isinstance(fragility_set.fragility_curves[0], FragilityCurve):
+            if isinstance(fragility_set.fragility_curves[0], DFR3Curve):
                 hazard_vals = AnalysisUtil.update_precision_of_lists(hazard_resp[i]["hazardValues"])
                 demand_types = hazard_resp[i]["demands"]
                 demand_units = hazard_resp[i]["units"]
@@ -239,7 +239,7 @@ def pipeline_damage_analysis_bulk_input(self, pipelines, hazard_type,
                     pipeline_args = fragility_set.construct_expression_args_from_inventory(pipeline)
                     pgv_repairs = \
                         fragility_curve.calculate_limit_state_probability(
-                            hval_dict, fragility_set.fragility_curve_parameters, **pipeline_args)
+                            hval_dict, fragility_set.curve_parameters, **pipeline_args)
                     # Convert PGV repairs to SI units
                     pgv_repairs = PipelineUtil.convert_result_unit(fragility_curve.return_type["unit"], pgv_repairs)
 
@@ -254,7 +254,7 @@ def pipeline_damage_analysis_bulk_input(self, pipelines, hazard_type,
                         liq_fragility_curve = fragility_set_liq.fragility_curves[0]
 
                         # TODO: Once all fragilities are migrated to new format, we can remove this condition
-                        if isinstance(fragility_set_liq.fragility_curves[0], FragilityCurve):
+                        if isinstance(fragility_set_liq.fragility_curves[0], DFR3Curve):
                             liq_hazard_vals = AnalysisUtil.update_precision_of_lists(liquefaction_resp[i]["pgdValues"])
                             liq_demand_types = liquefaction_resp[i]["demands"]
                             liq_demand_units = liquefaction_resp[i]["units"]
@@ -268,7 +268,7 @@ def pipeline_damage_analysis_bulk_input(self, pipelines, hazard_type,
                             pipeline_args = fragility_set_liq.construct_expression_args_from_inventory(pipeline)
                             pgd_repairs = \
                                 liq_fragility_curve.calculate_limit_state_probability(
-                                    liq_hval_dict, fragility_set_liq.fragility_curve_parameters, **pipeline_args)
+                                    liq_hval_dict, fragility_set_liq.curve_parameters, **pipeline_args)
                             # Convert PGD repairs to SI units
                             pgd_repairs = PipelineUtil.convert_result_unit(liq_fragility_curve.return_type["unit"],
                                                                            pgd_repairs)
diff --git a/pyincore/analyses/roaddamage/roaddamage.py b/pyincore/analyses/roaddamage/roaddamage.py
index 4cbd3b59a..f678583a3 100644
--- a/pyincore/analyses/roaddamage/roaddamage.py
+++ b/pyincore/analyses/roaddamage/roaddamage.py
@@ -9,7 +9,7 @@
 from itertools import repeat
 
 from pyincore import BaseAnalysis, HazardService, FragilityService, AnalysisUtil, GeoUtil
-from pyincore.models.fragilitycurve import FragilityCurve
+from pyincore.models.dfr3curve import DFR3Curve
 
 
 class RoadDamage(BaseAnalysis):
@@ -191,7 +191,7 @@ def road_damage_analysis_bulk_input(self, roads, hazard_type, hazard_dataset_id,
             if use_hazard_uncertainty:
                 raise ValueError("Uncertainty Not Implemented Yet.")
 
-            if isinstance(selected_fragility_set.fragility_curves[0], FragilityCurve):
+            if isinstance(selected_fragility_set.fragility_curves[0], DFR3Curve):
                 hazard_vals = AnalysisUtil.update_precision_of_lists(hazard_resp[i]["hazardValues"])
                 demand_types = hazard_resp[i]["demands"]
                 demand_units = hazard_resp[i]["units"]
diff --git a/pyincore/analyses/tornadoepndamage/tornadoepndamage.py b/pyincore/analyses/tornadoepndamage/tornadoepndamage.py
index 4df1a7296..2c40deb3f 100644
--- a/pyincore/analyses/tornadoepndamage/tornadoepndamage.py
+++ b/pyincore/analyses/tornadoepndamage/tornadoepndamage.py
@@ -15,7 +15,7 @@
 
 from pyincore import BaseAnalysis, HazardService, FragilityService, DataService, FragilityCurveSet
 from pyincore import GeoUtil, NetworkUtil
-from pyincore.models.fragilitycurve import FragilityCurve
+from pyincore.models.dfr3curve import DFR3Curve
 
 
 class TornadoEpnDamage(BaseAnalysis):
@@ -305,7 +305,7 @@ def get_damage(self, node_dataset, link_dataset, tornado_dataset, tornado_id):
                                         hval_dict[d] = tor_hazard_values[j]
                                         j += 1
                                     if isinstance(fragility_set_used.fragility_curves[0],
-                                                  FragilityCurve):
+                                                  DFR3Curve):
                                         inventory_args = fragility_set_used.construct_expression_args_from_inventory(
                                             tornado_feature)
                                         resistivity_probability = \
diff --git a/pyincore/analyses/waterfacilitydamage/waterfacilitydamage.py b/pyincore/analyses/waterfacilitydamage/waterfacilitydamage.py
index 4c0b7b9cb..f83cf5df0 100644
--- a/pyincore/analyses/waterfacilitydamage/waterfacilitydamage.py
+++ b/pyincore/analyses/waterfacilitydamage/waterfacilitydamage.py
@@ -14,7 +14,7 @@
 
 from pyincore import BaseAnalysis, HazardService, FragilityService, GeoUtil, \
     AnalysisUtil
-from pyincore.models.fragilitycurve import FragilityCurve
+from pyincore.models.dfr3curve import DFR3Curve
 
 
 class WaterFacilityDamage(BaseAnalysis):
@@ -241,7 +241,7 @@ def waterfacilityset_damage_analysis_bulk_input(self, facilities, hazard_type,
             if uncertainty:
                 hazard_std_dev = random.random()
 
-            if isinstance(fragility_set.fragility_curves[0], FragilityCurve):
+            if isinstance(fragility_set.fragility_curves[0], DFR3Curve):
                 hazard_vals = AnalysisUtil.update_precision_of_lists(hazard_resp[i]["hazardValues"])
                 demand_types = hazard_resp[i]["demands"]
                 demand_units = hazard_resp[i]["units"]
@@ -262,7 +262,7 @@ def waterfacilityset_damage_analysis_bulk_input(self, facilities, hazard_type,
                     if liquefaction_resp is not None:
                         fragility_set_liq = fragility_sets_liq[facility["id"]]
 
-                        if isinstance(fragility_set_liq.fragility_curves[0], FragilityCurve):
+                        if isinstance(fragility_set_liq.fragility_curves[0], DFR3Curve):
                             liq_hazard_vals = AnalysisUtil.update_precision_of_lists(liquefaction_resp[i]["pgdValues"])
                             liq_demand_types = liquefaction_resp[i]["demands"]
                             liq_demand_units = liquefaction_resp[i]["units"]
diff --git a/pyincore/models/fragilitycurve.py b/pyincore/models/dfr3curve.py
similarity index 91%
rename from pyincore/models/fragilitycurve.py
rename to pyincore/models/dfr3curve.py
index c71988e4e..9e045d84e 100644
--- a/pyincore/models/fragilitycurve.py
+++ b/pyincore/models/dfr3curve.py
@@ -13,8 +13,8 @@
 logger = pyglobals.LOGGER
 
 
-class FragilityCurve(ABC):
-    """A class to represent conditional standard fragility curve."""
+class DFR3Curve:
+    """A class to represent a DFR3 curve."""
 
     def __init__(self, curve_parameters):
         self.rules = curve_parameters['rules']
@@ -24,12 +24,12 @@ def __init__(self, curve_parameters):
             rule["expression"] = rule["expression"].replace("^", "**")
         self.description = curve_parameters['description']
 
-    def calculate_limit_state_probability(self, hazard_values: dict, fragility_curve_parameters: dict, **kwargs):
+    def calculate_limit_state_probability(self, hazard_values: dict, curve_parameters: dict, **kwargs):
         """Computes limit state probabilities.
 
         Args:
             hazard_values (dict): Hazard values.
-            fragility_curve_parameters (dict): Fragility curve parameters.
+            curve_parameters (dict): Fragility curve parameters.
             **kwargs: Keyword arguments.
 
         Returns:
@@ -42,7 +42,7 @@ def calculate_limit_state_probability(self, hazard_values: dict, fragility_curve
         # 1. Figure out if parameter name needs to be mapped (i.e. the name contains forbidden characters)
         # 2. Fetch all parameters listed in the curve from kwargs and if there are not in kwargs, use default values
         # from the curve.
-        for parameter in fragility_curve_parameters:
+        for parameter in curve_parameters:
             # if default exists, use default
             if "expression" in parameter and parameter["expression"] is not None:
                 parameters[parameter["name"]] = evaluateexpression.evaluate(parameter["expression"], parameters)
@@ -101,12 +101,12 @@ def calculate_limit_state_probability(self, hazard_values: dict, fragility_curve
 
         return probability
 
-    def get_building_period(self, fragility_curve_parameters, **kwargs):
+    def get_building_period(self, curve_parameters, **kwargs):
         """
                 Get building period from the fragility curve.
 
         Args:
-            fragility_curve_parameters (dict): Fragility curve parameters.
+            curve_parameters (dict): Fragility curve parameters.
             **kwargs: Keyword arguments.
 
         Returns:
@@ -116,7 +116,7 @@ def get_building_period(self, fragility_curve_parameters, **kwargs):
 
         period = 0.0
         num_stories = 1.0
-        for parameter in fragility_curve_parameters:
+        for parameter in curve_parameters:
             # if default exists, use default
             if parameter["name"] == "num_stories" and "expression" in parameter and parameter["expression"] is not None:
                 num_stories = evaluateexpression.evaluate(parameter["expression"])
diff --git a/pyincore/models/fragilitycurveset.py b/pyincore/models/fragilitycurveset.py
index 0ed88d5ba..793a722d1 100644
--- a/pyincore/models/fragilitycurveset.py
+++ b/pyincore/models/fragilitycurveset.py
@@ -6,7 +6,7 @@
 
 import json
 
-from pyincore.models.fragilitycurve import FragilityCurve
+from pyincore.models.dfr3curve import DFR3Curve
 from pyincore.utils.analysisutil import AnalysisUtil
 
 
@@ -34,21 +34,17 @@ def __init__(self, metadata):
         self.result_unit = metadata["resultUnit"] if "resultUnit" in metadata else ""
         self.hazard_type = metadata['hazardType']
         self.inventory_type = metadata['inventoryType']
-        self.fragility_curve_parameters = {}
+        self.curve_parameters = {}
         self.fragility_curves = []
 
-        if 'fragilityCurveParameters' in metadata.keys():
-            self.fragility_curve_parameters = metadata["fragilityCurveParameters"]
+        if 'curveParameters' in metadata.keys():
+            self.curve_parameters = metadata["curveParameters"]
 
         if 'fragilityCurves' in metadata.keys():
             for fragility_curve in metadata["fragilityCurves"]:
-                self.fragility_curves.append(FragilityCurve(fragility_curve))
-        elif 'repairCurves' in metadata.keys():
-            self.repairCurves = metadata['repairCurves']
-        elif 'restorationCurves' in metadata.keys():
-            self.restorationCurves = metadata['restorationCurves']
+                self.fragility_curves.append(DFR3Curve(fragility_curve))
         else:
-            raise ValueError("Cannot create dfr3 curve object. Missing key field.")
+            raise ValueError("Cannot create dfr3 curve object. Missing key field: fragilityCurves.")
 
     @classmethod
     def from_json_str(cls, json_str):
@@ -100,7 +96,7 @@ def calculate_limit_state(self, hazard_values: dict = {},
         if len(self.fragility_curves) <= 4:
             for fragility_curve in self.fragility_curves:
                 probability = fragility_curve.calculate_limit_state_probability(hazard_values,
-                                                                                self.fragility_curve_parameters,
+                                                                                self.curve_parameters,
                                                                                 **kwargs)
                 output[limit_state[index]] = AnalysisUtil.update_precision(probability)  # round to default digits
                 index += 1
@@ -224,7 +220,7 @@ def construct_expression_args_from_inventory(self, inventory_unit: dict):
 
         """
         kwargs_dict = {}
-        for parameters in self.fragility_curve_parameters:
+        for parameters in self.curve_parameters:
 
             if parameters['name'] == "age_group" and ('age_group' not in inventory_unit['properties'] or \
                                                       inventory_unit['properties']['age_group'] == ""):
diff --git a/pyincore/utils/analysisutil.py b/pyincore/utils/analysisutil.py
index 53154a061..0ea131f1d 100644
--- a/pyincore/utils/analysisutil.py
+++ b/pyincore/utils/analysisutil.py
@@ -380,7 +380,7 @@ def get_hazard_demand_type(building, fragility_set, hazard_type):
 
             building_args = fragility_set.construct_expression_args_from_inventory(building)
             building_period = fragility_set.fragility_curves[0].get_building_period(
-                fragility_set.fragility_curve_parameters, **building_args)
+                fragility_set.curve_parameters, **building_args)
 
             if fragility_hazard_type.endswith('sa') and fragility_hazard_type != 'sa':
                 # This fixes a bug where demand type is in a format similar to 1.0 Sec Sa
@@ -444,7 +444,7 @@ def get_hazard_demand_types(building, fragility_set, hazard_type):
                 # Get building period from the fragility if possible
                 building_args = fragility_set.construct_expression_args_from_inventory(building)
                 building_period = fragility_set.fragility_curves[0].get_building_period(
-                    fragility_set.fragility_curve_parameters, **building_args)
+                    fragility_set.curve_parameters, **building_args)
 
                 # TODO: There might be a bug here as this is not handling SD
                 if demand_type.endswith('sa'):
@@ -460,7 +460,7 @@ def get_hazard_demand_types(building, fragility_set, hazard_type):
                                 building_period = building[PROPERTIES][BLDG_PERIOD]
                             else:
                                 # try to calculate the period from the expression
-                                for param in fragility_set.fragility_curve_parameters:
+                                for param in fragility_set.curve_parameters:
                                     if param["name"].lower() == "period":
                                         # TODO: This is a hack and expects a parameter with name "period" present.
                                         #  This can potentially cause naming conflicts in some fragilities


Test patch:
diff --git a/tests/data/refactored_fragility_curve.json b/tests/data/fragility_curve.json
similarity index 95%
rename from tests/data/refactored_fragility_curve.json
rename to tests/data/fragility_curve.json
index f227f80c1..73dce7cac 100644
--- a/tests/data/refactored_fragility_curve.json
+++ b/tests/data/fragility_curve.json
@@ -19,7 +19,6 @@
   ],
   "fragilityCurves": [
     {
-      "className": "FragilityCurveRefactored",
       "description": "new schema proposed for parametric fragility curves",
       "rules": [
         {
@@ -40,10 +39,10 @@
         "unit": "",
         "description": "NA"
       },
-      "fragilityCurveParameters": null
+      "curveParameters": null
     }
   ],
-  "fragilityCurveParameters": [
+  "curveParameters": [
     {
       "name": "surgeLevel",
       "unit": "m",
diff --git a/tests/data/fragility_curves/PeriodStandardFragilityCurve_refactored.json b/tests/data/fragility_curves/PeriodStandardFragilityCurve_refactored.json
index ce532c792..1d8d47a89 100644
--- a/tests/data/fragility_curves/PeriodStandardFragilityCurve_refactored.json
+++ b/tests/data/fragility_curves/PeriodStandardFragilityCurve_refactored.json
@@ -17,7 +17,6 @@
   "fragilityCurves": [
     {
       "description": "legacy - PeriodStandardFragilityCurve",
-      "className": "FragilityCurveRefactored",
       "returnType": {
         "type": "Limit State",
         "unit": "",
@@ -31,7 +30,6 @@
     },
     {
       "description": "legacy - PeriodStandardFragilityCurve",
-      "className": "FragilityCurveRefactored",
       "returnType": {
         "type": "Limit State",
         "unit": "",
@@ -45,7 +43,6 @@
     },
     {
       "description": "legacy - PeriodStandardFragilityCurve",
-      "className": "FragilityCurveRefactored",
       "returnType": {
         "type": "Limit State",
         "unit": "",
@@ -59,7 +56,7 @@
     }
   ],
   "creator": "incore",
-  "fragilityCurveParameters": [
+  "curveParameters": [
     {
       "name": "point_two_sec_SA",
       "fullName": "0.2 sec Sa",
@@ -78,6 +75,5 @@
       "description": "default building period",
       "expression": "1.08"
     }
-  ],
-  "id": "5b47b2d7337d4a36187c61c9"
+  ]
 }
\ No newline at end of file
diff --git a/tests/data/repairset.json b/tests/data/repairset.json
index d2873234b..54549c6d7 100644
--- a/tests/data/repairset.json
+++ b/tests/data/repairset.json
@@ -1,46 +1,81 @@
 {
-  "description": "pytest EPN sub-station earthquake repair models",
-  "authors": [
-    "HAZUS"
-  ],
-  "paperReference": null,
-  "resultUnit": null,
-  "resultType": "Limit State",
-  "timeUnits": "days",
-  "hazardType": "earthquake",
-  "inventoryType": "electric_power_facility",
-  "repairCurves": [
-    {
-      "className": "StandardRepairCurve",
-      "description": "Slight",
-      "alpha": 1,
-      "beta": 0.47,
-      "curveType": "LogNormal",
-      "alphaType": "median"
-    },
-    {
-      "className": "StandardRepairCurve",
-      "description": "Moderate",
-      "alpha": 2.7,
-      "beta": 0.47,
-      "curveType": "LogNormal",
-      "alphaType": "median"
-    },
-    {
-      "className": "StandardRepairCurve",
-      "description": "Extensive",
-      "alpha": 6.3,
-      "beta": 0.47,
-      "curveType": "LogNormal",
-      "alphaType": "median"
-    },
-    {
-      "className": "StandardRepairCurve",
-      "description": "Complete",
-      "alpha": 27,
-      "beta": 0.47,
-      "curveType": "LogNormal",
-      "alphaType": "median"
-    }
-  ]
+    "description": "test repair curves",
+    "authors": [],
+    "paperReference": null,
+    "resultUnit": null,
+    "resultType": "repair_rate",
+    "hazardType": "earthquake",
+    "inventoryType": "building",
+    "timeUnits": "weeks",
+   "repairCurves": [
+        {
+            "description": "weekly repair rate - Slight",
+            "rules": [
+                {
+                    "condition": [
+                        "True"
+                    ],
+                    "expression": "scipy.stats.lognorm.ppf(numpy.random.random(size=10), s=0.159, scale=numpy.exp(0.8196))"
+                }
+            ],
+            "returnType": {
+                "type": "Repair Rate",
+                "unit": "",
+                "description": "LS_0"
+            },
+            "curveParameters": null
+        },
+        {
+            "description": "weekly repair rate - Moderate",
+            "rules": [
+                {
+                    "condition": [
+                        "True"
+                    ],
+                    "expression": "scipy.stats.lognorm.ppf(numpy.random.random(size=10), s=10, scale=numpy.exp(0.8196))"
+                }
+            ],
+            "returnType": {
+                "type": "Repair Rate",
+                "unit": "",
+                "description": "LS_1"
+            },
+            "curveParameters": null
+        },
+        {
+            "description": "weekly repair rate - Extensive",
+            "rules": [
+                {
+                    "condition": [
+                        "True"
+                    ],
+                    "expression": "scipy.stats.lognorm.ppf(numpy.random.random(size=10), s=20, scale=numpy.exp(0.8196))"
+                }
+            ],
+            "returnType": {
+                "type": "Repair Rate",
+                "unit": "",
+                "description": "LS_2"
+            },
+            "curveParameters": null
+        },
+        {
+            "description": "weekly repair rate - Complete",
+            "rules": [
+                {
+                    "condition": [
+                        "True"
+                    ],
+                    "expression": "scipy.stats.lognorm.ppf(numpy.random.random(size=10), s=30, scale=numpy.exp(0.8196))"
+                }
+            ],
+            "returnType": {
+                "type": "Repair Rate",
+                "unit": "",
+                "description": "LS_3"
+            },
+            "curveParameters": null
+        }
+    ],
+    "curveParameters": null
 }
\ No newline at end of file
diff --git a/tests/pyincore/models/test_fragilitycurverefactored.py b/tests/pyincore/models/test_dfr3curve.py
similarity index 84%
rename from tests/pyincore/models/test_fragilitycurverefactored.py
rename to tests/pyincore/models/test_dfr3curve.py
index 39934c5fa..ef02dac04 100644
--- a/tests/pyincore/models/test_fragilitycurverefactored.py
+++ b/tests/pyincore/models/test_dfr3curve.py
@@ -9,7 +9,7 @@
 
 
 def test_fragility_set_small_overlap():
-    fragility_set = get_fragility_set("refactored_fragility_curve.json")
+    fragility_set = get_fragility_set("fragility_curve.json")
 
     # Test Case 1 - single overlap
     limit_states = collections.OrderedDict([("LS_0", 0.9692754643), ("LS_1", 0.0001444974), ("LS_2", 0.0004277083)])
@@ -44,15 +44,15 @@ def get_remote_fragility_set(fragility_id: str):
 
 
 def test_create_fragility_set():
-    fragility_set = get_fragility_set("refactored_fragility_curve.json")
+    fragility_set = get_fragility_set("fragility_curve.json")
     assert len(fragility_set.fragility_curves) != 0
 
 
 @pytest.mark.parametrize("fragility_set,hazard_values,args,expected", [
-    (get_fragility_set("refactored_fragility_curve.json"), {}, {}, 0.2619967240482869),
-    (get_fragility_set("refactored_fragility_curve.json"), {"surgeLevel": 6, "waveHeight": 4}, {}, 1.0),
-    (get_fragility_set("refactored_fragility_curve.json"), {"waveHeight": 4}, {}, 1.0),
-    (get_fragility_set("refactored_fragility_curve.json"), {"surgeLevel": 6}, {}, 0.9999999950124077),
+    (get_fragility_set("fragility_curve.json"), {}, {}, 0.2619967240482869),
+    (get_fragility_set("fragility_curve.json"), {"surgeLevel": 6, "waveHeight": 4}, {}, 1.0),
+    (get_fragility_set("fragility_curve.json"), {"waveHeight": 4}, {}, 1.0),
+    (get_fragility_set("fragility_curve.json"), {"surgeLevel": 6}, {}, 0.9999999950124077),
     (get_remote_fragility_set("606221fe618178207f6608a1"),
      {"waveHeight": 1.1111, "surgeLevel": 3},
      {"clearance": 4, "span_mass": 12, "g_elev": 0.2},
@@ -72,6 +72,7 @@ def test_create_fragility_set():
 ])
 def test_calculate_limit_state_probability(fragility_set, hazard_values, args, expected):
     result = fragility_set.calculate_limit_state(hazard_values, **args)
+    print(result)
     assert np.isclose(result["LS_0"], expected)
 
 
diff --git a/tests/pyincore/test_dfr3service.py b/tests/pyincore/test_dfr3service.py
index 829bd67b4..d600b59dc 100644
--- a/tests/pyincore/test_dfr3service.py
+++ b/tests/pyincore/test_dfr3service.py
@@ -95,7 +95,7 @@ def test_get_fragility_mapping(fragilitysvc):
 
 
 def test_create_and_delete_fragility_set(fragilitysvc):
-    with open(os.path.join(pyglobals.TEST_DATA_DIR, "refactored_fragility_curve.json"), 'r') as f:
+    with open(os.path.join(pyglobals.TEST_DATA_DIR, "fragility_curve.json"), 'r') as f:
         fragility_set = json.load(f)
     created = fragilitysvc.create_dfr3_set(fragility_set)
     assert "id" in created.keys()
@@ -134,3 +134,4 @@ def test_get_repair_sets(repairsvc):
     metadata = repairsvc.get_dfr3_sets(hazard_type="earthquake", creator="incrtest")
 
     assert 'id' in metadata[0].keys()
+