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.
Introducing new field "dataType" to MappingSet to indicate which data types those should be compatible with
Add checks when POST mapping set following below steps:
Get listed dataType
Fetch Semantics definition for given dataType and extract all the unique columns
Parse Mapping rules (recursively if hashmap) to see if it is exist in the columns
Gather all the DFR3 curves belong to this mapping and get all the curve parameters; Check if curve parameters exist in the columns
If both mapping rule and DFR3 curve parameter check passed, allow posting to proceed; if not, through "bad request" error
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"
}
Post above mapping should pass ✓
Change dataType to ["ergo:bridgesVer3", "incore:epfVer2"] should also pass ✓
Remove dataType should error out ✗
Change dataType to [ergo:bridgesVer3] should fail ✗
Update one of the fragility ID to 606221fe618178207f6608a1 should fail ✗
This PR:
Note that fragility curve parameters have special case of
period
andnum_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:
dataType
to["ergo:bridgesVer3", "incore:epfVer2"]
should also pass ✓dataType
should error out ✗ergo:bridgesVer3
] should fail ✗606221fe618178207f6608a1
should fail ✗