0

I have (n) JSON encoded skillset objects and I need to be able to derive meaningful summary information for display, grouping by group, category, resource, and capability. What is the most optimal way of processing this data to reduce clientside impact given that I've already have to parse the DOM to strip out the data?

N.B. dataset not more than 5000 records.

e.g.

@{"resource" : "","group" : "Technologies","category" : "Extract Transform Load","skill" : "Informatica Powercenter","capabilityWeighting" : 1} 
@{"resource" : "","group" : "Technologies","category" : "Extract Transform Load","skill" : "IBM Datastage","capabilityWeighting" : 0} 
@{"resource" : "","group" : "Technologies","category" : "Extract Transform Load","skill" : "Microsoft SSIS","capabilityWeighting" : 4} 
@{"resource" : "","group" : "Technologies","category" : "Extract Transform Load","skill" : "Ab Initio","capabilityWeighting" : 15} 
@{"resource" : "","group" : "Technologies","category" : "Extract Transform Load","skill" : "Informatica Powercenter","capabilityWeighting" : 4} 
@{"resource" : "","group" : "Technologies","category" : "Extract Transform Load","skill" : "IBM Datastage","capabilityWeighting" : 15} 
@{"resource" : "","group" : "Technologies","category" : "Extract Transform Load","skill" : "Microsoft SSIS","capabilityWeighting" : 1} 

summarise to:-

For Extract Transform Load with Capability Weighting of 40:

  • Infomatica Powercenter Capability Weighting = 5

  • IBM Datastage Capability Weighting = 15

  • Microsoft SSIS Capability Weighting = 5

  • Ab Initio Capability weighting = 15

or:-

For Resource X with Capability Weighting of n = x + y + z

  • Technologies : Extract Transform Load Capability Weighting = x

  • Technologies : Business Intelligence Capability Weighting = y

  • Technologies : Data Warehousing Capability Weighting = z

2 Answers 2

0

If you want to do this on client side, I would just use simple hash tables (dictionaries) to calculate the summaries.

Sign up to request clarification or add additional context in comments.

Comments

0

You could loop through your N json-encoded objects, keeping a running tally on a summary object:

var data = [
    {"resource": "", "group": "Technologies", "category": "Extract Transform Load", "skill": "Informatica Powercenter", "capabilityWeighting": 1},
    {"resource": "", "group": "Technologies", "category": "Extract Transform Load", "skill": "IBM Datastage", "capabilityWeighting": 0},
    {"resource": "", "group": "Technologies", "category": "Extract Transform Load", "skill": "Microsoft SSIS", "capabilityWeighting": 4},
    {"resource": "", "group": "Technologies", "category": "Extract Transform Load", "skill": "Ab Initio", "capabilityWeighting": 15},
    {"resource": "", "group": "Technologies", "category": "Extract Transform Load", "skill": "Informatica Powercenter", "capabilityWeighting": 4},
    {"resource": "", "group": "Technologies", "category": "Extract Transform Load", "skill": "IBM Datastage", "capabilityWeighting": 15},
    {"resource": "", "group": "Technologies", "category": "Extract Transform Load", "skill": "Microsoft SSIS", "capabilityWeighting": 1}
];

var summary = {};

for (var i = 0, c = data.length; i < c; i += 1) {
    var row = data[i];
    if (!summary.hasOwnProperty(row.category)) summary[row.category] = { skills: {}, total: 0 };
    if (!summary[row.category].skills.hasOwnProperty(row.skill)) summary[row.category].skills[row.skill] = 0;
    summary[row.category].skills[row.skill] += row.capabilityWeighting;
    summary[row.category].total += row.capabilityWeighting;
}

// "summary" now has all the data summarized as you need.
// You just need to loop through it and output using whatever phrasing you want.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.