|
Oyster Harvest Area Closure Analysis 0.1
Prediction and analysis of NSW oyster harvest area closures.
|
#include "FoodAuthority/harvest_area.h"Functions | |
| static void | FA_FindHTMLValue (char *data, const char *search_term, char *value) |
| Find value with HTML tags. More... | |
| CURLcode | FA_GetHarvestAreaStatus (const char *harvest_name, FA_HarvestArea_TypeDef *harvest_area) |
| Harvest area of interest status information. More... | |
| void | FA_ParseResponse (char *data, FA_HarvestArea_TypeDef *harvest_area) |
| Parse HTML data to populate status information data. More... | |
|
static |
Find value with HTML tags.
Extracts the value (item between HTML tags) from a HTML tag.
This function takes a search term that is unique to a particular HTML tag and searchers for the tags value. The value is then added to a provided char* (value) and returns.
| data | |
| search_term | |
| value |
| CURLcode FA_GetHarvestAreaStatus | ( | const char * | harvest_name, |
| FA_HarvestArea_TypeDef * | harvest_area | ||
| ) |
Harvest area of interest status information.
Gets harvest area status information from NSW Food Authority.
NSW Food Authority provides a JSON response with XML data as values. The XML data basically contains generic cards that are used on the NSW FA website. This function parses out the relevent XML data and used helper functions to pull out a struct containing relevent data.
The havest area names for Batemans Bay are as follow:
Other harvest areas can be checked using this function (just need to know their name and use it as the harvest_name variable.
| harvest_name | Name of harvest area. |
| harvest_area | Harvest area struct to populate with status information. |
| void FA_ParseResponse | ( | char * | data, |
| FA_HarvestArea_TypeDef * | harvest_area | ||
| ) |
Parse HTML data to populate status information data.
Takes a character array containing HTML data and formats a struct containing relevent harvest area status information.
Search terms are taken from the HTML input and the corresponding values (i.e. the text between relevent tags) are added to the corresponding struct.
| data | The string to parse. |
| harvest_area | The struct to populate with values. |
Convert time to tm struct