@lineai/municipal-intel
Version:
AI-first municipal data API providing natural language descriptions of building permits and planning applications from major US cities
170 lines (169 loc) • 4.11 kB
TypeScript
/**
* Core types for municipal projects (permits, planning applications, etc.)
*/
import { z } from 'zod';
/**
* Known municipality IDs - strongly typed for built-in municipalities
*/
export type KnownMunicipalityId = 'sf' | 'nyc' | 'la';
/**
* Valid search filter parameters
*/
export type ValidSearchFilter = 'minValue' | 'maxValue' | 'submitDateFrom' | 'submitDateTo' | 'approvalDateFrom' | 'approvalDateTo' | 'statuses' | 'addresses' | 'zipCodes' | 'keywords';
/**
* Valid sort field options
*/
export type ValidSortField = 'submitDate' | 'approvalDate' | 'value' | 'address';
/**
* Valid field data types
*/
export type ValidFieldType = 'string' | 'number' | 'date';
/**
* Type of municipal project
*/
export type ProjectType = 'permit' | 'planning' | 'construction' | 'renovation' | 'demolition';
/**
* Status of a municipal project
*/
export type ProjectStatus = 'pending' | 'under_review' | 'approved' | 'issued' | 'active' | 'completed' | 'expired' | 'cancelled' | 'on_hold';
/**
* Document associated with a project
*/
export interface ProjectDocument {
name: string;
url: string;
type?: string;
size?: number;
uploadDate?: Date;
}
/**
* Geographic coordinates
*/
export interface Coordinates {
lat: number;
lng: number;
}
/**
* Simplified municipal project interface optimized for AI consumption
*/
export interface MunicipalProject {
id: string;
source: string;
description: string;
url: string;
rawData: any;
lastUpdated: Date;
}
/**
* Search parameters for municipal projects
*/
export interface MunicipalSearchParams {
municipalityId?: KnownMunicipalityId;
datasetId?: string;
addresses?: string[];
zipCodes?: string[];
types?: ProjectType[];
statuses?: ProjectStatus[];
keywords?: string[];
submitDateFrom?: Date;
submitDateTo?: Date;
approvalDateFrom?: Date;
approvalDateTo?: Date;
minValue?: number;
maxValue?: number;
limit?: number;
offset?: number;
sortBy?: 'submitDate' | 'approvalDate' | 'value' | 'address';
sortOrder?: 'asc' | 'desc';
}
/**
* Municipality information for discovery
*/
export interface MunicipalityInfo {
id: KnownMunicipalityId;
name: string;
state: string;
datasets: Array<{
id: string;
name: string;
}>;
}
/**
* Search capabilities for a municipality
*/
export interface SearchCapabilities {
supportedFilters: ValidSearchFilter[];
supportedSorts: ValidSortField[];
limitations?: string[];
}
/**
* Field schema information
*/
export interface FieldSchema {
name: string;
type: ValidFieldType;
searchable: boolean;
description?: string;
}
/**
* Response from municipal search
*/
export interface MunicipalSearchResponse {
projects: MunicipalProject[];
total: number;
page: number;
pageSize: number;
hasMore: boolean;
adjustments: string[];
}
/**
* Zod schemas for validation
*/
export declare const CoordinatesSchema: z.ZodObject<{
lat: z.ZodNumber;
lng: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
lat: number;
lng: number;
}, {
lat: number;
lng: number;
}>;
export declare const ProjectDocumentSchema: z.ZodObject<{
name: z.ZodString;
url: z.ZodString;
type: z.ZodOptional<z.ZodString>;
size: z.ZodOptional<z.ZodNumber>;
uploadDate: z.ZodOptional<z.ZodDate>;
}, "strip", z.ZodTypeAny, {
name: string;
url: string;
type?: string | undefined;
size?: number | undefined;
uploadDate?: Date | undefined;
}, {
name: string;
url: string;
type?: string | undefined;
size?: number | undefined;
uploadDate?: Date | undefined;
}>;
export declare const MunicipalProjectSchema: z.ZodObject<{
id: z.ZodString;
source: z.ZodString;
description: z.ZodString;
rawData: z.ZodAny;
lastUpdated: z.ZodDate;
}, "strip", z.ZodTypeAny, {
id: string;
source: string;
description: string;
lastUpdated: Date;
rawData?: any;
}, {
id: string;
source: string;
description: string;
lastUpdated: Date;
rawData?: any;
}>;