Schema Creation: Suggested Web Scraping Pipeline for Comprehensive Data Collection

This basic process can be adopted by any institution with web-facing information on their collections OR offline material that can be fed into a python script. In our case, each page follows a consistent format that includes essential taxonomic, morphological, and conservation-related data. We recommend adopting this sort of precision for a myriad number of reasons, but chief among them is information integrity when it comes to vectorizing your knowledge base.

Scraping Pipeline Breakdown

This pipeline can be implemented in Python for reliability and ease of use with web data. Below is a simplified example snippet illustrating how a single page can be scraped and saved as JSON:

				
					import requests
from bs4 import BeautifulSoup
import json

# Example: Scrape a single plant page
url = "https://seedsofhawaii.org/plants/ExamplePlantSpecies"
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')

# Extract title (e.g., species name)
title = soup.find('h1').get_text(strip=True)

# Extract main text content (assuming it lies in a <div class="content">)
content_div = soup.find('div', class_='content')
text_content = content_div.get_text(separator="\n", strip=True)

# Extract all image links on the page
images = []
for img in soup.find_all('img'):
    img_url = img.get('src')
    if img_url:
        images.append(img_url)

# Extract PDF links (if any)
pdf_links = []
for link in soup.find_all('a', href=True):
    href = link['href']
    if href.lower().endswith('.pdf'):
        pdf_links.append(href)

# Extract video links (if any embedded videos, e.g., YouTube iframes)
video_links = []
for iframe in soup.find_all('iframe', src=True):
    video_links.append(iframe['src'])

# Compile the data into a structured dictionary
plant_data = {
    "title": title,
    "url": url,
    "text": text_content,
    "images": images,
    "pdf_links": pdf_links,
    "video_links": video_links
}

# Save the data to a JSON file
with open("ExamplePlantSpecies.json", "w") as f:
    json.dump(plant_data, f, indent=4)

print(f"Saved data for {title} to JSON.")

				
			

Code explanation: Fetch the HTML of a specimen page, parse it to extract relevant elements, and build a dictionary of fields. This structured data can then be saved as a JSON or txt file. In practice, the actual scraper would repeat this for all species URLs and handle nuances of the site’s HTML structure (such as different sections or additional metadata fields).

By capturing all content elements, this pipeline goes beyond basic text scraping – it preserves images, documents, and links so that nothing is lost. The resulting JSON dataset forms the backbone of the Seeds of Hawaiʻi digital collection, enabling downstream processing such as search indexing, data analysis, and integration with other databases.