Open cew821 opened 10 years ago
SDGE links work slightly differently. Whereas in the sample file from the DOE you sent me, you can find a related link by look for '//link[@rel="up" and @href="#{related_href}"]', San Diego you have to look for any links that start with the related_href and end with '/\d+'. I've put in a hook to look for alternative links: https://github.com/ArbolEric/greenbutton/blob/master/lib/gb_classes.rb#L68. The test still pass for the DOE file you sent me as well as the SDGE files I have.
I can send you another pull request, but this might feel like duck tape for a small problem just associated with SDGE and other utilities may have small idiosyncrasies of their own... That's why I'm thinking it may be worth having a configuration file for users to add xpaths and blocks to find related entries. Maybe that's overkill?
Let's wait to see if more utility-specific issues pop up, as that will hopefully help guide any configuration strategy.
Is there a good way to tell which utility is providing the file from the XML itself? i.e. by a data_custodian id or something?
As mentioned by @ArbolEric, some utilities may have implemented the Green Button standard differently, such that the parser may need separate instructions to parse their file. Let's discuss any problems with parsing different implementations in this thread.