# WolframAlpha Selective SubPod Content

I am sending queries to Wolfram | Alpha from Mathematica V9 and and importing the results back into Mathematica, but I am running into a challenge in formatting the request. Specifically, I would like a listing of all of the departing flights from LAX for the current day and, then, I want to select only those flights using Airbus A380 aircraft (there should be about 5 per day).

When I query for LAX departures it returns a subpod of the 680+/- departures for the current 24 hour window, but I am not able to retrieve the aircraft type. If I search for a specific flight, such as "American Airlines flight 1867", Wolfram | Alpha returns a subpod with the aircraft/equipment details. I checked Wolfram | Alpha's sources; both queries are going to the FAA ASDI database, so the data should be available. Any suggestions?

One other question: The subpod of LAX departures displays five results, but indicates 680 or so results are returned. Is there a way in Mathematica to tell Wolfram | Alpha to return all results without having to code "More" repeatedly? See the PodStates option below in the code.

WolframAlpha["Flights departing LAX",
{{"FlightsBetween:Scheduled:From:FlightData", 1}, "Content"},
PodStates ->
{"FlightsBetween:Scheduled:From:FlightData__More",
"FlightsBetween:Scheduled:From:FlightData__More",
"FlightsBetween:Scheduled:From:FlightData__More"}]

-
You could try playing around with PodStates->{"n@FlightsBetween:Scheduled:From:FlightData__More"} where n is some number, I tried setting it to something crazy high but the request just timed out. Found in Pod States section EDIT: The time it takes seems to scale linearly with n :( –  ssch Feb 24 '13 at 14:58

Well, let's look at the limited good news first. While I don't believe there's any way to specify a single simple parameter indicating that you want to return all the data available, it is possible to programatically specify the number of pushes that you want using Table["More ...",{k}]. Typically, you can simulate lots of pushes and the output will be automatically truncated at the maximum number of pushes that the API allows. For example, you can push the "More digits" button up to six times when asking for an approximation to Pi. If you ask for more, the result is as if you asked for just six pushes.

Column[Table[{Row[{"number of pushes", " == ", k}],
Length[First[RealDigits[WolframAlpha["pi",
{{"DecimalApproximation", 1}, "ComputableData"},
"PodStates" -> Table["More digits", {k}]]]]]}, {k, 0, 10}]]


Also, note that I specified that I wanted the output returned as "ComputableData"; that way the result is returned in an accessible format, as opposed to as a WolframAlpha pod. Putting this all together, we can obtain a fair amount of your flight information as follows.

flightInfo = WolframAlpha["Flights departing LAX",
{{"FlightsBetween:Scheduled:From:FlightData", 1}, "ComputableData"},
"PodStates" -> Table["More", {6}]];


Since we asked for "ComputableData", we can further search this for flights headed to Chicago O'Hare. (Of course, this could also be accomplished using a better query.)

Select[flightInfo, StringMatchQ[#[[2]], __ ~~ "(KORD)" ~~ __] &]

(* Out: {
{"China Cargo Airline flight 227",
"estimated to depart for Chicago O'Hare  (KORD) at 8:10 am EST (today)"},
{"United Airlines flight 1215",
"estimated to depart for Chicago O'Hare  (KORD) at 10:08 am EST (today)"},
{"American Airlines flight 1636",
"estimated to depart for Chicago O'Hare  (KORD) at 10:40 am EST (today)"}}
*)


Unfortunately, the command times out when we attempt to "push" the button more than six times and the "TimeConstraint" option doesn't seem to help. Also, there appears to be no way to access the aircraft type information that you want. Even though the data source provides it, Alpha still needs to be programmed to access it. You might consider leaving a comment.

-
Thanks for the help. I have noticed in other postings that this is a common problem. I think perhaps people want to use the WA link in M9 a bit more intensively than Wolfram are prepared to allow. –  Nguyen Van Falk Mar 12 '13 at 3:32