Do more trees mean more money?

Are houses more expensive on streets with tall trees compared to those with shorter trees? Let's find out!

Important!
Your code will be reviewed by a member of our engineering team (we share the work). The exercise itself is straightforward, no tricky algorithms or obscure data structures to worry about. It's based on real-world problems we often encounter.

Write your best code
Focus on producing high-quality code — easy to read and easy to maintain. Only as complicated as it needs to be. If this was a pull request to a teammate, you're aiming for zero comments. As professional as possible.

There is no time limit. The time it took you to complete the task is not considered when we evaluate. We only consider the points below.

Evaluation

These points are used by the engineering team to evaluate submissions.

Datasets

We have two files: dublin-trees.json and dublin-property.csv:

We've cleaned the datasets a little, so the street name in dublin-trees.json exactly matches the `Street Name` column in dublin-property.csv.

dublin-trees.json structure

There are two top-level entries: short and tall.

Street names are in an arbitrarily nested structure, only the entry with a height is relevant and this entry contains the complete street name.

Here's an example:

        {
            "short": {
                "drive": {
                    "abbey": {
                        "abbey drive": 0
                    },
                    "coolrua": {
                        "coolrua drive": 10
                    },
                    "coultry": {
                        "coultry drive": 5
                    },
                }
            },
            "tall": {
                "gardens": {
                    "temple": {
                        "temple gardens": 20
                    }
                },
                "bramblings": {
                    "the": {
                        "the bramblings": 20
                    }
                },
            }
        }
                
The "short tree" street names in this example are: and the "tall tree" street names are:

Your task

Write a program that takes these files and outputs the average cost of a property:

We might want to run this program as part of some larger system, so your code should not require any user input or any user interaction once it starts.

We recommend you write your answer in the language you're most comfortable working in. You can use open source libraries, tools in the standard library, search Google, StackOverflow, etc. -- anything you might do in a real day-to-day production programming task.

We'd like:

Please package your code in a single zip file.
If you have any questions, please let us know.

Recommended reading

These two articles are referenced in our internal coding standards and practices wiki. They give a good idea of how we think about code. You don't have to read them, but they might help:

Original datasets

Please use the files we've supplied for this exercise, as we've tweaked them slightly to make things easier. The original datasets come from: