IN-CORE / incore-services

IN-CORE Web Services is a component of IN-CORE. IN-CORE uses a service oriented architecture with a REST API for communicating with the different services.
Mozilla Public License 2.0
5 stars 1 forks source link

295 semantics with dfr3 curves and mapping #297

Open longshuicy opened 3 months ago

longshuicy commented 3 months ago

This PR:

Note that fragility curve parameters have special case of period and num_stories do not need to be a part of the columns; hence excluded in the SemanticsConstants.RESERVED_COLUMNS. There are special logic on pyincore to compute those two fields.


To test:

{
    "name": "Hazus flood fragilities for electric power system",
    "hazardType": "flood",
    "inventoryType": "eletric_facility",
    "dataType":["incore:epfVer2"],
    "mappings": [
        {
            "legacyEntry": {},
            "entry": {
                "Lumberton Flood Electric Power Fragility ID Code": "63641a6c297f7611014c225c"
            },
            "rules": {
                "AND": [
                    "java.lang.String utilfcltyc EQUALS 'ESSL'"
                ]
            }
        },
        {
            "legacyEntry": {},
            "entry": {
                "Lumberton Flood Electric Power Fragility ID Code": "63641a6c297f7611014c225c"
            },
            "rules": {
                "AND": [
                    "java.lang.String utilfcltyc EQUALS 'ESSM'"
                ]
            }
        },
        {
            "legacyEntry": {},
            "entry": {
                "Lumberton Flood Electric Power Fragility ID Code": "63641a6c297f7611014c225c"
            },
            "rules": {
                "AND": [
                    "java.lang.String utilfcltyc EQUALS 'ESSH'"
                ]
            }
        },
        {
            "legacyEntry": {},
            "entry": {
                "Lumberton Flood Electric Power Fragility ID Code": "63641ad0297f7611014c225d"
            },
            "rules": {
                "AND": [
                    "java.lang.String utilfcltyc EQUALS 'EDFLT'"
                ]
            }
        },
        {
            "legacyEntry": {},
            "entry": {
                "Lumberton Flood Electric Power Fragility ID Code": "63641b64297f7611014c225f"
            },
            "rules": {
                "AND": [
                    "java.lang.String utilfcltyc EQUALS 'EPPL'"
                ]
            }
        },
        {
            "legacyEntry": {},
            "entry": {
                "Lumberton Flood Electric Power Fragility ID Code": "63641b64297f7611014c225f"
            },
            "rules": {
                "AND": [
                    "java.lang.String utilfcltyc EQUALS 'EPPM'"
                ]
            }
        },
        {
            "legacyEntry": {},
            "entry": {
                "Lumberton Flood Electric Power Fragility ID Code": "63641b64297f7611014c225f"
            },
            "rules": {
                "AND": [
                    "java.lang.String utilfcltyc EQUALS 'EPPS'"
                ]
            }
        }
    ],
    "creator": "cwang138",
    "owner": "cwang138",
    "mappingEntryKeys": null,
    "spaces": [
        "cwang138",
        "incore"
    ],
    "mappingType": "fragility"
}
  1. Post above mapping should pass ✓
  2. Change dataType to ["ergo:bridgesVer3", "incore:epfVer2"] should also pass ✓
  3. Remove dataType should error out ✗
  4. Change dataType to [ergo:bridgesVer3] should fail ✗
  5. Update one of the fragility ID to 606221fe618178207f6608a1 should fail ✗
longshuicy commented 2 months ago

Need to update this PR:

  1. Remove the checks on Fragilities/Restoration/ Recoveries
  2. Change the dataType on mapping to array to allow multiple versions
  3. Mapping also need to check each fragility curves its using; check parameters in fragilities also present in the datatype