Open rripken opened 2 years ago
I issued the following request against the getAll ratings end-point: http://localhost:7000/swt-data/ratings?name=BUFF.Stage%3BFlow.WCDS.Production&office=SWT&unit=EN&at=2012-06-20T19%3A59%3A14Z&format=xml
The response embeds ratings-points as a block of text and doesn't parse thru RatingSet.fromXml. If I issue an equivalent request to the ratings getOne end-point I get xml back that does parse thru RatingSet.fromXml.
Here is the response I got.
<ratings> <query-info> <time-of-query>2022-06-21T20:04:51Z</time-of-query> <process-query>PT0.432S</process-query> <format-output>PT0.207S</format-output> <requested-format>XML</requested-format> <requested-office>SWT</requested-office> <requested-start-time>2012-06-20T19:59:14Z</requested-start-time> <requested-end-time>2022-06-21T20:04:51Z</requested-end-time> <requested-item> <name>BUFF.Stage;Flow.WCDS.Production</name> <unit>EN</unit> <datum>NATIVE</datum> </requested-item> <templates-retrieved>1</templates-retrieved> <total-specifications-retrieved>1</total-specifications-retrieved> <unique-specifications-retrieved>1</unique-specifications-retrieved> <total-ratings-retrieved>1</total-ratings-retrieved> <unique-ratings-retrieved>1</unique-ratings-retrieved> </query-info> <rating-template office="SWT"> <name>Stage;Flow.WCDS</name> <parameters>Stage;Flow</parameters> <version>WCDS</version> <ind-parameter position="1"> <name>Stage</name> <value-lookup-in-range>LINEAR</value-lookup-in-range> <value-lookup-below-range>NULL</value-lookup-below-range> <value-lookup-above-range>NULL</value-lookup-above-range> </ind-parameter> <dep-parameter>Flow</dep-parameter> <version>WCDS</version> </rating-template> <rating-spec office="SWT"> <name>BUFF.Stage;Flow.WCDS.Production</name> <template>Stage;Flow.WCDS</template> <location>BUFF</location> <source-agency/> <time-lookup-in-range>LINEAR</time-lookup-in-range> <time-lookup-before-first>NEAREST</time-lookup-before-first> <time-lookup-after-last>NEAREST</time-lookup-after-last> <ind-rounding-spec position="1">4444444444</ind-rounding-spec> <dep-rounding-spec>4444444444</dep-rounding-spec> <description/> </rating-spec> <simple-rating office="SWT"> <rating-spec>BUFF.Stage;Flow.WCDS.Production</rating-spec> <ind-parameter position="1" units="ft">Stage</ind-parameter> <dep-parameter units="cfs">Flow</dep-parameter> <effective-date>1970-01-01T00:00:00Z</effective-date> <description/> <rating-points>3 0 3.0999999 .000499999 3.20000005 .001 3.29999995 .100000001 3.4000001 .620999992 3.5 2.11899996 3.5999999 5.38999987 3.70000005 10.4899998 3.79999995 18.1100006 3.9000001 27.7600002 4 38.6100006 4.0999999 48.9500008 4.19999981 63 4.30000019 77.6800003 4.4000001 95.6200027 4.5 115.099998 4.5999999 137.100006 4.69999981 161.5 4.80000019 188.399994 4.9000001 215.5 5 246.699997 5.0999999 282 5.19999981 318.899994 5.30000019 359.399994 5.4000001 403.100006 5.5 449.200012 5.5999999 496 5.69999981 546.400024 5.80000019 602.400024 5.9000001 661 6 724 6.0999999 789.700012 6.19999981 859.200012 6.30000019 932.299988 6.4000001 1005 6.5 1084 6.5999999 1166 6.69999981 1260 6.80000019 1360 6.9000001 1470 7 1581 7.0999999 1692 7.19999981 1809 7.30000019 1947 7.4000001 2092 7.5 2243 7.5999999 2398 7.69999981 2572 7.80000019 2790 7.9000001 2991 8 3204 8.10000038 3439 8.19999981 3705 8.30000019 3983 8.39999962 4279 8.5 4587 8.60000038 4960 8.69999981 5340 8.80000019 5734 8.89999962 6200 9 6736 9.10000038 7328 9.19999981 7922 9.30000019 8566 9.39999962 9334 9.5 10120 9.60000038 10900 9.69999981 11797 9.80000019 12879 9.89999962 14291 10 15667 10.1000004 17112 10.1999998 18689 10.3000002 20588 10.3999996 22858 10.5 25300 10.6000004 27979 10.6999998 30925 10.8000002 34175 10.8999996 37636 11 41413 11.1000004 45503 11.1999998 49954 11.3000002 54780 11.3999996 60005 11.5 65658 11.6000004 71767 11.6999998 78365 11.8000002 85483 11.8999996 93156 12 101420 12.1000004 110314 12.1999998 119878 12.3000002 130153 12.3999996 141185 12.5 153021 12.6000004 165709 12.6999998 179301 12.8000002 193851 12.8999996 209415 </rating-points> </simple-rating> </ratings>
The basically equivalent getOne style request: curl -X 'GET' \ 'http://localhost:7000/swt-data/ratings/BUFF.Stage%3BFlow.WCDS.Production?office=SWT' \ -H 'accept: application/xml;version=2'
returns
<?xml version="1.0" encoding="utf-8"?> <ratings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.hec.usace.army.mil/xmlSchema/cwms/Ratings.xsd"> <rating-template office-id="SWT"> <parameters-id>Stage;Flow</parameters-id> <version>WCDS</version> <ind-parameter-specs> <ind-parameter-spec position="1"> <parameter>Stage</parameter> <in-range-method>LINEAR</in-range-method> <out-range-low-method>NULL</out-range-low-method> <out-range-high-method>NULL</out-range-high-method> </ind-parameter-spec> </ind-parameter-specs> <dep-parameter>Flow</dep-parameter> <description></description> </rating-template> <rating-spec office-id="SWT"> <rating-spec-id>BUFF.Stage;Flow.WCDS.Production</rating-spec-id> <template-id>Stage;Flow.WCDS</template-id> <location-id>BUFF</location-id> <version>Production</version> <source-agency/> <in-range-method>LINEAR</in-range-method> <out-range-low-method>NEAREST</out-range-low-method> <out-range-high-method>NEAREST</out-range-high-method> <active>true</active> <auto-update>true</auto-update> <auto-activate>true</auto-activate> <auto-migrate-extension>true</auto-migrate-extension> <ind-rounding-specs> <ind-rounding-spec position="1">4444444444</ind-rounding-spec> </ind-rounding-specs> <dep-rounding-spec>4444444444</dep-rounding-spec> <description/> </rating-spec> <simple-rating office-id="SWT"> <rating-spec-id>BUFF.Stage;Flow.WCDS.Production</rating-spec-id> <units-id>ft;cfs</units-id> <effective-date>1970-01-01T00:00:00Z</effective-date> <transition-start-date/> <create-date>2014-12-12T13:49:00Z</create-date> <active>true</active> <description/> <rating-points> <point> <ind>3.0</ind> <dep>0.0</dep> </point> <point> <ind>3.0999999</ind> <dep>4.99999E-4</dep> </point> <point> <ind>3.20000005</ind> <dep>0.001</dep> </point> <point> <ind>3.29999995</ind> <dep>0.100000001</dep> </point> <point> <ind>3.4000001</ind> <dep>0.620999992</dep> </point> <point> <ind>3.5</ind> <dep>2.11899996</dep> </point> <point> <ind>3.5999999</ind> <dep>5.38999987</dep> </point> <point> <ind>3.70000005</ind> <dep>10.4899998</dep> </point> <point> <ind>3.79999995</ind> <dep>18.1100006</dep> </point> <point> <ind>3.9000001</ind> <dep>27.7600002</dep> </point> <point> <ind>4.0</ind> <dep>38.6100006</dep> </point> <point> <ind>4.0999999</ind> <dep>48.9500008</dep> </point> <point> <ind>4.19999981</ind> <dep>63.0</dep> </point> <point> <ind>4.30000019</ind> <dep>77.6800003</dep> </point> <point> <ind>4.4000001</ind> <dep>95.6200027</dep> </point> <point> <ind>4.5</ind> <dep>115.099998</dep> </point> <point> <ind>4.5999999</ind> <dep>137.100006</dep> </point> <point> <ind>4.69999981</ind> <dep>161.5</dep> </point> <point> <ind>4.80000019</ind> <dep>188.399994</dep> </point> <point> <ind>4.9000001</ind> <dep>215.5</dep> </point> <point> <ind>5.0</ind> <dep>246.699997</dep> </point> <point> <ind>5.0999999</ind> <dep>282.0</dep> </point> <point> <ind>5.19999981</ind> <dep>318.899994</dep> </point> <point> <ind>5.30000019</ind> <dep>359.399994</dep> </point> <point> <ind>5.4000001</ind> <dep>403.100006</dep> </point> <point> <ind>5.5</ind> <dep>449.200012</dep> </point> <point> <ind>5.5999999</ind> <dep>496.0</dep> </point> <point> <ind>5.69999981</ind> <dep>546.400024</dep> </point> <point> <ind>5.80000019</ind> <dep>602.400024</dep> </point> <point> <ind>5.9000001</ind> <dep>661.0</dep> </point> <point> <ind>6.0</ind> <dep>724.0</dep> </point> <point> <ind>6.0999999</ind> <dep>789.700012</dep> </point> <point> <ind>6.19999981</ind> <dep>859.200012</dep> </point> <point> <ind>6.30000019</ind> <dep>932.299988</dep> </point> <point> <ind>6.4000001</ind> <dep>1005.0</dep> </point> <point> <ind>6.5</ind> <dep>1084.0</dep> </point> <point> <ind>6.5999999</ind> <dep>1166.0</dep> </point> <point> <ind>6.69999981</ind> <dep>1260.0</dep> </point> <point> <ind>6.80000019</ind> <dep>1360.0</dep> </point> <point> <ind>6.9000001</ind> <dep>1470.0</dep> </point> <point> <ind>7.0</ind> <dep>1581.0</dep> </point> <point> <ind>7.0999999</ind> <dep>1692.0</dep> </point> <point> <ind>7.19999981</ind> <dep>1809.0</dep> </point> <point> <ind>7.30000019</ind> <dep>1947.0</dep> </point> <point> <ind>7.4000001</ind> <dep>2092.0</dep> </point> <point> <ind>7.5</ind> <dep>2243.0</dep> </point> <point> <ind>7.5999999</ind> <dep>2398.0</dep> </point> <point> <ind>7.69999981</ind> <dep>2572.0</dep> </point> <point> <ind>7.80000019</ind> <dep>2790.0</dep> </point> <point> <ind>7.9000001</ind> <dep>2991.0</dep> </point> <point> <ind>8.0</ind> <dep>3204.0</dep> </point> <point> <ind>8.10000038</ind> <dep>3439.0</dep> </point> <point> <ind>8.19999981</ind> <dep>3705.0</dep> </point> <point> <ind>8.30000019</ind> <dep>3983.0</dep> </point> <point> <ind>8.39999962</ind> <dep>4279.0</dep> </point> <point> <ind>8.5</ind> <dep>4587.0</dep> </point> <point> <ind>8.60000038</ind> <dep>4960.0</dep> </point> <point> <ind>8.69999981</ind> <dep>5340.0</dep> </point> <point> <ind>8.80000019</ind> <dep>5734.0</dep> </point> <point> <ind>8.89999962</ind> <dep>6200.0</dep> </point> <point> <ind>9.0</ind> <dep>6736.0</dep> </point> <point> <ind>9.10000038</ind> <dep>7328.0</dep> </point> <point> <ind>9.19999981</ind> <dep>7922.0</dep> </point> <point> <ind>9.30000019</ind> <dep>8566.0</dep> </point> <point> <ind>9.39999962</ind> <dep>9334.0</dep> </point> <point> <ind>9.5</ind> <dep>10120.0</dep> </point> <point> <ind>9.60000038</ind> <dep>10900.0</dep> </point> <point> <ind>9.69999981</ind> <dep>11797.0</dep> </point> <point> <ind>9.80000019</ind> <dep>12879.0</dep> </point> <point> <ind>9.89999962</ind> <dep>14291.0</dep> </point> <point> <ind>10.0</ind> <dep>15667.0</dep> </point> <point> <ind>10.1000004</ind> <dep>17112.0</dep> </point> <point> <ind>10.1999998</ind> <dep>18689.0</dep> </point> <point> <ind>10.3000002</ind> <dep>20588.0</dep> </point> <point> <ind>10.3999996</ind> <dep>22858.0</dep> </point> <point> <ind>10.5</ind> <dep>25300.0</dep> </point> <point> <ind>10.6000004</ind> <dep>27979.0</dep> </point> <point> <ind>10.6999998</ind> <dep>30925.0</dep> </point> <point> <ind>10.8000002</ind> <dep>34175.0</dep> </point> <point> <ind>10.8999996</ind> <dep>37636.0</dep> </point> <point> <ind>11.0</ind> <dep>41413.0</dep> </point> <point> <ind>11.1000004</ind> <dep>45503.0</dep> </point> <point> <ind>11.1999998</ind> <dep>49954.0</dep> </point> <point> <ind>11.3000002</ind> <dep>54780.0</dep> </point> <point> <ind>11.3999996</ind> <dep>60005.0</dep> </point> <point> <ind>11.5</ind> <dep>65658.0</dep> </point> <point> <ind>11.6000004</ind> <dep>71767.0</dep> </point> <point> <ind>11.6999998</ind> <dep>78365.0</dep> </point> <point> <ind>11.8000002</ind> <dep>85483.0</dep> </point> <point> <ind>11.8999996</ind> <dep>93156.0</dep> </point> <point> <ind>12.0</ind> <dep>101420.0</dep> </point> <point> <ind>12.1000004</ind> <dep>110314.0</dep> </point> <point> <ind>12.1999998</ind> <dep>119878.0</dep> </point> <point> <ind>12.3000002</ind> <dep>130153.0</dep> </point> <point> <ind>12.3999996</ind> <dep>141185.0</dep> </point> <point> <ind>12.5</ind> <dep>153021.0</dep> </point> <point> <ind>12.6000004</ind> <dep>165709.0</dep> </point> <point> <ind>12.6999998</ind> <dep>179301.0</dep> </point> <point> <ind>12.8000002</ind> <dep>193851.0</dep> </point> <point> <ind>12.8999996</ind> <dep>209415.0</dep> </point> </rating-points> </simple-rating> </ratings>
I think that format is encoded in the PSQL, I don't think we want to bother fixing it. Perhaps we can use the ratings library to generate the XML now?
I issued the following request against the getAll ratings end-point: http://localhost:7000/swt-data/ratings?name=BUFF.Stage%3BFlow.WCDS.Production&office=SWT&unit=EN&at=2012-06-20T19%3A59%3A14Z&format=xml
The response embeds ratings-points as a block of text and doesn't parse thru RatingSet.fromXml. If I issue an equivalent request to the ratings getOne end-point I get xml back that does parse thru RatingSet.fromXml.
Here is the response I got.
The basically equivalent getOne style request: curl -X 'GET' \ 'http://localhost:7000/swt-data/ratings/BUFF.Stage%3BFlow.WCDS.Production?office=SWT' \ -H 'accept: application/xml;version=2'
returns