diff --git a/database/config.ts b/database/config.ts index 5bf471c97ada9c60263c244d541c2483dd1bf208..e138ee60c67a8de25fbd39ad05044050525337fc 100755 --- a/database/config.ts +++ b/database/config.ts @@ -83,7 +83,7 @@ function createView(view: View): string { let keys = []; for (let field in view.fields) { props.push("\"" + field + "\" " + typeConvertion(view.fields[field])); - keys.push(field.name); + keys.push(field); } keys.sort(); let name = "view_" + Hash.sha1(keys); diff --git a/database/schema.json b/database/schema.json index ce97f0b1e2217ef8b49475090b160451b8c6e587..0fabaafcc400342ca9dc8267d78ffa000054974c 100644 --- a/database/schema.json +++ b/database/schema.json @@ -3,17 +3,17 @@ "alias" : "net_usage" , "query" : "fnu.sql" , "fields" : { - "dim:contact_date" : "date", + "dim:contactDate" : "date", "dim:point" : "integer", - "dim:mac_addr" : "string", - "met:avg_download" : "integer", - "met:avg_upload" : "integer", - "met:count_countact" : "integer", - "met:last_contact" : "date", - "met:max_upload" : "integer", - "met:max_download" : "integer", - "met:sum_download" : "integer", - "met:sum_upload" : "integer" + "dim:macAddr" : "string", + "met:avg:download" : "integer", + "met:avg:upload" : "integer", + "met:count:contact" : "integer", + "met:max:contact" : "date", + "met:max:download" : "integer", + "met:max:upload" : "integer", + "met:sum:download" : "integer", + "met:sum:upload" : "integer" } } , { @@ -21,10 +21,10 @@ , "query" : "city.sql" , "fields" : { "dim:city" : "integer", - "dim:city_name" : "string", + "dim:cityName" : "string", "dim:region" : "string", "dim:state" : "string", - "met:count_city" : "integer" + "met:count:city" : "integer" } } , { @@ -33,16 +33,16 @@ , "fields" : { "dim:active" : "boolean", "dim:city" : "integer", - "dim:digital_city" : "boolean", + "dim:digitalCity" : "boolean", "dim:gesac" : "boolean", "dim:point" : "integer", - "dim:point_date" : "date", - "dim:point_name" : "string", + "dim:pointDate" : "date", + "dim:pointName" : "string", "dim:project" : "string", "dim:telecenter" : "boolean", - "met:count_point" : "integer", - "met:hired_download" : "integer", - "met:hired_upload" : "integer" + "met:count:point" : "integer", + "met:avg:hiredDownload" : "integer", + "met:avg:hiredUpload" : "integer" } } , { @@ -50,28 +50,28 @@ , "query" : "inv_changes.sql" , "fields" : { "dim:disk" : "integer", - "dim:inventory_date" : "date", - "dim:mac_addr" : "string", + "dim:inventoryDate" : "date", + "dim:macAddr" : "string", "dim:memory" : "string", - "dim:old_disk" : "string", - "dim:old_inventory_date" : "date", - "dim:old_memory" : "string", - "dim:old_os" : "string", - "dim:old_processor" : "string", + "dim:oldDisk" : "string", + "dim:oldInventoryDate" : "date", + "dim:oldMemory" : "string", + "dim:oldOs" : "string", + "dim:oldProcessor" : "string", "dim:os" : "string", "dim:point" : "integer", "dim:processor" : "string", - "met:machines" : "integer", - "met:modified_disk" : "integer", - "met:modified_memory" : "integer" + "met:count:machines" : "integer", + "met:count:modified_disk" : "integer", + "met:count:modified_memory" : "integer" } } , { "alias" : "inventory" , "query" : "inv.sql" , "fields" : { - "dim:current_inventory" : "boolean", - "dim:inventory_date" : "date", + "dim:currentInventory" : "boolean", + "dim:inventoryDate" : "date", "dim:point" : "integer" } } diff --git a/database/views/city.sql b/database/views/city.sql index 01920779e8b9c018dbaf86cfc68a6b034bbccfb3..49fcd3931f584a805c3216fe769187645c230fe2 100644 --- a/database/views/city.sql +++ b/database/views/city.sql @@ -3,7 +3,7 @@ SELECT , name AS "dim:city_name" , region AS "dim:region" , state AS "dim:state" - , id AS "met:count_city" + , id AS "met:count:city" FROM city ; diff --git a/database/views/fnu.sql b/database/views/fnu.sql index b21ec6dbee8a78690c09b2c523c6e4e2bdbbc87e..1e593f2dc58daca7843b70bd642d9aacbcfc24a8 100644 --- a/database/views/fnu.sql +++ b/database/views/fnu.sql @@ -1,15 +1,15 @@ SELECT - contact_date AS "dim:contact_date" + contact_date AS "dim:contactDate" , id_point AS "dim:point" - , macaddr AS "dim:mac_addr" - , down_bytes AS "met:avg_download" - , up_bytes AS "met:avg_upload" - , '1' AS "met:count_countact" - , contact_date AS "met:last_contact" - , down_bytes AS "met:max_upload" - , up_bytes AS "met:max_download" - , down_bytes AS "met:sum_download" - , up_bytes AS "met:sum_upload" + , macaddr AS "dim:macAddr" + , down_bytes AS "met:avg:download" + , up_bytes AS "met:avg:upload" + , '1'::INTEGER AS "met:count:countact" + , contact_date AS "met:max:contact" + , down_bytes AS "met:max:upload" + , up_bytes AS "met:max:download" + , down_bytes AS "met:sum:download" + , up_bytes AS "met:sum:upload" FROM fact_net_usage ; diff --git a/database/views/inv.sql b/database/views/inv.sql index 734c5bac53094cf37d48ce323d13166a31c88e75..d97985e5c369e3b66ca6bb10e014ace809524774 100644 --- a/database/views/inv.sql +++ b/database/views/inv.sql @@ -1,6 +1,6 @@ SELECT - is_current AS "dim:current_inventory" - , load_date AS "dim:inventory_date" + is_current AS "dim:currentInventory" + , load_date AS "dim:inventoryDate" , id_point AS "dim:point" FROM dim_inventory diff --git a/database/views/inv_changes.sql b/database/views/inv_changes.sql index 5054855f98414cc247d2348b53efb8efa9bd2daa..9b03c54b18f86f89a988d2c1d181b2cc312a039a 100644 --- a/database/views/inv_changes.sql +++ b/database/views/inv_changes.sql @@ -1,17 +1,17 @@ SELECT d.new_hd_size AS "dim:disk" - , d.new_date AS "dim:inventory_date" - , d.machine AS "dim:mac_addr" + , d.new_date AS "dim:inventoryDate" + , d.machine AS "dim:macAddr" , d.new_memory_size AS "dim:memory" - , d.old_hd_size AS "dim:old_disk" - , d.old_date AS "dim:old_inventory_date" - , d.old_memory_size AS"dim:old_memory" + , d.old_hd_size AS "dim:oldDisk" + , d.old_date AS "dim:oldInventoryDate" + , d.old_memory_size AS"dim:oldMemory" , d.os_distro AS "dim:os" , d.id_point AS "dim:point" , d.processor AS "dim:processor" - , '1' AS "met:machines" - , d.hd_alert AS "met:modified_disk" - , d.memory_alert AS "met:modified_memory" + , '1'::INTEGER AS "met:count:machines" + , d.hd_alert AS "met:modifiedDisk" + , d.memory_alert AS "met:modifiedMemory" FROM ( SELECT diff --git a/database/views/point.sql b/database/views/point.sql index 9b98f16cafe91701b7825449bcd4dba47ce823b9..a80da7368148079d29b982dbf2b0ec620a728dc2 100644 --- a/database/views/point.sql +++ b/database/views/point.sql @@ -1,11 +1,11 @@ SELECT p.is_active AS "dim:active" , p.id_city AS "dim:city" - , p.is_digital_city AS "dim:digital_city" + , p.is_digital_city AS "dim:digitalCity" , p.is_gesac AS "dim:gesac" , p.id AS"dim:point" - , current_date AS "dim:point_date" - , a.establishment AS "dim:point_name" + , current_date AS "dim:pointDate" + , a.establishment AS "dim:pointName" , CASE WHEN (p.is_digital_city = TRUE) THEN 'DC' WHEN (p.is_telecenter = TRUE AND p.is_gesac = FALSE) THEN 'TLBR' @@ -13,9 +13,9 @@ SELECT ELSE 'GESAC' END AS"dim:project" , p.is_telecenter AS "dim:telecenter" - , '1' AS "met:count_point" - , h.hired_download AS "met:hired_download" - , h.hired_upload AS "met:hired_upload" + , '1'::INTEGER AS "met:count:point" + , h.hired_download AS "met:avg:hiredDownload" + , h.hired_upload AS "met:avg:hiredUpload" FROM point p INNER JOIN address a ON p.id = a.id_point