mtilda / techtrans-bot

A Twitch bot that tells you about cool inventions by pulling data from NASA's Technology Transfer API
MIT License
0 stars 0 forks source link

Fetch data from TechTransfer API #9

Closed mtilda closed 3 years ago

mtilda commented 3 years ago

Add method to TechTransfer structure to fetch data from NASA's TechTransfer API.

Package and store this data in structure fields.

Example data: https://api.nasa.gov/techtransfer/patent/?engine&api_key=DEMO_KEY

{
  "results": [
    [
      "5bcafde29600021147742e3a",
      "LEW-TOPS-125",
      "Aircraft <span class=\"highlight\">Engine</span> Icing Event Avoidance and Mitigation",
      "Innovators at NASA's Glenn Research Center have developed a new means of avoiding and mitigating icing events for aircraft flying above 14,000 feet, dramatically improving aviation safety and reducing operating costs. Often undetectable with current radar, ice crystals in convective storm cells can produce a phenomenon referred to as \"Ice Crystal Icing,\" in which ice accumulates, or accretes, in turbofan engines. Ice-crystal accretion can cause serious <span class=\"highlight\">engine</span> operational problems and sometimes even catastrophic <span class=\"highlight\">engine</span> failures. Using a combination of sensors, <span class=\"highlight\">engine</span> system modeling, and compressor flow analysis code, Glenn's innovation performs real-time analysis to determine the potential of ice accretion. This analysis allows pilots to avoid potential icing while using a more direct route than would otherwise be possible. Thus, Glenn's system reduces fuel consumption and <span class=\"highlight\">engine</span> wear while fulfilling the crucial objective of increasing aircraft safety.",
      "LEW-TOPS-125",
      "aerospace",
      "",
      "",
      "",
      "GRC",
      "https://technology.nasa.gov/t2media/tops/img/LEW-TOPS-125/iStock-157730835_LEW-19309-1_airplane-storm_1388x1050-300dpi.jpg",
      "",
      15.246385
    ],
    ...
  ],
  "count": 54,
  "total": 54,
  "perpage": 10,
  "page": 0
}
mtilda commented 3 years ago

Terrible use of arrays instead of objects in this data.

Looks like each element of the "results" array follows this pattern: Index Meaning
0 ID (database primary key)
1 Reference Number
2 Title
3 Reference Number (same as above)
4 Category
8 Agency Acronym
9 Image URL
11 Sorting Value*

Array positions containing only empty strings were omitted

*At first I thought this was the patent number, but it does not seem to correlate to that at all. The only consistent meaning I can see is that it is used to sort the results array in descending order.