All articles

From City Data to Useful Alerts

Designing a property-monitoring pipeline with Node.js and PostgreSQL.

A miniature city with buildings connected to a single green notification

A property dashboard can display a thousand records and still leave its user with the same question: what changed, and what needs my attention?

I worked as a Full Stack Developer on CityWatch NYC, using Next.js, TypeScript, Node.js, PostgreSQL, AWS, and Cloudflare. That product area connects data engineering with a very practical interface problem: turning records from multiple sources into something a property team can act on.

This article proposes a reference pipeline for that problem. The goal is to preserve the meaning and freshness of source data while producing useful, traceable notifications.

Define the record’s identity before importing it

Suppose two agencies both return a record with the identifier 12345. Treating that identifier as globally unique can merge unrelated records. A more useful identity combines the source and its own record identifier.

Property identity requires similar care. Preserve official property identifiers when available, along with the source’s original address. Address normalization can help search and display, but an approximate text match should not silently establish that two records refer to the same building.

Keep the original payload alongside a normalized representation when retention and access requirements allow it. The normalized record supports the interface; the source representation helps explain how a displayed value was obtained. If a parser changes later, retained source records can also support controlled reprocessing.

Track time as several different facts

A record can contain a deadline, an upstream update time, and the time your system fetched it. These values answer different questions.

For example, sourceUpdatedAt describes what the provider reports about the record, while fetchedAt describes your own ingestion activity. A successful poll does not mean the provider refreshed every record during that poll.

Preserve date-only values as date-only values when that is what the source means. Interpret timestamps using the documented source timezone, then format them for the viewer. Introducing an arbitrary midnight timestamp can move a displayed deadline to the previous day in another timezone.

The dashboard should expose the last successful synchronization and indicate when a source is stale. An old but clearly labeled record is easier to assess than an old record presented as current.

Make ingestion repeatable

Each run should record which source it read, what range or checkpoint it covered, and whether it completed. Partial failure should leave a recoverable position rather than an ambiguous “success” entry.

For a Socrata endpoint using limit-and-offset pagination, consult that endpoint’s supported query behavior and choose a bounded page size. Socrata documents how LIMIT (opens in a new tab) and OFFSET (opens in a new tab) work together. Use deterministic ordering where supported, and remember that a changing dataset may shift between page requests. A cursor or update watermark can help when available; periodic reconciliation is still useful for corrections and deletions.

In PostgreSQL, a unique constraint over the source identity can prevent duplicate records. INSERT ... ON CONFLICT provides an atomic insert-or-update mechanism for a conflicting key. The conflict policy still needs to distinguish a newer source version from an older arrival. See the PostgreSQL INSERT reference (opens in a new tab).

Before launching notifications, import the same sample twice. The second import should leave the same business state and create no new change event.

Separate changes from repeated observations

A source record appearing in another poll is an observation. A deadline changing or a status moving to a different state may be a meaningful event.

Compare normalized business fields deliberately. Updating fetchedAt should not trigger an alert. Preserve the old and new values for the fields that do trigger one, so the interface can explain the difference.

Assign a durable identifier to each accepted change event. Include the source record identity and an event version or sequence. A fingerprint of the new value alone can be insufficient: a status might change from A to B, return to A, and later become B again. The later transition can be a legitimate new event.

This event history also creates a useful boundary between ingestion and delivery. A source parser should not need to know the text of every email template.

Commit the change before delivering its notification

Writing a changed record and sending an email are separate operations. Either can succeed while the other fails.

A transactional outbox is one way to connect them: save the business change and a delivery intent in the same database transaction, then let a worker process committed intents. Retrying delivery can still produce duplicates, so consumers need an idempotency strategy. This pattern and its duplicate-message considerations are covered in AWS’s transactional outbox guidance (opens in a new tab).

Give each delivery a distinct key based on its event, recipient, and channel. Track attempts and provider responses. If a provider accepts a message but its response is lost, a database flag alone cannot establish whether the message arrived; use provider idempotency or reconciliation where available and define the remaining uncertainty.

Make an alert explain itself

A useful notification identifies the property, describes the change, provides its relevant date, and links to details and the underlying source. Let users control which buildings and event categories they follow.

Measure the pipeline with operational signals: the age of the last successful import, failed parsing counts, pending deliveries, and repeated delivery attempts. These signals tell a team when the product’s information may be incomplete.

The final test is a user-facing one. Pick a notification and trace it back through the change event, normalized record, and source. When that path is clear, the dashboard can give a credible answer to “Why am I seeing this?”

Keep reading

Deploying Node.js and PostgreSQL on AWS Beyond the Happy Path

Contact

Let’s connect.

For engineering opportunities, reach me by email or LinkedIn.