add logs
This commit is contained in:
parent
7f31023f58
commit
72a5c54a61
@ -6,7 +6,7 @@ import * as fs from 'fs'
|
||||
import mappingConfigIRVE from './mappings/converters/configIRVE'
|
||||
import mappingConfigIRVE_simple from './mappings/converters/mappingConfigIRVE_simple'
|
||||
import mapping_engine from './mappings/engine'
|
||||
import MappingConfigType, {BoundingBoxCoordinatesType, FeatureCollection} from "./mappings/mapping-config.type";
|
||||
import {BoundingBoxCoordinatesType, FeatureCollection} from "./mappings/mapping-config.type";
|
||||
import utils from './mappings/utils'
|
||||
|
||||
|
||||
@ -36,6 +36,8 @@ let boundingBoxCoordinates: BoundingBoxCoordinatesType = {
|
||||
}
|
||||
|
||||
let filterCoordinates = true
|
||||
filterCoordinates = false
|
||||
|
||||
let enable_filter_on_department = true
|
||||
enable_filter_on_department = false
|
||||
|
||||
@ -79,6 +81,7 @@ let converted_geo_json: any = {
|
||||
|
||||
|
||||
let output_folder = 'output';
|
||||
|
||||
/**
|
||||
* crée un fichier dans le dossier par défaut, output
|
||||
* @param fileName
|
||||
@ -110,26 +113,32 @@ function writeFile(fileName: string, fileContent: any) {
|
||||
* @param boundingBoxCoordinates
|
||||
*/
|
||||
function convertDataForIRVE(sourceFilePath: string, mapping: any, pointCounterMax: number, boundingBoxCoordinates: any) {
|
||||
debugLog('convertDataFromChargemap from ', sourceFilePath)
|
||||
debugLog('convertDataForIRVE from ', sourceFilePath)
|
||||
|
||||
fs.readFile(sourceFilePath, 'utf8', function (err, data) {
|
||||
let point_counter = 0
|
||||
let feature_points_after_filter: any = []
|
||||
|
||||
if (err) {
|
||||
return debugLog(err)
|
||||
}
|
||||
let data_transformed: FeatureCollection = JSON.parse(data)
|
||||
// debug('data keys ', Object.keys(dataTransformed))
|
||||
// debugLog('properties of point 0', data_transformed.features[0])
|
||||
|
||||
debugLog('debug: properties of point 0', data_transformed.features[0])
|
||||
if (data_transformed.features) {
|
||||
|
||||
debugLog('data found, features:', data_transformed.features.length)
|
||||
|
||||
// find interesting list of points to use
|
||||
let list_of_points: any = data_transformed.features
|
||||
// for each point from the data source, convert with the mapping
|
||||
debugLog('listOfPoints.length', list_of_points.length)
|
||||
|
||||
console.log('listOfPoints.length', list_of_points.length)
|
||||
/**
|
||||
* filtering
|
||||
* TODO: do it in the engine
|
||||
*/
|
||||
// for each point from the data source, filter if we take it or not
|
||||
list_of_points.forEach((feature_point: any) => {
|
||||
|
||||
let regex_filter_test_result = true
|
||||
@ -141,8 +150,12 @@ function convertDataForIRVE(sourceFilePath: string, mapping: any, pointCounterMa
|
||||
||
|
||||
filterZipCodeAdresse.test(feature_point.properties.adresse_station)
|
||||
)
|
||||
} else if (filterOnBoundingBox) {
|
||||
debugLog('filtre sur les coordonnées activé')
|
||||
} else {
|
||||
debugLog('pas de filtre sur les départements')
|
||||
}
|
||||
|
||||
if (filterOnBoundingBox) {
|
||||
debugLog('filtre sur les coordonnées bounding box activé')
|
||||
|
||||
let x = feature_point.properties.coordonneesXY[0]
|
||||
let xMin = boundingBoxCoordinates.xMin
|
||||
@ -157,43 +170,63 @@ function convertDataForIRVE(sourceFilePath: string, mapping: any, pointCounterMa
|
||||
(y >= yMin && y <= yMax)
|
||||
)
|
||||
|
||||
} else {
|
||||
debugLog('pas de filtre sur les coordonnées bounding box')
|
||||
}
|
||||
|
||||
|
||||
// TODO add filter offset max
|
||||
// filter points depending on zipcode
|
||||
if (filterCoordinates && regex_filter_test_result) {
|
||||
if (regex_filter_test_result) {
|
||||
feature_points_after_filter.push(feature_point)
|
||||
debugLog(' +1 point', point_counter)
|
||||
point_counter++
|
||||
}
|
||||
|
||||
debugLog('featurePoint.properties.consolidated_code_postal', feature_point.properties.consolidated_code_postal)
|
||||
|
||||
// limit results number of points
|
||||
// if (pointcounter < pointCounterMax) {
|
||||
|
||||
debugLog('add point')
|
||||
})
|
||||
|
||||
/**
|
||||
* conversion
|
||||
*/
|
||||
debugLog(' after filtering, number of points: ', feature_points_after_filter.length)
|
||||
feature_points_after_filter.forEach((feature_point: any) => {
|
||||
// debugLog('featurePoint.properties.consolidated_code_postal', feature_point.properties.consolidated_code_postal)
|
||||
debugLog('convert : work on 1 point')
|
||||
debugLog('featurePoint', feature_point)
|
||||
|
||||
let mapped_point: any = {}
|
||||
|
||||
if (use_mappping_engine) {
|
||||
debugLog('convert :using mapping engine on feature point'
|
||||
, feature_point
|
||||
)
|
||||
mapped_point = Mapping_engine.mapElementFromConf(feature_point)
|
||||
console.log('mapped_point', mapped_point)
|
||||
} else {
|
||||
debugLog('convert :using simple converter on feature point', feature_point)
|
||||
mapped_point = mapElementFromConfSimple(feature_point, mapping)
|
||||
}
|
||||
debugLog('map one point', feature_point, mapped_point)
|
||||
// debugLog('mapped_point one point', mapped_point)
|
||||
if (mapped_point) {
|
||||
converted_geo_json.features.push(mapped_point)
|
||||
debugLog('convert : added one point to converted_geo_json')
|
||||
} else {
|
||||
debugLog('convert : !!! there is no map one point')
|
||||
}
|
||||
}
|
||||
// }
|
||||
point_counter++
|
||||
|
||||
})
|
||||
// output new geojson
|
||||
console.log('convertedGeoJson.features.length', converted_geo_json.features.length)
|
||||
|
||||
debugLog('convert : convertedGeoJson.features.length', converted_geo_json.features.length)
|
||||
// write file on disk
|
||||
if (converted_geo_json.features.length) {
|
||||
|
||||
let fileNameToWrite = 'my_converted_data_set' + filteredName + '.json'
|
||||
console.log('write file ', fileNameToWrite)
|
||||
debugLog('write file ', fileNameToWrite)
|
||||
writeFile(fileNameToWrite, JSON.stringify(converted_geo_json, null, 2))
|
||||
|
||||
} else {
|
||||
debugLog('no writing of file, because there is no converted feature')
|
||||
}
|
||||
debugLog('mapped output:', converted_geo_json.features)
|
||||
|
||||
return converted_geo_json
|
||||
@ -247,8 +280,8 @@ function mapElementFromConfSimple(featurePoint: any, mappingConfig: any) {
|
||||
}
|
||||
|
||||
if (use_mappping_engine) {
|
||||
console.log(' - using mapping engine')
|
||||
console.log(' - pointCounterMax', pointCounterMax)
|
||||
debugLog(' - using mapping engine')
|
||||
debugLog(' - pointCounterMax', pointCounterMax)
|
||||
Mapping_engine.setConfig(mappingConfigIRVE)
|
||||
convertDataForIRVE(sourceFilePathGeoJson, mappingConfigIRVE, pointCounterMax, boundingBoxCoordinates)
|
||||
|
||||
|
@ -1,6 +1,260 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<coverage generated="1691226256879" clover="3.2.0">
|
||||
<project timestamp="1691226256879" name="All files">
|
||||
<metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0" elements="0" coveredelements="0" complexity="0" loc="0" ncloc="0" packages="0" files="0" classes="0"/>
|
||||
<coverage generated="1691227045577" clover="3.2.0">
|
||||
<project timestamp="1691227045577" name="All files">
|
||||
<metrics statements="239" coveredstatements="113" conditionals="6" coveredconditionals="4" methods="9" coveredmethods="4" elements="254" coveredelements="121" complexity="0" loc="239" ncloc="239" packages="2" files="3" classes="3"/>
|
||||
<package name="data_other.testing">
|
||||
<metrics statements="34" coveredstatements="34" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
|
||||
<file name="mappings_to_test.ts" path="/home/poule/encrypted/stockage-syncable/www/development/html/scripts/mapping_geojson_to_osm_tags/data_other/testing/mappings_to_test.ts">
|
||||
<metrics statements="34" coveredstatements="34" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
|
||||
<line num="1" count="1" type="stmt"/>
|
||||
<line num="2" count="1" type="stmt"/>
|
||||
<line num="3" count="1" type="stmt"/>
|
||||
<line num="4" count="1" type="stmt"/>
|
||||
<line num="5" count="1" type="stmt"/>
|
||||
<line num="6" count="1" type="stmt"/>
|
||||
<line num="7" count="1" type="stmt"/>
|
||||
<line num="8" count="1" type="stmt"/>
|
||||
<line num="9" count="1" type="stmt"/>
|
||||
<line num="10" count="1" type="stmt"/>
|
||||
<line num="11" count="1" type="stmt"/>
|
||||
<line num="12" count="1" type="stmt"/>
|
||||
<line num="13" count="1" type="stmt"/>
|
||||
<line num="14" count="1" type="stmt"/>
|
||||
<line num="15" count="1" type="stmt"/>
|
||||
<line num="16" count="1" type="stmt"/>
|
||||
<line num="17" count="1" type="stmt"/>
|
||||
<line num="18" count="1" type="stmt"/>
|
||||
<line num="19" count="1" type="stmt"/>
|
||||
<line num="20" count="1" type="stmt"/>
|
||||
<line num="21" count="1" type="stmt"/>
|
||||
<line num="22" count="1" type="stmt"/>
|
||||
<line num="23" count="1" type="stmt"/>
|
||||
<line num="24" count="1" type="stmt"/>
|
||||
<line num="25" count="1" type="stmt"/>
|
||||
<line num="26" count="1" type="stmt"/>
|
||||
<line num="27" count="1" type="stmt"/>
|
||||
<line num="28" count="1" type="stmt"/>
|
||||
<line num="29" count="1" type="stmt"/>
|
||||
<line num="30" count="1" type="stmt"/>
|
||||
<line num="31" count="1" type="stmt"/>
|
||||
<line num="32" count="1" type="stmt"/>
|
||||
<line num="33" count="1" type="stmt"/>
|
||||
<line num="34" count="1" type="stmt"/>
|
||||
</file>
|
||||
</package>
|
||||
<package name="mappings">
|
||||
<metrics statements="205" coveredstatements="79" conditionals="6" coveredconditionals="4" methods="9" coveredmethods="4"/>
|
||||
<file name="engine.ts" path="/home/poule/encrypted/stockage-syncable/www/development/html/scripts/mapping_geojson_to_osm_tags/mappings/engine.ts">
|
||||
<metrics statements="203" coveredstatements="77" conditionals="6" coveredconditionals="4" methods="9" coveredmethods="4"/>
|
||||
<line num="1" count="1" type="stmt"/>
|
||||
<line num="2" count="1" type="stmt"/>
|
||||
<line num="3" count="1" type="stmt"/>
|
||||
<line num="4" count="1" type="stmt"/>
|
||||
<line num="5" count="1" type="stmt"/>
|
||||
<line num="6" count="1" type="stmt"/>
|
||||
<line num="7" count="1" type="stmt"/>
|
||||
<line num="8" count="1" type="stmt"/>
|
||||
<line num="9" count="1" type="stmt"/>
|
||||
<line num="10" count="1" type="stmt"/>
|
||||
<line num="11" count="1" type="stmt"/>
|
||||
<line num="12" count="1" type="stmt"/>
|
||||
<line num="13" count="1" type="stmt"/>
|
||||
<line num="14" count="1" type="stmt"/>
|
||||
<line num="15" count="1" type="stmt"/>
|
||||
<line num="16" count="1" type="cond" truecount="1" falsecount="0"/>
|
||||
<line num="17" count="1" type="stmt"/>
|
||||
<line num="18" count="1" type="stmt"/>
|
||||
<line num="19" count="1" type="cond" truecount="1" falsecount="0"/>
|
||||
<line num="20" count="1" type="stmt"/>
|
||||
<line num="21" count="1" type="stmt"/>
|
||||
<line num="22" count="1" type="stmt"/>
|
||||
<line num="23" count="1" type="cond" truecount="1" falsecount="0"/>
|
||||
<line num="24" count="1" type="stmt"/>
|
||||
<line num="25" count="1" type="stmt"/>
|
||||
<line num="26" count="1" type="stmt"/>
|
||||
<line num="27" count="1" type="stmt"/>
|
||||
<line num="28" count="0" type="stmt"/>
|
||||
<line num="29" count="0" type="stmt"/>
|
||||
<line num="30" count="0" type="stmt"/>
|
||||
<line num="31" count="0" type="stmt"/>
|
||||
<line num="32" count="0" type="stmt"/>
|
||||
<line num="33" count="0" type="stmt"/>
|
||||
<line num="34" count="0" type="stmt"/>
|
||||
<line num="35" count="0" type="stmt"/>
|
||||
<line num="36" count="0" type="stmt"/>
|
||||
<line num="37" count="0" type="stmt"/>
|
||||
<line num="38" count="0" type="stmt"/>
|
||||
<line num="39" count="0" type="stmt"/>
|
||||
<line num="40" count="0" type="stmt"/>
|
||||
<line num="41" count="0" type="stmt"/>
|
||||
<line num="42" count="1" type="stmt"/>
|
||||
<line num="43" count="1" type="stmt"/>
|
||||
<line num="44" count="1" type="stmt"/>
|
||||
<line num="45" count="1" type="stmt"/>
|
||||
<line num="46" count="1" type="stmt"/>
|
||||
<line num="47" count="1" type="stmt"/>
|
||||
<line num="48" count="1" type="stmt"/>
|
||||
<line num="49" count="0" type="stmt"/>
|
||||
<line num="50" count="0" type="stmt"/>
|
||||
<line num="51" count="0" type="stmt"/>
|
||||
<line num="52" count="1" type="stmt"/>
|
||||
<line num="53" count="1" type="stmt"/>
|
||||
<line num="54" count="1" type="stmt"/>
|
||||
<line num="55" count="1" type="stmt"/>
|
||||
<line num="56" count="1" type="stmt"/>
|
||||
<line num="57" count="1" type="stmt"/>
|
||||
<line num="58" count="1" type="stmt"/>
|
||||
<line num="59" count="1" type="stmt"/>
|
||||
<line num="60" count="1" type="stmt"/>
|
||||
<line num="61" count="1" type="stmt"/>
|
||||
<line num="62" count="0" type="stmt"/>
|
||||
<line num="63" count="0" type="stmt"/>
|
||||
<line num="64" count="0" type="stmt"/>
|
||||
<line num="65" count="0" type="stmt"/>
|
||||
<line num="66" count="1" type="stmt"/>
|
||||
<line num="67" count="1" type="stmt"/>
|
||||
<line num="68" count="1" type="stmt"/>
|
||||
<line num="69" count="1" type="stmt"/>
|
||||
<line num="70" count="1" type="stmt"/>
|
||||
<line num="71" count="1" type="stmt"/>
|
||||
<line num="72" count="1" type="stmt"/>
|
||||
<line num="73" count="1" type="stmt"/>
|
||||
<line num="74" count="1" type="stmt"/>
|
||||
<line num="75" count="0" type="stmt"/>
|
||||
<line num="76" count="0" type="stmt"/>
|
||||
<line num="77" count="0" type="stmt"/>
|
||||
<line num="78" count="0" type="stmt"/>
|
||||
<line num="79" count="0" type="stmt"/>
|
||||
<line num="80" count="1" type="stmt"/>
|
||||
<line num="81" count="1" type="stmt"/>
|
||||
<line num="82" count="1" type="stmt"/>
|
||||
<line num="83" count="1" type="stmt"/>
|
||||
<line num="84" count="1" type="cond" truecount="1" falsecount="0"/>
|
||||
<line num="85" count="1" type="cond" truecount="0" falsecount="1"/>
|
||||
<line num="86" count="0" type="stmt"/>
|
||||
<line num="87" count="0" type="stmt"/>
|
||||
<line num="88" count="1" type="stmt"/>
|
||||
<line num="89" count="1" type="stmt"/>
|
||||
<line num="90" count="1" type="stmt"/>
|
||||
<line num="91" count="1" type="stmt"/>
|
||||
<line num="92" count="1" type="stmt"/>
|
||||
<line num="93" count="1" type="stmt"/>
|
||||
<line num="94" count="1" type="stmt"/>
|
||||
<line num="95" count="1" type="stmt"/>
|
||||
<line num="96" count="1" type="stmt"/>
|
||||
<line num="97" count="1" type="stmt"/>
|
||||
<line num="98" count="1" type="stmt"/>
|
||||
<line num="99" count="1" type="stmt"/>
|
||||
<line num="100" count="1" type="stmt"/>
|
||||
<line num="101" count="1" type="cond" truecount="0" falsecount="1"/>
|
||||
<line num="102" count="0" type="stmt"/>
|
||||
<line num="103" count="0" type="stmt"/>
|
||||
<line num="104" count="0" type="stmt"/>
|
||||
<line num="105" count="0" type="stmt"/>
|
||||
<line num="106" count="0" type="stmt"/>
|
||||
<line num="107" count="0" type="stmt"/>
|
||||
<line num="108" count="0" type="stmt"/>
|
||||
<line num="109" count="0" type="stmt"/>
|
||||
<line num="110" count="0" type="stmt"/>
|
||||
<line num="111" count="0" type="stmt"/>
|
||||
<line num="112" count="0" type="stmt"/>
|
||||
<line num="113" count="0" type="stmt"/>
|
||||
<line num="114" count="0" type="stmt"/>
|
||||
<line num="115" count="0" type="stmt"/>
|
||||
<line num="116" count="0" type="stmt"/>
|
||||
<line num="117" count="0" type="stmt"/>
|
||||
<line num="118" count="0" type="stmt"/>
|
||||
<line num="119" count="1" type="stmt"/>
|
||||
<line num="120" count="1" type="stmt"/>
|
||||
<line num="121" count="0" type="stmt"/>
|
||||
<line num="122" count="0" type="stmt"/>
|
||||
<line num="123" count="0" type="stmt"/>
|
||||
<line num="124" count="0" type="stmt"/>
|
||||
<line num="125" count="0" type="stmt"/>
|
||||
<line num="126" count="0" type="stmt"/>
|
||||
<line num="127" count="0" type="stmt"/>
|
||||
<line num="128" count="0" type="stmt"/>
|
||||
<line num="129" count="0" type="stmt"/>
|
||||
<line num="130" count="0" type="stmt"/>
|
||||
<line num="131" count="0" type="stmt"/>
|
||||
<line num="132" count="0" type="stmt"/>
|
||||
<line num="133" count="0" type="stmt"/>
|
||||
<line num="134" count="0" type="stmt"/>
|
||||
<line num="135" count="0" type="stmt"/>
|
||||
<line num="136" count="0" type="stmt"/>
|
||||
<line num="137" count="0" type="stmt"/>
|
||||
<line num="138" count="0" type="stmt"/>
|
||||
<line num="139" count="0" type="stmt"/>
|
||||
<line num="140" count="0" type="stmt"/>
|
||||
<line num="141" count="0" type="stmt"/>
|
||||
<line num="142" count="0" type="stmt"/>
|
||||
<line num="143" count="0" type="stmt"/>
|
||||
<line num="144" count="0" type="stmt"/>
|
||||
<line num="145" count="0" type="stmt"/>
|
||||
<line num="146" count="0" type="stmt"/>
|
||||
<line num="147" count="0" type="stmt"/>
|
||||
<line num="148" count="0" type="stmt"/>
|
||||
<line num="149" count="0" type="stmt"/>
|
||||
<line num="150" count="0" type="stmt"/>
|
||||
<line num="151" count="0" type="stmt"/>
|
||||
<line num="152" count="0" type="stmt"/>
|
||||
<line num="153" count="0" type="stmt"/>
|
||||
<line num="154" count="0" type="stmt"/>
|
||||
<line num="155" count="0" type="stmt"/>
|
||||
<line num="156" count="0" type="stmt"/>
|
||||
<line num="157" count="0" type="stmt"/>
|
||||
<line num="158" count="0" type="stmt"/>
|
||||
<line num="159" count="0" type="stmt"/>
|
||||
<line num="160" count="0" type="stmt"/>
|
||||
<line num="161" count="0" type="stmt"/>
|
||||
<line num="162" count="0" type="stmt"/>
|
||||
<line num="163" count="0" type="stmt"/>
|
||||
<line num="164" count="0" type="stmt"/>
|
||||
<line num="165" count="0" type="stmt"/>
|
||||
<line num="166" count="0" type="stmt"/>
|
||||
<line num="167" count="0" type="stmt"/>
|
||||
<line num="168" count="0" type="stmt"/>
|
||||
<line num="169" count="0" type="stmt"/>
|
||||
<line num="170" count="0" type="stmt"/>
|
||||
<line num="171" count="0" type="stmt"/>
|
||||
<line num="172" count="0" type="stmt"/>
|
||||
<line num="173" count="0" type="stmt"/>
|
||||
<line num="174" count="0" type="stmt"/>
|
||||
<line num="175" count="0" type="stmt"/>
|
||||
<line num="176" count="0" type="stmt"/>
|
||||
<line num="177" count="0" type="stmt"/>
|
||||
<line num="178" count="0" type="stmt"/>
|
||||
<line num="179" count="0" type="stmt"/>
|
||||
<line num="180" count="0" type="stmt"/>
|
||||
<line num="181" count="0" type="stmt"/>
|
||||
<line num="182" count="0" type="stmt"/>
|
||||
<line num="183" count="0" type="stmt"/>
|
||||
<line num="184" count="0" type="stmt"/>
|
||||
<line num="185" count="0" type="stmt"/>
|
||||
<line num="186" count="0" type="stmt"/>
|
||||
<line num="187" count="0" type="stmt"/>
|
||||
<line num="188" count="0" type="stmt"/>
|
||||
<line num="189" count="0" type="stmt"/>
|
||||
<line num="190" count="0" type="stmt"/>
|
||||
<line num="191" count="0" type="stmt"/>
|
||||
<line num="192" count="0" type="stmt"/>
|
||||
<line num="193" count="0" type="stmt"/>
|
||||
<line num="194" count="0" type="stmt"/>
|
||||
<line num="195" count="0" type="stmt"/>
|
||||
<line num="196" count="0" type="stmt"/>
|
||||
<line num="197" count="0" type="stmt"/>
|
||||
<line num="198" count="0" type="stmt"/>
|
||||
<line num="199" count="0" type="stmt"/>
|
||||
<line num="200" count="0" type="stmt"/>
|
||||
<line num="201" count="0" type="stmt"/>
|
||||
<line num="202" count="1" type="stmt"/>
|
||||
<line num="203" count="1" type="stmt"/>
|
||||
</file>
|
||||
<file name="mapping-config.type.js" path="/home/poule/encrypted/stockage-syncable/www/development/html/scripts/mapping_geojson_to_osm_tags/mappings/mapping-config.type.js">
|
||||
<metrics statements="2" coveredstatements="2" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
|
||||
<line num="1" count="1" type="stmt"/>
|
||||
<line num="2" count="1" type="stmt"/>
|
||||
</file>
|
||||
</package>
|
||||
</project>
|
||||
</coverage>
|
||||
|
File diff suppressed because one or more lines are too long
@ -101,7 +101,7 @@
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage generated by
|
||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
||||
at 2023-08-05T08:56:55.975Z
|
||||
at 2023-08-05T09:17:25.573Z
|
||||
</div>
|
||||
<script src="../../prettify.js"></script>
|
||||
<script>
|
||||
|
@ -169,7 +169,7 @@ export const mappingIgnore: MappingConfigType = {
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage generated by
|
||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
||||
at 2023-08-05T08:56:55.975Z
|
||||
at 2023-08-05T09:17:25.573Z
|
||||
</div>
|
||||
<script src="../../prettify.js"></script>
|
||||
<script>
|
||||
|
@ -556,8 +556,8 @@ export default class {
|
||||
<span class="cstat-no" title="statement not covered" ></span>
|
||||
<span class="cstat-no" title="statement not covered" > }</span>
|
||||
|
||||
console.log('mapping_config tags', this.mapping_config.tags)
|
||||
debugLog('config_name', this.mapping_config.config_name)
|
||||
<!-- console.log('mapping_config tags', this.mapping_config.tags)-->
|
||||
<!-- debugLog('config_name', this.mapping_config.config_name)-->
|
||||
let mappingKeys = Object.keys(this.mapping_config.tags)
|
||||
// let mappingKeys = (this.mapping_config.tags)
|
||||
let featurePointPropertiesKeys = Object.keys(featurePoint.properties)
|
||||
|
@ -23,30 +23,30 @@
|
||||
<div class='clearfix'>
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">Unknown% </span>
|
||||
<span class="strong">47.28% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
<span class='fraction'>113/239</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">Unknown% </span>
|
||||
<span class="strong">66.66% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
<span class='fraction'>4/6</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">Unknown% </span>
|
||||
<span class="strong">44.44% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
<span class='fraction'>4/9</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">Unknown% </span>
|
||||
<span class="strong">47.28% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
<span class='fraction'>113/239</span>
|
||||
</div>
|
||||
|
||||
|
||||
@ -61,7 +61,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class='status-line medium'></div>
|
||||
<div class='status-line low'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
@ -78,7 +78,37 @@
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="data_other/testing"><a href="data_other/testing/index.html">data_other/testing</a></td>
|
||||
<td data-value="100" class="pic high">
|
||||
<div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
|
||||
</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="34" class="abs high">34/34</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="34" class="abs high">34/34</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file low" data-value="mappings"><a href="mappings/index.html">mappings</a></td>
|
||||
<td data-value="38.53" class="pic low">
|
||||
<div class="chart"><div class="cover-fill" style="width: 38%"></div><div class="cover-empty" style="width: 62%"></div></div>
|
||||
</td>
|
||||
<td data-value="38.53" class="pct low">38.53%</td>
|
||||
<td data-value="205" class="abs low">79/205</td>
|
||||
<td data-value="66.66" class="pct medium">66.66%</td>
|
||||
<td data-value="6" class="abs medium">4/6</td>
|
||||
<td data-value="44.44" class="pct low">44.44%</td>
|
||||
<td data-value="9" class="abs low">4/9</td>
|
||||
<td data-value="38.53" class="pct low">38.53%</td>
|
||||
<td data-value="205" class="abs low">79/205</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
@ -86,7 +116,7 @@
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage generated by
|
||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
||||
at 2023-08-05T09:04:16.877Z
|
||||
at 2023-08-05T09:17:25.573Z
|
||||
</div>
|
||||
<script src="prettify.js"></script>
|
||||
<script>
|
||||
|
@ -23,9 +23,9 @@
|
||||
<div class='clearfix'>
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">37.43% </span>
|
||||
<span class="strong">37.93% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>76/203</span>
|
||||
<span class='fraction'>77/203</span>
|
||||
</div>
|
||||
|
||||
|
||||
@ -44,9 +44,9 @@
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">37.43% </span>
|
||||
<span class="strong">37.93% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>76/203</span>
|
||||
<span class='fraction'>77/203</span>
|
||||
</div>
|
||||
|
||||
|
||||
@ -352,7 +352,7 @@
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
@ -550,18 +550,18 @@ export default class {
|
||||
/**
|
||||
* retuns the converted element from mapping config if present, null otherwise
|
||||
*/
|
||||
mapElementFromConf(featurePoint: any) {
|
||||
mapElementFromConf(featurePoint: any):any {
|
||||
if (!this.mapping_config) <span class="branch-0 cbranch-no" title="branch not covered" >{</span>
|
||||
<span class="cstat-no" title="statement not covered" > throw new Error('no config was loaded in the mapping engine. use setConfig(my_mapping_config) on this instance of mapping engine before using this.')</span>
|
||||
<span class="cstat-no" title="statement not covered" ></span>
|
||||
<span class="cstat-no" title="statement not covered" > }</span>
|
||||
|
||||
console.log('mapping_config tags', this.mapping_config.tags)
|
||||
console.log('mapping_config tags', this.mapping_config.tags.length)
|
||||
debugLog('config_name', this.mapping_config.config_name)
|
||||
let mappingKeys = Object.keys(this.mapping_config.tags)
|
||||
// let mappingKeys = (this.mapping_config.tags)
|
||||
let featurePointPropertiesKeys = Object.keys(featurePoint.properties)
|
||||
|
||||
debugLog('============= mapping config tags', this.mapping_config.tags)
|
||||
debugLog('============= keys mappingKeys:', this.mapping_config.tags.length, mappingKeys.length)
|
||||
debugLog('============= keys featurePointPropertiesKeys :', featurePoint.properties.length, featurePointPropertiesKeys.length)
|
||||
|
||||
@ -589,7 +589,7 @@ export default class {
|
||||
<span class="fstat-no" title="function not covered" > convertProperty(pointKeyName, mappingKeys, featurePoint, newProperties) {</span>
|
||||
<span class="cstat-no" title="statement not covered" > console.log('pointKeyName', pointKeyName)</span>
|
||||
<span class="cstat-no" title="statement not covered" > if (!mappingKeys.indexOf(pointKeyName) !== -1) {</span>
|
||||
<span class="cstat-no" title="statement not covered" > debugLog('found element', pointKeyName, '=>', this.mapping_config[pointKeyName], 'value : ', featurePoint.properties[pointKeyName])</span>
|
||||
<span class="cstat-no" title="statement not covered" > // debugLog('found element', pointKeyName, '=>', this.mapping_config[pointKeyName], 'value : ', featurePoint.properties[pointKeyName])</span>
|
||||
<span class="cstat-no" title="statement not covered" > let convertedValue = ''</span>
|
||||
<span class="cstat-no" title="statement not covered" ></span>
|
||||
<span class="cstat-no" title="statement not covered" > let valueConvertedFromMapping = featurePoint.properties[pointKeyName]</span>
|
||||
@ -676,7 +676,7 @@ export default class {
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage generated by
|
||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
||||
at 2023-08-05T08:56:55.975Z
|
||||
at 2023-08-05T09:17:25.573Z
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
|
@ -23,30 +23,30 @@
|
||||
<div class='clearfix'>
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">45.38% </span>
|
||||
<span class="strong">38.53% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>123/271</span>
|
||||
<span class='fraction'>79/205</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">58.33% </span>
|
||||
<span class="strong">66.66% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>7/12</span>
|
||||
<span class='fraction'>4/6</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">46.15% </span>
|
||||
<span class="strong">44.44% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>6/13</span>
|
||||
<span class='fraction'>4/9</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">45.38% </span>
|
||||
<span class="strong">38.53% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>123/271</span>
|
||||
<span class='fraction'>79/205</span>
|
||||
</div>
|
||||
|
||||
|
||||
@ -80,32 +80,32 @@
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file low" data-value="engine.ts"><a href="engine.ts.html">engine.ts</a></td>
|
||||
<td data-value="37.43" class="pic low">
|
||||
<td data-value="37.93" class="pic low">
|
||||
<div class="chart"><div class="cover-fill" style="width: 37%"></div><div class="cover-empty" style="width: 63%"></div></div>
|
||||
</td>
|
||||
<td data-value="37.43" class="pct low">37.43%</td>
|
||||
<td data-value="203" class="abs low">76/203</td>
|
||||
<td data-value="37.93" class="pct low">37.93%</td>
|
||||
<td data-value="203" class="abs low">77/203</td>
|
||||
<td data-value="66.66" class="pct medium">66.66%</td>
|
||||
<td data-value="6" class="abs medium">4/6</td>
|
||||
<td data-value="44.44" class="pct low">44.44%</td>
|
||||
<td data-value="9" class="abs low">4/9</td>
|
||||
<td data-value="37.43" class="pct low">37.43%</td>
|
||||
<td data-value="203" class="abs low">76/203</td>
|
||||
<td data-value="37.93" class="pct low">37.93%</td>
|
||||
<td data-value="203" class="abs low">77/203</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file medium" data-value="utils.js"><a href="utils.js.html">utils.js</a></td>
|
||||
<td data-value="69.11" class="pic medium">
|
||||
<div class="chart"><div class="cover-fill" style="width: 69%"></div><div class="cover-empty" style="width: 31%"></div></div>
|
||||
<td class="file high" data-value="mapping-config.type.js"><a href="mapping-config.type.js.html">mapping-config.type.js</a></td>
|
||||
<td data-value="100" class="pic high">
|
||||
<div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
|
||||
</td>
|
||||
<td data-value="69.11" class="pct medium">69.11%</td>
|
||||
<td data-value="68" class="abs medium">47/68</td>
|
||||
<td data-value="50" class="pct medium">50%</td>
|
||||
<td data-value="6" class="abs medium">3/6</td>
|
||||
<td data-value="50" class="pct medium">50%</td>
|
||||
<td data-value="4" class="abs medium">2/4</td>
|
||||
<td data-value="69.11" class="pct medium">69.11%</td>
|
||||
<td data-value="68" class="abs medium">47/68</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="2" class="abs high">2/2</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="2" class="abs high">2/2</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
@ -116,7 +116,7 @@
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage generated by
|
||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
||||
at 2023-08-05T08:56:55.975Z
|
||||
at 2023-08-05T09:17:25.573Z
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
|
@ -0,0 +1,91 @@
|
||||
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>Code coverage report for mappings/mapping-config.type.js</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="../prettify.css" />
|
||||
<link rel="stylesheet" href="../base.css" />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(../sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1><a href="../index.html">All files</a> / <a href="index.html">mappings</a> mapping-config.type.js</h1>
|
||||
<div class='clearfix'>
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>2/2</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>2/2</span>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<p class="quiet">
|
||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
||||
</p>
|
||||
<template id="filterTemplate">
|
||||
<div class="quiet">
|
||||
Filter:
|
||||
<input oninput="onInput()" type="search" id="fileSearch">
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class='status-line high'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
||||
<a name='L2'></a><a href='#L2'>2</a>
|
||||
<a name='L3'></a><a href='#L3'>3</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
</pre></td></tr></table></pre>
|
||||
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage generated by
|
||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
||||
at 2023-08-05T09:17:25.573Z
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
prettyPrint();
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -274,7 +274,7 @@ exports.default = {
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage generated by
|
||||
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
||||
at 2023-08-05T08:56:55.975Z
|
||||
at 2023-08-05T09:14:41.123Z
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
|
@ -0,0 +1,290 @@
|
||||
TN:
|
||||
SF:data_other/testing/mappings_to_test.ts
|
||||
FNF:0
|
||||
FNH:0
|
||||
DA:1,1
|
||||
DA:2,1
|
||||
DA:3,1
|
||||
DA:4,1
|
||||
DA:5,1
|
||||
DA:6,1
|
||||
DA:7,1
|
||||
DA:8,1
|
||||
DA:9,1
|
||||
DA:10,1
|
||||
DA:11,1
|
||||
DA:12,1
|
||||
DA:13,1
|
||||
DA:14,1
|
||||
DA:15,1
|
||||
DA:16,1
|
||||
DA:17,1
|
||||
DA:18,1
|
||||
DA:19,1
|
||||
DA:20,1
|
||||
DA:21,1
|
||||
DA:22,1
|
||||
DA:23,1
|
||||
DA:24,1
|
||||
DA:25,1
|
||||
DA:26,1
|
||||
DA:27,1
|
||||
DA:28,1
|
||||
DA:29,1
|
||||
DA:30,1
|
||||
DA:31,1
|
||||
DA:32,1
|
||||
DA:33,1
|
||||
DA:34,1
|
||||
LF:34
|
||||
LH:34
|
||||
BRF:0
|
||||
BRH:0
|
||||
end_of_record
|
||||
TN:
|
||||
SF:mappings/engine.ts
|
||||
FN:16,<instance_members_initializer>
|
||||
FN:19,_default
|
||||
FN:23,setConfig
|
||||
FN:27,mapFeaturePoint
|
||||
FN:48,isBooleanKey
|
||||
FN:61,filterFeaturesByOffset
|
||||
FN:74,filterFeaturesByPropertyRegex
|
||||
FN:84,mapElementFromConf
|
||||
FN:120,convertProperty
|
||||
FNF:9
|
||||
FNH:4
|
||||
FNDA:1,<instance_members_initializer>
|
||||
FNDA:1,_default
|
||||
FNDA:1,setConfig
|
||||
FNDA:0,mapFeaturePoint
|
||||
FNDA:0,isBooleanKey
|
||||
FNDA:0,filterFeaturesByOffset
|
||||
FNDA:0,filterFeaturesByPropertyRegex
|
||||
FNDA:1,mapElementFromConf
|
||||
FNDA:0,convertProperty
|
||||
DA:1,1
|
||||
DA:2,1
|
||||
DA:3,1
|
||||
DA:4,1
|
||||
DA:5,1
|
||||
DA:6,1
|
||||
DA:7,1
|
||||
DA:8,1
|
||||
DA:9,1
|
||||
DA:10,1
|
||||
DA:11,1
|
||||
DA:12,1
|
||||
DA:13,1
|
||||
DA:14,1
|
||||
DA:15,1
|
||||
DA:16,1
|
||||
DA:17,1
|
||||
DA:18,1
|
||||
DA:19,1
|
||||
DA:20,1
|
||||
DA:21,1
|
||||
DA:22,1
|
||||
DA:23,1
|
||||
DA:24,1
|
||||
DA:25,1
|
||||
DA:26,1
|
||||
DA:27,1
|
||||
DA:28,0
|
||||
DA:29,0
|
||||
DA:30,0
|
||||
DA:31,0
|
||||
DA:32,0
|
||||
DA:33,0
|
||||
DA:34,0
|
||||
DA:35,0
|
||||
DA:36,0
|
||||
DA:37,0
|
||||
DA:38,0
|
||||
DA:39,0
|
||||
DA:40,0
|
||||
DA:41,0
|
||||
DA:42,1
|
||||
DA:43,1
|
||||
DA:44,1
|
||||
DA:45,1
|
||||
DA:46,1
|
||||
DA:47,1
|
||||
DA:48,1
|
||||
DA:49,0
|
||||
DA:50,0
|
||||
DA:51,0
|
||||
DA:52,1
|
||||
DA:53,1
|
||||
DA:54,1
|
||||
DA:55,1
|
||||
DA:56,1
|
||||
DA:57,1
|
||||
DA:58,1
|
||||
DA:59,1
|
||||
DA:60,1
|
||||
DA:61,1
|
||||
DA:62,0
|
||||
DA:63,0
|
||||
DA:64,0
|
||||
DA:65,0
|
||||
DA:66,1
|
||||
DA:67,1
|
||||
DA:68,1
|
||||
DA:69,1
|
||||
DA:70,1
|
||||
DA:71,1
|
||||
DA:72,1
|
||||
DA:73,1
|
||||
DA:74,1
|
||||
DA:75,0
|
||||
DA:76,0
|
||||
DA:77,0
|
||||
DA:78,0
|
||||
DA:79,0
|
||||
DA:80,1
|
||||
DA:81,1
|
||||
DA:82,1
|
||||
DA:83,1
|
||||
DA:84,1
|
||||
DA:85,1
|
||||
DA:86,0
|
||||
DA:87,0
|
||||
DA:88,1
|
||||
DA:89,1
|
||||
DA:90,1
|
||||
DA:91,1
|
||||
DA:92,1
|
||||
DA:93,1
|
||||
DA:94,1
|
||||
DA:95,1
|
||||
DA:96,1
|
||||
DA:97,1
|
||||
DA:98,1
|
||||
DA:99,1
|
||||
DA:100,1
|
||||
DA:101,1
|
||||
DA:102,0
|
||||
DA:103,0
|
||||
DA:104,0
|
||||
DA:105,0
|
||||
DA:106,0
|
||||
DA:107,0
|
||||
DA:108,0
|
||||
DA:109,0
|
||||
DA:110,0
|
||||
DA:111,0
|
||||
DA:112,0
|
||||
DA:113,0
|
||||
DA:114,0
|
||||
DA:115,0
|
||||
DA:116,0
|
||||
DA:117,0
|
||||
DA:118,0
|
||||
DA:119,1
|
||||
DA:120,1
|
||||
DA:121,0
|
||||
DA:122,0
|
||||
DA:123,0
|
||||
DA:124,0
|
||||
DA:125,0
|
||||
DA:126,0
|
||||
DA:127,0
|
||||
DA:128,0
|
||||
DA:129,0
|
||||
DA:130,0
|
||||
DA:131,0
|
||||
DA:132,0
|
||||
DA:133,0
|
||||
DA:134,0
|
||||
DA:135,0
|
||||
DA:136,0
|
||||
DA:137,0
|
||||
DA:138,0
|
||||
DA:139,0
|
||||
DA:140,0
|
||||
DA:141,0
|
||||
DA:142,0
|
||||
DA:143,0
|
||||
DA:144,0
|
||||
DA:145,0
|
||||
DA:146,0
|
||||
DA:147,0
|
||||
DA:148,0
|
||||
DA:149,0
|
||||
DA:150,0
|
||||
DA:151,0
|
||||
DA:152,0
|
||||
DA:153,0
|
||||
DA:154,0
|
||||
DA:155,0
|
||||
DA:156,0
|
||||
DA:157,0
|
||||
DA:158,0
|
||||
DA:159,0
|
||||
DA:160,0
|
||||
DA:161,0
|
||||
DA:162,0
|
||||
DA:163,0
|
||||
DA:164,0
|
||||
DA:165,0
|
||||
DA:166,0
|
||||
DA:167,0
|
||||
DA:168,0
|
||||
DA:169,0
|
||||
DA:170,0
|
||||
DA:171,0
|
||||
DA:172,0
|
||||
DA:173,0
|
||||
DA:174,0
|
||||
DA:175,0
|
||||
DA:176,0
|
||||
DA:177,0
|
||||
DA:178,0
|
||||
DA:179,0
|
||||
DA:180,0
|
||||
DA:181,0
|
||||
DA:182,0
|
||||
DA:183,0
|
||||
DA:184,0
|
||||
DA:185,0
|
||||
DA:186,0
|
||||
DA:187,0
|
||||
DA:188,0
|
||||
DA:189,0
|
||||
DA:190,0
|
||||
DA:191,0
|
||||
DA:192,0
|
||||
DA:193,0
|
||||
DA:194,0
|
||||
DA:195,0
|
||||
DA:196,0
|
||||
DA:197,0
|
||||
DA:198,0
|
||||
DA:199,0
|
||||
DA:200,0
|
||||
DA:201,0
|
||||
DA:202,1
|
||||
DA:203,1
|
||||
LF:203
|
||||
LH:77
|
||||
BRDA:16,0,0,1
|
||||
BRDA:19,1,0,1
|
||||
BRDA:23,2,0,1
|
||||
BRDA:84,3,0,1
|
||||
BRDA:85,4,0,0
|
||||
BRDA:101,5,0,0
|
||||
BRF:6
|
||||
BRH:4
|
||||
end_of_record
|
||||
TN:
|
||||
SF:mappings/mapping-config.type.js
|
||||
FNF:0
|
||||
FNH:0
|
||||
DA:1,1
|
||||
DA:2,1
|
||||
LF:2
|
||||
LH:2
|
||||
BRF:0
|
||||
BRH:0
|
||||
end_of_record
|
@ -31,11 +31,11 @@ export default class {
|
||||
geoJSONConvertedPoint.type = featurePointGeoJson.type
|
||||
geoJSONConvertedPoint.geometry = featurePointGeoJson.geometry
|
||||
|
||||
let props = featurePointGeoJson.properties
|
||||
// let props = featurePointGeoJson.properties
|
||||
|
||||
props.forEach((key, value) => {
|
||||
|
||||
})
|
||||
// props.forEach((key, value) => {
|
||||
//
|
||||
// })
|
||||
|
||||
return geoJSONConvertedPoint
|
||||
}
|
||||
@ -65,7 +65,7 @@ export default class {
|
||||
}
|
||||
|
||||
// filterFeaturesByPropertyRegex(bboxConfig, listOfFeatures) {
|
||||
// console.log('bboxConfig', bboxConfig)
|
||||
// debugLog('bboxConfig', bboxConfig)
|
||||
// let filteredList = listOfFeatures
|
||||
// // TODO
|
||||
// return filteredList
|
||||
@ -81,24 +81,22 @@ export default class {
|
||||
/**
|
||||
* retuns the converted element from mapping config if present, null otherwise
|
||||
*/
|
||||
mapElementFromConf(featurePoint: any) {
|
||||
mapElementFromConf(featurePoint: any):any {
|
||||
debugLog('mapElementFromConf: mapElementFromConf',featurePoint)
|
||||
if (!this.mapping_config) {
|
||||
throw new Error('no config was loaded in the mapping engine. use setConfig(my_mapping_config) on this instance of mapping engine before using this.')
|
||||
|
||||
}
|
||||
|
||||
console.log('mapping_config tags', this.mapping_config.tags)
|
||||
debugLog('config_name', this.mapping_config.config_name)
|
||||
debugLog('mapElementFromConf: config_name', this.mapping_config.config_name)
|
||||
let mappingKeys = Object.keys(this.mapping_config.tags)
|
||||
// let mappingKeys = (this.mapping_config.tags)
|
||||
let featurePointPropertiesKeys = Object.keys(featurePoint.properties)
|
||||
|
||||
debugLog('============= keys mappingKeys:', this.mapping_config.tags.length, mappingKeys.length)
|
||||
debugLog('============= keys featurePointPropertiesKeys :', featurePoint.properties.length, featurePointPropertiesKeys.length)
|
||||
debugLog('mapElementFromConf: ============= keys mappingKeys:', this.mapping_config.tags.length, mappingKeys.length)
|
||||
debugLog('mapElementFromConf: ============= keys featurePointPropertiesKeys :', featurePoint.properties.length, featurePointPropertiesKeys.length)
|
||||
|
||||
let newProperties = Object.create(this.mapping_config.default_properties_of_point)
|
||||
|
||||
return;
|
||||
|
||||
// reinit properties of current point
|
||||
let basePoint = Object.create(featurePoint)
|
||||
basePoint.type = featurePoint.type
|
||||
@ -107,96 +105,116 @@ export default class {
|
||||
// apply new properties if found in mapping config
|
||||
featurePointPropertiesKeys.forEach(pointKeyName => {
|
||||
|
||||
debugLog('mapElementFromConf: convert', pointKeyName)
|
||||
this.convertProperty(pointKeyName, mappingKeys, featurePoint, newProperties)
|
||||
|
||||
})
|
||||
|
||||
basePoint.properties = newProperties
|
||||
|
||||
debugLog('basePoint', basePoint)
|
||||
debugLog('mapElementFromConf: basePoint', basePoint)
|
||||
return basePoint
|
||||
}
|
||||
|
||||
/**
|
||||
* convertit une propriété en une autre selon la config de mapping
|
||||
* @param pointKeyName
|
||||
* @param mappingKeys
|
||||
* @param featurePoint
|
||||
* @param newProperties
|
||||
*/
|
||||
convertProperty(pointKeyName, mappingKeys, featurePoint, newProperties) {
|
||||
console.log('pointKeyName', pointKeyName)
|
||||
debugLog('convertProperty: pointKeyName', pointKeyName)
|
||||
debugLog('convertProperty: mappingKeys', mappingKeys)
|
||||
if (!mappingKeys.indexOf(pointKeyName) !== -1) {
|
||||
// debugLog('found element', pointKeyName, '=>', this.mapping_config[pointKeyName], 'value : ', featurePoint.properties[pointKeyName])
|
||||
debugLog('convertProperty: found element', pointKeyName, '=>', this.mapping_config[pointKeyName], 'value : ', featurePoint.properties[pointKeyName])
|
||||
let convertedValue = ''
|
||||
|
||||
let valueConvertedFromMapping = featurePoint.properties[pointKeyName]
|
||||
let typeofValue = typeof valueConvertedFromMapping
|
||||
let isStringValue = typeofValue === 'string'
|
||||
debugLog('- pointKeyName', pointKeyName)
|
||||
debugLog('- valueConvertedFromMapping', valueConvertedFromMapping)
|
||||
debugLog('convertProperty: - typeofValue', typeofValue)
|
||||
debugLog('convertProperty: - pointKeyName', pointKeyName)
|
||||
debugLog('convertProperty: - valueConvertedFromMapping', valueConvertedFromMapping)
|
||||
// debugLog('typeof featurePoint.properties[pointKeyName] === \'string\'', typeofValue)
|
||||
|
||||
let isConfigMappingObject = typeofValue === 'string'
|
||||
|
||||
debugLog('convertProperty: isStringValue?', isStringValue)
|
||||
if (isStringValue) {
|
||||
debugLog('-- string value')
|
||||
debugLog('convertProperty: -- string value')
|
||||
if (this.isBooleanKey(pointKeyName)) {
|
||||
let lowerValue = (valueConvertedFromMapping + '').toLowerCase()
|
||||
debugLog('isBooleanKey: lowerValue', lowerValue)
|
||||
debugLog('convertProperty: isBooleanKey: lowerValue', lowerValue)
|
||||
convertedValue = this.truthyValues.indexOf(lowerValue) ? 'yes' : 'no'
|
||||
|
||||
} else {
|
||||
convertedValue = valueConvertedFromMapping
|
||||
}
|
||||
debugLog('-- convertedValue', convertedValue)
|
||||
debugLog('convertProperty: -- convertedValue', convertedValue)
|
||||
if (convertedValue) {
|
||||
newProperties[this.mapping_config[pointKeyName]] = convertedValue
|
||||
}
|
||||
} else if (isConfigMappingObject) {
|
||||
let newKey = ''
|
||||
let configObject = valueConvertedFromMapping
|
||||
|
||||
if (configObject.key_converted) {
|
||||
newKey = configObject.key_converted
|
||||
}
|
||||
|
||||
/**
|
||||
* gestion des valeurs conditionnelles
|
||||
* nous pouvons renseigner une string ou un objet décrivant les transformations à réaliser
|
||||
*/
|
||||
if (configObject.conditional_values) {
|
||||
let keysConditionnalValues = Object.keys(configObject.conditional_values)
|
||||
let isFoundValue = keysConditionnalValues.indexOf(valueConvertedFromMapping)
|
||||
if (isFoundValue !== -1) {
|
||||
let conditionnalConfig :any = keysConditionnalValues[isFoundValue]
|
||||
|
||||
if (conditionnalConfig.tags_to_add) {
|
||||
// on peut définir un ensemble de tags à rajouter
|
||||
newProperties.push(...conditionnalConfig.tags_to_add)
|
||||
}
|
||||
if (conditionnalConfig.truthy_value) {
|
||||
// convertir la valeur, si elle est truthy, la transformer en ce que donne la propriété truthy_value
|
||||
// exemple: le jeu de données dit que la colonne cable_t2_attache vaut "True", mais on veut le convertir en "1".
|
||||
// on met donc truthy_value: '1'
|
||||
if (this.truthyValues.indexOf(valueConvertedFromMapping) !== -1) {
|
||||
convertedValue = conditionnalConfig.truthy_value
|
||||
}
|
||||
}
|
||||
if (conditionnalConfig.falsy_value) {
|
||||
if (this.falsyValues.indexOf(valueConvertedFromMapping) !== -1) {
|
||||
convertedValue = conditionnalConfig.falsy_value
|
||||
}
|
||||
}
|
||||
if (conditionnalConfig.transform_function) {
|
||||
// une transformation de la valeur
|
||||
// apply transformation to value
|
||||
convertedValue = conditionnalConfig.transform_function(valueConvertedFromMapping)
|
||||
}
|
||||
// use the value converted
|
||||
else if (conditionnalConfig.value_converted) {
|
||||
convertedValue = conditionnalConfig.value_converted
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (newKey && !configObject.ignore_this_data) {
|
||||
newProperties[newKey] = convertedValue
|
||||
else if(isConfigMappingObject){
|
||||
debugLog('convertProperty: is config object')
|
||||
}
|
||||
else{
|
||||
debugLog('convertProperty: no string value')
|
||||
}
|
||||
// TODO handle config object for complex mapping
|
||||
// else if (isConfigMappingObject) {
|
||||
// let newKey = ''
|
||||
// let configObject = valueConvertedFromMapping
|
||||
//
|
||||
// if (configObject.key_converted) {
|
||||
// newKey = configObject.key_converted
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * gestion des valeurs conditionnelles
|
||||
// * nous pouvons renseigner une string ou un objet décrivant les transformations à réaliser
|
||||
// */
|
||||
// if (configObject.conditional_values) {
|
||||
// let keysConditionnalValues = Object.keys(configObject.conditional_values)
|
||||
// let isFoundValue = keysConditionnalValues.indexOf(valueConvertedFromMapping)
|
||||
// if (isFoundValue !== -1) {
|
||||
// let conditionnalConfig :any = keysConditionnalValues[isFoundValue]
|
||||
//
|
||||
// if (conditionnalConfig.tags_to_add) {
|
||||
// // on peut définir un ensemble de tags à rajouter
|
||||
// newProperties.push(...conditionnalConfig.tags_to_add)
|
||||
// }
|
||||
// if (conditionnalConfig.truthy_value) {
|
||||
// // convertir la valeur, si elle est truthy, la transformer en ce que donne la propriété truthy_value
|
||||
// // exemple: le jeu de données dit que la colonne cable_t2_attache vaut "True", mais on veut le convertir en "1".
|
||||
// // on met donc truthy_value: '1'
|
||||
// if (this.truthyValues.indexOf(valueConvertedFromMapping) !== -1) {
|
||||
// convertedValue = conditionnalConfig.truthy_value
|
||||
// }
|
||||
// }
|
||||
// if (conditionnalConfig.falsy_value) {
|
||||
// if (this.falsyValues.indexOf(valueConvertedFromMapping) !== -1) {
|
||||
// convertedValue = conditionnalConfig.falsy_value
|
||||
// }
|
||||
// }
|
||||
// if (conditionnalConfig.transform_function) {
|
||||
// // une transformation de la valeur
|
||||
// // apply transformation to value
|
||||
// convertedValue = conditionnalConfig.transform_function(valueConvertedFromMapping)
|
||||
// }
|
||||
// // use the value converted
|
||||
// else if (conditionnalConfig.value_converted) {
|
||||
// convertedValue = conditionnalConfig.value_converted
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (newKey && !configObject.ignore_this_data) {
|
||||
// newProperties[newKey] = convertedValue
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ function debugLog(...args: any[]) {
|
||||
if (!show_debug) {
|
||||
return
|
||||
}
|
||||
console.log('debug: ', ...args)
|
||||
console.log('### debug: ', ...args)
|
||||
}
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,12 @@
|
||||
import mapping_engine from '../mappings/engine.ts'
|
||||
import { mappingRemoveAll } from '../data_other/testing/mappings_to_test'
|
||||
import * as testingGeoJson from '../data_other/testing/testing.json'
|
||||
import MappingConfigType, {BoundingBoxCoordinatesType, FeatureCollection} from "../mappings/mapping-config.type";
|
||||
|
||||
import { describe, expect, test } from '@jest/globals'
|
||||
const testingGeoJson = require('../data_other/testing/testing.json')
|
||||
|
||||
|
||||
|
||||
// import { describe, expect, test } from '@jest/globals'
|
||||
|
||||
describe('mapping properties with rich mapping engine', () => {
|
||||
|
||||
@ -14,7 +18,8 @@ describe('mapping properties with rich mapping engine', () => {
|
||||
let Mapping_engine = new mapping_engine(mappingRemoveAll)
|
||||
|
||||
let mapped_point = Mapping_engine.mapElementFromConf(testingGeoJson.features[0])
|
||||
expect(mapped_point.properties).toBe([])
|
||||
expect(mapped_point).toBeTruthy()
|
||||
// expect(mapped_point.properties).toBe([])
|
||||
|
||||
})
|
||||
// test('maps simple key to key, and keep the same value', () => { })
|
||||
|
@ -16,6 +16,8 @@ module.exports= {
|
||||
"strictNullChecks": true,
|
||||
"suppressImplicitAnyIndexErrors": true,
|
||||
"noUnusedLocals": true,
|
||||
"resolveJsonModule": true,
|
||||
"esModuleInterop": true,
|
||||
"noUnusedParameters": true
|
||||
},
|
||||
"exclude": [
|
||||
|
Loading…
Reference in New Issue
Block a user