Planning Expert System (part 3 of 4)

I had to set aside the technical component of the expert system for two reasons. One was the traditional pursuit of a nice time outdoors under canvas in the English “summer”, the other was the creation of the system content – the expertise. I hadn’t intended saying much about it, but if I’m ever in the position of doing something similar in the future I think I’d do it quite differently.

My plan was straightforward. I asked some “subject matter experts” to donate their time, which they very kindly did. I had a good representation across different types of authority, and I also had someone from an enforcement service. They (let’s call them ‘Wade’) were extremely useful both because they had a superior appreciation of the legal context and also because there isn’t much householder nonsense that enforcement people haven’t seen before.

The regulations that we were processing have now been published and are available here. The scheduling of the day was simple – there are about 100 bits of “stuff” in the regs (a mixture of clauses, conditions, definitions etc) and a certain amount of time available – dividing one figure by the other we had about 3 minutes per bit_of_stuff:

Class

Type

tests

conditions

start

duration

finish

Class A

house

20

3

10:00

01:30

11:30

Class B

roof

7

3

11:30:00

00:40

12:10

LUNCH

12:10:00

00:45

12:55

Class C

roof (other)

4

1

12:55:00

00:20

13:15

Class D

porch

3

0

13:15:00

00:15

13:30

Class E

buildings, pools and oil

13

0

13:30:00

00:45

14:15

Class F

hard surface

0

2

14:15:00

00:15

14:30

Class G

Chimneys

3

0

14:30:00

00:15

14:45

Break (+ cakes)

14:45:00

00:15

15:00

Class h

microwave antenna

11

5

15:00:00

01:00

16:00

We met at 9:30, spent half an hour talking over the method and principles of what we were doing and got stuck in. I had previously prepared a ‘flattened’ version of the regs in excel. While the output was going to be in XML, I needed something familiar and quick to use so that I could keep up with people. The file we began with is here (expert-sys-at-beginning) – you can see that I answered the first couple of questions so people could see how it might work.

I took the role of Mr. Average, trying to ensure that the simplifications and clarifications would be understood by users of the system. After a while, we got into a groove. We tried to follow some kind of pattern – starting with the most restrictive cases and then broadening out. This is why most of the opening questions are based on whether the property is listed / in a conservation area. We would also try to group the questions – if you’re going to ask someone whether their roof has a chimney you might as well ask all the ‘chimney’ questions in one go (this also helps you ensure that you don’t ask chimney questions to people without them).

learning from the session

I can recall saying at one point how well the whole thing seemed to be going. It was not easy, but we managed to stick more or less to time and the disagreements we had remained extremely cordial. It was only when I took the material away at the end of the session to tidy it up, fix the gaps and impose a slightly tighter order on it that I sensed I might have approached it slightly differently.

We were actually trying to do two separate things together. The first was to create a tree-like logic : a path through the legislation that gets everyone an answer as quickly as possible – redundant questions are removed and the more serious questions are put up-front to shake people out the fastest. The second was to translate the regulations into the language of normal people. When I took our work and double-checked the logic I found several problems that we hadn’t noticed. I suspect part of the reason is that we were thinking of how to explain ‘curtilage’ and not whether the ordering was the most sensible.

Perhaps it would have been quicker / clearer to split these tasks up. If I’m ever fortunate enough to be involved again I will:

  • get a big roll of brown paper
  • cut up the regulations into paragraphs
  • get agreement on the logic by physcially moving around the paras – use a pen to note the questions / decision tree logic, bunch similar questions together etc.

Only when the logic is sound is it worth doing the translation job. That said, the degree of complexity in these regs is not epic and I think we coped.

from excel into XML

There are two bits worth touching on here. The first is to try and use Excel to do some of the double-checking for us. For example, we should be able to tell that all ‘nodes’ (read ‘questions’) are at least visitable. I put in the process logic as a series of cell references and used the ‘audit’ functions. Initially it seemed that only one could be done at a time, but there is a little hack. Simply put a deliberately circular reference in, and double-click the trace dependents. This traces ‘all’ dependencies for the circular reference – or all the cells in the range. It looks a bit freaky in the picture, but trust me, this helped.

excel audit process flow

excel audit process flow

Lastly, we need a way of getting the data out of excel and into the XML framework. There is much nonsense on the web about this – many people suggest using the “save as XML” and then using XLST to rejig the data to your satisfaction. Instead, concatenate is your friend.

Obviously this works only for each node – it still needs a manual top & tail but this is 95% of the hassle done in a few moments. Good stuff.
And so, on to part 4 where we get back to more technical issues – including some kind of decision on whether we’ve officially fallen out of love with xforms…
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s