npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@soildoctor/soil-report-generator

v1.0.0

Published

A React component for generating and downloading multilingual soil analysis PDF reports

Readme

Soil Report Generator

A React component package for generating and downloading multilingual soil analysis PDF reports.

Installation

npm install soil-report-generator

Usage

import React from 'react';
import { SoilReportDownloadButton } from 'soil-report-generator';

const MyApp = () => {
  // Your API response data
  const apiResponse = {
    report: {
      name: "John Doe",
      mobile_no: "1234567890",
      address: "Farm Address",
      city: "City Name",
      state: "State",
      village: "Village",
      farm_size: "2.5",
      farm_size_unit: "Acres",
      previous_crop: "Wheat",
      next_crop: "Rice",
      sample_code: "S0001234",
      collection_date: "2024-01-15",
      ph: "7.2",
      ec: "0.5",
      oc: "0.6",
      nitrogen: "280",
      phosphorus: "45",
      potassium: "180"
    },
    recommData: {
      recommendation: {
        recommendations: [
          {
            order: 1,
            orderName: {
              english: "Before Sowing",
              hindi: "बुवाई से पहले"
            },
            prescription: [
              {
                input: {
                  english: "Farm Yard Manure",
                  hindi: "गोबर की खाद"
                },
                perSessionDose: "500",
                unit: {
                  english: "kg/acre",
                  hindi: "किलोग्राम/एकड़"
                },
                method: {
                  english: "Apply in soil",
                  hindi: "मिट्टी में डालें"
                }
              }
            ]
          }
        ]
      }
    }
  };

  return (
    <div>
      <h1>My Agricultural App</h1>
      
      {/* Simple usage */}
      <SoilReportDownloadButton 
        apiResponse={apiResponse}
        language="english"
      />

      {/* With custom styling and callbacks */}
      <SoilReportDownloadButton 
        apiResponse={apiResponse}
        language="hindi"
        buttonText="मृदा रिपोर्ट डाउनलोड करें"
        buttonStyle={{
          backgroundColor: '#16a34a',
          padding: '15px 30px',
          fontSize: '16px'
        }}
        logoUrl="/my-company-logo.png"
        entityName="My Agriculture Company"
        onDownloadStart={() => console.log('Download started')}
        onDownloadComplete={() => console.log('Download completed')}
      />
    </div>
  );
};

export default MyApp;

Props

| Prop | Type | Required | Default | Description | |------|------|----------|---------|-------------| | apiResponse | Object | ✅ | - | API response containing report and recommendation data | | language | String | ❌ | 'english' | Report language ('english', 'hindi', 'tamil', 'telugu', 'marathi', 'punjabi') | | cropTips | Object | ❌ | null | Crop-specific tips data | | buttonText | String | ❌ | Auto-generated | Custom button text | | buttonStyle | Object | ❌ | Default styling | Custom button CSS styles | | logoUrl | String | ❌ | '' | Logo URL for the report header | | entityName | String | ❌ | '' | Organization name for the report | | onDownloadStart | Function | ❌ | - | Callback when download starts | | onDownloadComplete | Function | ❌ | - | Callback when download completes | | className | String | ❌ | '' | CSS class for the button |

API Response Format

Required Report Data Structure

{
  report: {
    name: "Farmer Name",                    // Required
    mobile_no: "1234567890",               // Optional
    address: "Farm Address",               // Optional
    city: "City",                          // Optional
    state: "State",                        // Optional
    village: "Village",                    // Optional
    farm_size: "2.5",                      // Optional
    farm_size_unit: "Acres",               // Optional
    previous_crop: "Wheat",                // Optional
    next_crop: "Rice",                     // Optional
    sample_code: "S0001234",               // Required for filename
    collection_date: "2024-01-15",         // Optional
    ph: "7.2",                             // Soil parameters
    ec: "0.5",
    oc: "0.6",
    nitrogen: "280",
    phosphorus: "45",
    potassium: "180"
  },
  recommData: {                            // Optional
    recommendation: {
      recommendations: [
        {
          order: 1,
          orderName: {
            english: "Growth Stage",
            hindi: "विकास चरण"
          },
          prescription: [
            {
              input: {
                english: "Fertilizer Name",
                hindi: "उर्वरक नाम"
              },
              perSessionDose: "100",
              unit: {
                english: "kg/acre",
                hindi: "किलोग्राम/एकड़"
              },
              method: {
                english: "Application method",
                hindi: "प्रयोग विधि"
              }
            }
          ]
        }
      ]
    }
  }
}

Supported Languages

  • English ('english')
  • Hindi ('hindi') - हिंदी
  • Tamil ('tamil') - தமிழ்
  • Telugu ('telugu') - తెలుగు
  • Marathi ('marathi') - मराठी
  • Punjabi ('punjabi') - ਪੰਜਾਬੀ

Features

  • Zero Configuration: Works out of the box
  • Multilingual Support: 6 languages supported
  • Professional PDF Layout: Clean, readable reports
  • Automatic Filename: Uses sample code for naming
  • Customizable Styling: Full control over button appearance
  • Type Safety: Proper error handling for missing data
  • Lightweight: Minimal bundle size
  • Responsive: Works on all devices

PDF Report Structure

The generated PDF includes:

  1. Page 1: Soil Analysis Parameters
    • Farmer information
    • Soil parameter table with status indicators
  2. Page 2: Fertilizer Recommendations (if available)
    • Stage-wise fertilizer application guide
  3. Page 3: Crop Tips (if provided)
    • Best practices for crop cultivation

Browser Compatibility

  • Chrome/Edge: ✅ Full support
  • Firefox: ✅ Full support
  • Safari: ✅ Full support
  • Mobile browsers: ✅ Full support

Error Handling

The component gracefully handles:

  • Missing or invalid API response data
  • Network issues during PDF generation
  • Unsupported languages (falls back to English)

Development

# Clone the repository
git clone <repository-url>

# Install dependencies
npm install

# Build the package
npm run build

# Run in development mode
npm run dev

License

MIT

Support

For issues and questions, please open an issue on GitHub or contact [[email protected]].


Made with ❤️ for the agricultural community