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

activityinfo-sdk

v1.1.9

Published

TypeScript SDK to interact with the [ActivityInfo](https://www.activityinfo.org/) API. Includes a TypeScript interface builder that facilitates data submission to a database using a human-readable structure.

Readme

ActivityInfo-SDK npm

TypeScript SDK to interact with the ActivityInfo API. Includes a TypeScript interface builder that facilitates data submission to a database using a human-readable structure.

⬇️ Install

npm install activityinfo-sdk

🛜 Submitting an Activity Record

The SDK provides pre-built interfaces for Humanitarian Ukraine databases (2025). The example below demonstrates submitting a record to the SNFI RMM database.

You can specify a Record ID, which will appear under the same column name in ActivityInfo.

[!IMPORTANT]
Note: If a Record ID is provided, repeated submissions will update the existing record instead of creating duplicates.

Simple schema

import {AiClient} from 'activityinfo-sdk'
import {schema} from 'activityinfo-sdk/schema'

// Define an activity record
const submission: schema.ua2025.AiTypeSnfiRmm = {
  'Reporting Organization': 'Danish Refugee Council (DRC)',
  'Oblast': 'Chernihivska_Чернігівська',
  'Raion': 'Chernihivskyi_Чернігівськии',
  'Hromada': 'Chernihivska_UA2302015_Чернігівська',
  'Settlement': 'Chernihiv_UA7410039001_Чернігів',
  'Plan/Project Code': 'SNFI-DRC-001', // If using pre-generated interfaces, this property must be set manually based on your current plan codes.
  'Indicators - SNFI': 'Emergency NFI support > # reached through donation of NFIs (Invincibility Points, bomb shelters, transit centers) > in-kind',
  'Theme': 'No specific theme',
  'Reporting Month': '2025-01',
  'Population Group': 'Internally Displaced',
  'Non-individuals Reached': 10,
  'Total Individuals Reached': 20,
  'Boys (0-17)': 5,
  'Girls (0-17)': 5,
  'Adult Women (18-59)': 5,
  'Adult Men (18-59)': 5,
  'Older Women (60+)': 0,
  'Older Men (60+)': 0,
  'People with disability': 2,
  'Outside HNRP Scope sub-category': 'Outside priority areas',
}

// Convert the submission into a request format compatible with the ActivityInfo API
const request = schema.ua2025.AiTypeSnfiRmm.buildRequest(submission, 'mycustomid002')

// Initialize the client to interact with API
const client = new AiClient('<YOUR_ACTIVITYINFO_TOKEN>')

// Submit the record to ActivityInfo
await client.submit(request)

Nested schema

import {AiClient} from 'activityinfo-sdk'
import {schema} from 'activityinfo-sdk/schema'

// Define an activity record
const data: schema.ua2025.AiTypeProtectionRmm = {
  'Reporting Organization': 'Danish Refugee Council (DRC)',
  'Plan/Project Code': 'DRC-PROT-001' as '',
  'Oblast': 'Chernihivska_Чернігівська',
  'Raion': 'Chernihivskyi_Чернігівськии',
  'Hromada': 'Chernihivska_UA2302015_Чернігівська',
  'Response Theme': 'No specific theme',
  'Activities and People': [
    {
      'Adult Men (18-59)': 0,
      'Adult Women (18-59)': 1,
      'Boys (0-17)': 2,
      'Girls (0-17)': 3,
      'Indicators': 'Advocacy - Protection > # of advocacy interventions undertaken on protection issues',
      'Non-individuals Reached/Quantity': 1,
      'Older Men (60+)': 4,
      'Older Women (60+)': 5,
      'People with Disability': 1,
      'Reporting Month': '2025-01',
      'Total Individuals Reached': 16,
      'Population Group': 'Internally Displaced',
    }, {
      'Adult Men (18-59)': 0,
      'Adult Women (18-59)': 1,
      'Boys (0-17)': 2,
      'Girls (0-17)': 3,
      'Indicators': 'Advocacy - Protection > # of advocacy interventions undertaken on protection issues',
      'Non-individuals Reached/Quantity': 1,
      'Older Men (60+)': 4,
      'Older Women (60+)': 5,
      'People with Disability': 1,
      'Reporting Month': '2025-01',
      'Total Individuals Reached': 16,
      'Population Group': 'Non-Displaced',
    },
  ],
}

// Convert the submission into a request format compatible with the ActivityInfo API
const request = schema.ua2025.AiTypeProtectionRmm.buildRequest(data, 'prot202501')

// Initialize the client to interact with API
const client = new AiClient('<YOUR_ACTIVITYINFO_TOKEN>')

// Submit the record to ActivityInfo
await client.submit(request)

Auto-complete

Since it's built in TypeScript, questions and options are autocompleted and validated by the compiler, reducing the risk of typos.

ts-autocomplete.png

⚙️ Generating a Schema

[!NOTE] The library already exports schemas from the Humanitarian Ukraine databases for 2025.

import {AiBuilder} from 'activityinfo-sdk'

const builder = new AiBuilder({
  activityInfoToken: 'TOKEN',
  outDir: './' // Directory where the generated schema will be saved
})

builder.generateInterface({
  // The form ID is extracted from the URL of the form in ActivityInfo.
  // Example URL: https://www.activityinfo.org/app#form/cmasgbem5w7pgf02/display/c4l7nlem74zbq7erg
  formId: 'c4l7nlem74zbq7erg',

  // Some forms contain multiple questions with the same label but different meanings.  
  // To avoid conflicts in the generated interface, use question codes instead of labels.  
  useQuestionCode: true,
  
  // Optional settings to customize how specific questions are handled
  questionSettings: {
    'Raion': {
      // If true, this question will be excluded from the generated schema
      skip: false,

      // If true, an autocomplete question will be treated as a free-text input
      skipChoices: false,

      // Filters choices; only options containing "DRC" will be included
      filterChoices: _ => _.includes('DRC'),

      // For multi-input questions, specify which input labels to include in the generated choices
      selectColumnByLabels: ['SNFI Activity', 'SNFI Indicator'],
    }
  }
})

🖥️ API Client

The SDK provides a client for interacting with various API endpoints.

import {AiClient} from 'activityinfo-sdk'
const client = new AiClient('<YOUR_ACTIVITYINFO_TOKEN>')
client...