The Trinity Beast Infrastructure — Impact Map Field Uploads

Administrator guide to the Account Dashboard's Upload page — from a phone in a village to a pin on the Impact Map, with location data removed on the way.

Region: us-east-2 (Ohio) Dashboard: https://api.cpmp-site.org/dashboard Impact Map: https://cpmp-site.org/map.html Updated: November 9, 2026

1. Overview — Stories From the Field, Straight to the Map

Every pin on the Impact Map is a moment that really happened: a hand pump that now gives clean water, a family that walked out of a brick kiln free, a medical camp in a village with no clinic. For a long time, getting those moments onto the map meant sending files through a chat app, sorting them by hand, and typing in where and when each one happened. The Upload page replaces all of that with one form in the Account Dashboard that Shafiq Bhatti and Cory Dean Kalani can use from any phone or computer.

You choose the impact type, the village, the date the photo or video was taken, and a short description, then pick your files. From that moment the system does the rest: the files travel straight to private storage, a processor removes every trace of location data and converts them to formats every browser plays, and a new pin appears on the map at the village you named. There is no approval step. An upload from one of you goes on the map by itself, usually within a minute or two.

Why it is built this way. The people closest to the work should be able to tell its story without anyone in between. So the design asks you for only what you know — what happened, where, when — and keeps for itself everything you should not have to think about: coordinates, file formats, naming, privacy, and retrying a dropped connection.

Diagram 1.1: How a Field Upload Flows Into the System
flowchart LR
  subgraph S1["1 · You, in the field"]
    direction TB
    PHONE["Phone or computer\nShafiq Bhatti\nCory Dean Kalani"]
    FORM["Upload page\nimpact type · village\ndate taken · description"]
    PHONE --> FORM
  end
  subgraph S2["2 · LPO server"]
    direction TB
    GRANT["Folder permission\nfield_upload_grants"]
    VILL["Village coordinates\nmap_regions"]
    ROW["Upload record\nfield_uploads"]
    GRANT --> VILL --> ROW
  end
  subgraph S3["3 · Private bucket"]
    direction TB
    PARTS["8 MB parts\n3 at a time\nretried if dropped"]
    ORIG[("Original file\nnever public")]
    PARTS --> ORIG
  end
  subgraph S4["4 · Media processor"]
    direction TB
    CLAIM["Reserve the\npublic name"]
    CLEAN["Rebuild as\nJPEG or MP4\nmetadata removed"]
    CHECK{"Location\ndata left?"}
    CLAIM --> CLEAN --> CHECK
  end
  subgraph S5["5 · Impact Map"]
    direction TB
    SITE[("map-pins/type/\nvillage-date-NNN")]
    PIN["Pin at the\nvillage"]
    NEWS["Monthly\nnewsletter"]
    SITE --> PIN --> NEWS
  end
  S1 -->|"start upload"| S2
  S2 -->|"signed URLs · parts sent direct"| S3
  S3 -->|"upload complete"| S4
  S4 -->|"none left: publish"| S5
  style S1 fill:#1e293b,stroke:#10b981,color:#e2e8f0
  style S2 fill:#1e293b,stroke:#60a5fa,color:#e2e8f0
  style S3 fill:#1e293b,stroke:#f59e0b,color:#e2e8f0
  style S4 fill:#1e293b,stroke:#a855f7,color:#e2e8f0
  style S5 fill:#1e293b,stroke:#10b981,color:#e2e8f0
    

Read the diagram from left to right, through its five numbered stages. Notice what never happens: the file never passes through our servers on its way in, and the original never becomes public. The server only checks, records and signs; storage receives the bytes; the processor decides what the public may see. Each part does one job, which is why each part stays simple.

2. Who Can Upload — Folders and Permissions

Uploads are organised into one folder for each impact type on the Impact Map legend. A folder permission is a row that pairs a person's dashboard sign-in with one impact type, so you can give someone a single folder, several, or all seven. Today Shafiq Bhatti and Cory Dean Kalani each hold all seven.

FolderMap legend labelWhat belongs here
medicalMedical CampsFree medical camps, check-ups and medicine
waterClean WaterHand pumps and clean-water projects
wheelchairWheelchairsWheelchairs given and the people who received them
freedomFreedomFamilies freed from brick kiln debt bondage
provisionsProvisionsFood and essentials delivered
wordThe WordPrinted and audio Bibles shared
educationEducationSchooling and training

The permission is checked on every request, not only when the page loads. That matters because it means the page is a convenience, never the security boundary: even a hand-written request for a folder you do not hold is refused by the server. The menu entry appears only for accounts that hold at least one folder, so everyone else's dashboard stays exactly as it was.

Lower part of the Account Dashboard sidebar. Below the Webhook and Partner sections, a section headed Impact Map holds one highlighted link, Upload Media, followed by the Admin section with Analytics, Map Pins and Person View.
The Impact Map section in the sidebar holds the Upload Media page. It appears only for accounts with at least one folder permission.

One rule worth knowing. Uploads are not available while an administrator is impersonating another account. Every upload records who sent it, and that record has to be the person who actually did.

3. The Upload Page

The page has two cards. New upload is the form; Your uploads shows what you have sent and where each file is on its way to the map. Here is the page as an administrator sees it on a computer.

The Upload Media page in the Account Dashboard. The New upload card lists, from top to bottom: Impact type, Village or area, Date the photo or video was taken, Description, Language of the description, Photos and videos with a Choose Files button, and a yellow Upload button.
The New upload form. Each field carries a one-line hint underneath, so the form explains itself in the language of whoever is using it.

3.1 The Four Facts Every File Carries

Every file you send carries four facts. They are the same four facts the map already stores for every pin, which is what lets an upload become a pin without anyone rewriting it.

On the formBecomes on the pinWhy it is asked for
Impact typemap_pins.typeChooses the legend colour and icon, and the folder the file is stored in. Only the folders you hold are offered.
Village or areamap_pins.region and the pin's coordinatesPlaces the pin. You name the village; the system supplies the latitude and longitude (section 5).
Date the photo or video was takenmap_pins.dateThe day it happened, not the day you upload it. A camp held in March and uploaded in October belongs to March.
Descriptionmap_pins.captionThe words a visitor reads beside the photo. Required, up to 1,000 characters.

The form adds one more choice, Language of the description, which starts at the language your dashboard is in. Write the description in whatever language comes naturally and tell the form which one it is. The map then translates it for each visitor from that language (section 8).

Every file you choose in one upload gets the same four facts and becomes its own pin. To give files different details, upload them in separate rounds; the form keeps its values between rounds, so you change only what differs.

3.2 File Types You Can Upload

These are the formats phones and cameras actually produce, including the ones iPhones use by default. Each file can be up to 2 GB.

KindFormatFile endingsUsually comes from
PhotosJPEG.jpg .jpegAndroid phones, cameras, most shared photos
HEIC / HEIF.heic .heifiPhone camera (its default setting)
PNG.pngScreenshots and edited images
WebP.webpImages saved from the web or from some chat apps
VideosMP4.mp4Android phones and most cameras
QuickTime.moviPhone camera
M4V.m4vVideos exported from Apple devices
3GP.3gpOlder Android phones
WebM.webmScreen recordings and browser recordings

Anything else — a GIF, an AVI or MKV video, a PDF or other document — is stopped before it uploads, with a message naming the file, so nothing is sent that could not become a pin. You never need to convert a file first: whatever the format on this list, the public copy becomes a JPEG photo or an MP4 video, the two formats every browser plays (section 6).

4. Uploading — Built for a Mobile Connection

Press Upload and each file shows its own progress bar. A phone video can be hundreds of megabytes and a village connection can drop at any moment, so the page never sends a file in one piece. It splits each file into 8 MB parts and sends three parts at a time. If the connection drops, only the part in flight is retried, with a growing pause between attempts, and the file carries on from where it was. Each part gets 8 attempts, the pause starting at a second and a half and doubling up to 30 seconds. Even the very first request for upload addresses is retried inside each part's own attempts, so a drop in the first second does not end the upload.

The New upload form filled in: Impact type Clean Water, village dhunde with the note This village is already on the map, date 10/20/2026, a description about a hand pump, language English, and two files. The first file, IMG_2041.JPG, shows a progress bar at 61 percent; the second is waiting. Below the Upload button the page says Keep this page open until every file says it has been uploaded.
Two photos on their way. The first is 61% uploaded and the second waits its turn. If the connection drops, the message changes to say it is trying again, and the bar keeps its place.

Why the bytes skip our servers. The browser sends each part straight to Amazon S3 using a short-lived upload URL that the server signed for that one part of that one file. Our API servers never carry a single byte of video, so a large upload cannot slow down the price feeds and reports they serve, and the files never pass through the web firewall's request-size limits.

5. Villages — Where a Pin Lands

You never type a latitude or longitude. Photos shared through chat apps lose their location data on the way, and location data is something we remove on purpose anyway (section 6.1). So a pin's coordinates come from its village, and every village has its place stored once, in one table, map_regions.

Start typing in Village or area and the field suggests the villages already on the map, most-used first. Pick one and the form confirms it: This village is already on the map.

Adding a new village

The work is growing, and new villages are expected. Type a name the map does not know yet and the form tells you it is a new village, then opens a small map. Tap where the village is, and that place is saved with the village, so every future upload there lands in the right spot without being placed again.

The Village or area field with the new name Chak 42. Below it the form says New village. It will be added to the map, and asks you to tap the map where the village is. A small street map of the Faisalabad area shows a blue marker where it was tapped, followed by Place set on the map and a Remove the place button.
A new village, Chak 42, placed with one tap. Remove the place lets you tap again if the first try was off.

If you are not sure where it is, leave the map alone and upload anyway. The pin goes on the map at a temporary point, and once the village is given its place, every pin there moves to it (section 11).

Village names use English letters

A village name becomes part of each published file name and web address, and every village already on the map is written that way. So the form asks for the name in English letters and says so, in your dashboard's language, if it sees anything else.

The Village or area field containing a name in Urdu script. Below it the form says Write the village name in English letters, as it should appear on the map.
A name in Urdu script gets a clear request for English letters. The description has no such limit: write it in any language.

Spelling variants of the same place are recognised as one village: Bilal Town, bilal-town and bilal_town all lead to the same row, because a village's identity ignores capital letters and treats spaces, dashes and underscores alike.

6. Behind the Upload Button

When the last part of a file arrives, storage tells the processor, tbi-field-media-processor, and the rest happens without you. A photo is prepared by the processor itself, in seconds. A video is handed to a task of its own on Fargate (tbi-field-media-video), which runs the same steps with the same code but has no time limit, because a long phone video can take longer to convert than the 15 minutes a Lambda function is allowed. The sequence below is the whole conversation between the pieces. Every step in it is safe to repeat, which is what lets the system retry anything that fails partway without ever making a second pin.

Diagram 6.1: The Upload and Publish Handshake
%%{init: {"sequence": {"mirrorActors": false}, "themeVariables": {"sequenceNumberColor": "#0f172a"}}}%%
sequenceDiagram
  autonumber
  participant B as Upload page
  participant L as LPO server
  participant A as Aurora
  participant P as Private bucket
  participant F as Media processor
  participant W as Website bucket
  B->>L: Start upload: type, village, date, description, file size
  L->>A: Check folder permission, find or add village, record upload
  L->>P: Open a multipart upload
  L-->>B: Upload id and number of 8 MB parts
  loop Every part, three at a time
    B->>L: Ask for upload URLs (up to 50 at once)
    L-->>B: Signed URLs, valid for 1 hour
    B->>P: Send the part (retried if the connection drops)
  end
  B->>L: Complete, with each part's receipt
  L->>P: Join the parts into one file
  L->>A: Status: being prepared for the map
  P-)F: A new file has arrived
  F->>L: Claim this upload
  L->>A: Reserve the next free public name
  L-->>F: Proceed, and publish under this name
  Note over F: A photo is prepared right here. A video is handed to a Fargate task that runs the same steps, with no time limit
  F->>P: Read the original
  Note over F: Rebuild the image or video, remove all metadata, confirm no location data survived
  F->>W: Write the public copy, never over an existing file
  F->>L: Result: published at this address
  L->>A: Create the map pin and mark the upload published, in one transaction
    

Two details in the diagram carry most of the reliability. The public name is reserved before the file is written (step 13), so two photos from the same day and village can never be given the same number. And the pin is created in the same database transaction that marks the upload published (step 18), so a pin can never exist without its upload saying so.

6.1 Privacy — Location Data Never Reaches the Map

The Impact Map promises every visitor that pin locations are approximate, to protect the families and field workers in sensitive areas. A photo taken on a phone and uploaded directly can carry the exact spot where it was taken. The processor keeps the promise by never copying a file as it is.

Your original stays in the private bucket, untouched and never public. The pin itself sits at its village's coordinates, and the map adds a small random offset of about a kilometre every time it draws it. The location a visitor sees is always the village, never a doorstep.

6.2 The Published File Name

Every photo and video on the map follows one naming pattern, and the files you upload follow it too:

map-pins/<impact type>/<village>-<YYYY-MM-DD>-<NNN>.<jpg or mp4>

That means a file name is not a random string. It can be read back into the pin's own facts:

ExampleImpact typeVillageDate takenNumberKind
map-pins/water/dhunde-2026-10-20-001.jpgwaterdhunde2026-10-20001photo
map-pins/medical/central-punjab-2026-10-12-003.mp4medicalcentral-punjab2026-10-12003video

The number is the next free one for that type, village and date. The server finds it by looking at existing pins, at names already reserved by other uploads, and at the files actually in the website bucket, so even a stray old file keeps its number. Your own file name (IMG_2041.JPG and so on) is kept in the upload's record for reference, but never appears in any address.

6.3 The Container Image and the Video Task Definition

Photos and videos are prepared by one program, built once into one container image and run in two places. The Lambda function tbi-field-media-processor runs the image as a Lambda function: it receives every new file, prepares photos itself, and starts a video task for each video. The ECS task definition tbi-field-media-video runs the same image as a Fargate task, with a different entry point, to prepare one video and then stop. Because both run the same image, a photo and a video are always prepared by exactly the same code.

Diagram 6.2: One Image, Two Runtimes
%%{init: {"flowchart": {"nodeSpacing": 50, "rankSpacing": 60}}}%%
flowchart LR
  IMG[("ECR image\ntbi-field-media-processor\narm64")]
  S3["Private bucket\ntrinity-beast-field-uploads"]
  L["Lambda function\ntbi-field-media-processor\nentry point: awslambdaric"]
  T["Fargate task\ntbi-field-media-video\nentry point: python -m handler\n4 vCPU, 8 GB, 100 GiB, ARM64"]
  API["LPO server\n/admin/field-uploads/claim\n/admin/field-uploads/result"]
  W["Website bucket\nmap-pins/"]
  EB["EventBridge rule\ntbi-field-media-video-stopped"]
  LOG["Log group\n/ecs/tbi-field-media-video"]
  AL["Alarm\nVideoTask-Problems"]
  IMG -.->|"same image"| L
  IMG -.->|"same image, pinned by digest"| T
  S3 -->|"new file"| L
  L -->|"photo: claim and result"| API
  L -->|"photo: public copy"| W
  L -->|"video: ecs RunTask\nwith S3_KEY"| T
  T -->|"claim and result"| API
  T -->|"public copy"| W
  T -->|"log lines"| LOG
  LOG --> AL
  T -->|"task STOPPED"| EB
  EB -->|"report a task that\ndid not finish"| L
  style IMG fill:#1e293b,stroke:#94a3b8,color:#e2e8f0
  style T fill:#14532d,stroke:#34d399,color:#e2e8f0
  style AL fill:#3f1d1d,stroke:#f87171,color:#fecaca
    

The container image

The image is built from lambdas/field-media-processor/Dockerfile in the LPO server repository, with build.sh in the same folder. It starts from the official Python 3.12 image for ARM64 (python:3.12-slim-bookworm), adds Debian's ffmpeg for video, and installs Pillow and pillow-heif for photos, including iPhone HEIC files. Its default entry point is the AWS Lambda runtime client, which is how the Lambda function runs it. Each build is pushed to the ECR repository tbi-field-media-processor.

Lambda settingValue
PackageContainer image, ARM64
Memory and temporary storage10,240 MB each
Time limit900 seconds (15 minutes)
Reserved concurrency10, so at most ten files are prepared at once
NetworkNot in a VPC
Settings it passes to the video taskVIDEO_CLUSTER, VIDEO_TASK_DEFINITION, VIDEO_CONTAINER, VIDEO_SUBNETS, VIDEO_SECURITY_GROUPS

The video task definition

The task definition is kept in the LPO server repository as deployments/field-media-video-task-def.json, and the registered revision matches it. It has no ECS service. Nothing runs until a video arrives, and the only thing that starts a task is the Lambda function.

SettingValueWhy
Family and revisiontbi-field-media-video, revision 2Revision 1 is deregistered
Clustertrinity-beast-fargate-clusterThe cluster the LPO services run in
Launch type and platformFargate, Linux on ARM64The image is built for ARM64
Size4 vCPU, 8 GB of memory, 100 GiB of working spaceConverting video is CPU work, and a 2 GB original and its copy must both fit on disk
Containervideo, essentialThe task's only container
ImageThe processor image, pinned by digestA task always runs the exact build that was tested, never whatever was pushed last
Entry point/usr/local/bin/python -m handlerReplaces the Lambda runtime client, so the program runs once and exits
EnvironmentFIELD_MEDIA_MODE=task, VIDEO_TIMEOUT_SECONDS=10800, LPO_BASE, PYTHONUNBUFFERED=1Task mode; the 3-hour safety stop; the server's address; log lines written as they happen instead of all at the end
Per-task settingS3_KEYAdded by the Lambda function when it starts the task: the one file this task prepares
Task roletbi-field-media-video-task-roleReads originals, writes public copies under map-pins/ and reads the admin key. Nothing else
Execution roleecsTaskExecutionRolePulls the image and writes the logs
Logs/ecs/tbi-field-media-video, stream prefix videoOne stream per video, kept 90 days

How a video task is started

The Lambda function calls ecs:RunTask with three things the task definition cannot know in advance:

Inside the task, a server or network error is retried twice, after 30 seconds and after 2 minutes. If all three attempts fail, the task marks the upload Could not be prepared itself. A file that cannot be read is marked straight away, without retries, because trying again would not change it.

When any video task stops, the EventBridge rule tbi-field-media-video-stopped sends the event back to the Lambda function. A clean exit needs nothing. Any other ending, including a task that never started, marks the upload Could not be prepared, so an upload can never wait for ever. The server ignores that report for an upload that is already published. If the task logs an error or stops early, the alarm Trinity-Beast-FieldMedia-VideoTask-Problems emails the operations list.

Changing the image. A new build reaches the Lambda function when the function is updated to it. The video task keeps running the old build until a new revision of the task definition is registered with the new digest. The function names the task definition without a revision, so it always starts the newest active one. Update both, from the same build, every time, then deregister the old revision.

7. Following an Upload — Statuses

Your uploads lists your 100 most recent files. Each row shows the four facts you entered, the day you uploaded the file, its original name and size, and a status, with a thumbnail once a photo is on the map. Every file that is on the map also has a Show on map link under its status (section 8). While anything is being prepared, the list refreshes itself every fifteen seconds; the Refresh button is there when you want to look sooner.

The Your uploads card as a table with five entries, newest upload first. The column headings are Impact type, Village, Date taken, Uploaded with a down arrow, Description, and Status; every heading except Description has a sort arrow. Two photos, Clean Water in dhunde and Provisions in babliyana, show thumbnails, the status On the map and a Show on map link. A video for The Word in bhubtian, with an Urdu description, says Being prepared for the map. A Medical Camps video says Stopped: the page was closed or the device went to sleep. Upload it again. A Wheelchairs photo says Could not be prepared.
Five uploads and four statuses at once, newest upload first. A published photo shows its thumbnail; select it to open the public copy.

Select a column heading to sort the list by it: Impact type, Village, Date taken, Uploaded or Status. Select the same heading again to reverse the order. The arrow beside each heading shows which column is in use and in which direction (↑ or ↓); the others show ↕. Sorting by Status puts the files that need you first: could not be prepared; then uploads still open after a day with no report of why they stopped; then every other stopped file; then uploading, being prepared, and last, on the map. An upload an administrator closed as abandoned reads like the ones still open after a day, but it sorts with the other stopped files. Files that tie keep the newest upload first. Your chosen order stays in place while the list refreshes. If you have more than 100 uploads, a note under the list says that only the most recent are shown.

On a phone, each upload becomes its own card, with its village and both dates labelled, and the column headings become a row of buttons above the list that sort the same way. Nothing on the page has to be scrolled sideways.

Your uploads on a phone in Urdu, laid out right to left. Five sort buttons sit above the list, in Urdu: impact type, village, date taken, upload date with a down arrow, and status. Below them are cards for The Word in bhubtian, being prepared for the map, and for Clean Water in dhunde and Provisions in babliyana, both on the map. Each card labels its village and its two dates in Urdu.
The same list as Shafiq Bhatti sees it on his phone, in Urdu. The headings become buttons, and each card names its village and both dates.
The list saysWhat is happeningWhat to do
UploadingParts are still on their way from your device.Keep the page open.
Stopped: the page was closed or the device went to sleep. Upload it again.The upload started more than a day ago and the page never reported that it stopped — usually a page closed, or a phone that slept, mid-upload. An administrator can close such an upload as abandoned, and it then reads the same.Choose the file again.
Being prepared for the mapThe file arrived; the processor is building the public copy.Nothing. Photos take seconds. A video waits about half a minute for its task to start, then takes roughly half its own length to prepare at 1080p, and a little more than its own length at 4K.
On the mapPublished. The pin is live.Select Show on map to open the map at the pin.
Could not be preparedThe file could not be read, location data could not be removed, or preparing it stopped before it finished, so it was not published.Try the original file from the phone, or ask an administrator to look (section 11).
Stopped: the connection kept dropping. Upload it again.A part could not be sent after 8 attempts, or the connection dropped while the parts were being joined into one file.Choose the file again, ideally where the signal is stronger.
Stopped: the upload service was unavailable. Upload it again.Our server answered that the upload service was unavailable.Choose the file again in a little while.
Stopped: the upload could not be finished. Upload it again.Every part arrived, but joining them into one file was refused.Choose the file again.
Stopped: you were signed out. Sign in and upload it again.The dashboard session ended in the middle of the upload.Sign in, then choose the file again.
CancelledThe page stopped the file without recording why: a stop from before November 5, 2026, or from an older copy of the page.Choose the file again.
Diagram 7.1: Upload Status Lifecycle
%%{init: {"flowchart": {"nodeSpacing": 90, "rankSpacing": 60}}}%%
flowchart LR
  START(("Upload\npressed")) --> U["Uploading\nuploading"]
  U -->|"last part arrives"| P["Being prepared\nfor the map\nprocessing"]
  U -->|"page stops it and says why"| C["Stopped, with the reason\ncancelled"]
  P -->|"public copy written,\npin created"| OK["On the map\npublished"]
  P -->|"unreadable, location data\nsurvived, or preparation\nstopped early"| F["Could not be prepared\nfailed"]
  style OK fill:#14532d,stroke:#34d399,color:#e2e8f0
  style F fill:#3f1d1d,stroke:#f87171,color:#fecaca
  style C fill:#1e293b,stroke:#94a3b8,color:#e2e8f0
  style START fill:#334155,stroke:#94a3b8,color:#e2e8f0
    

8. On the Impact Map

A published upload is an ordinary pin. It takes the legend colour of its impact type, shows a camera or play badge for photos and videos, joins the clusters in its area, and opens the same detail panel as every other pin: the impact type, your description, the date it was taken and the village, with the photo or video below.

The CPMP Impact Map with a pin's detail panel open. The panel is headed Clean Water with a water-drop icon, reads Clean Water for Life, Hand pump installed, Date 2024-12-16, Region Dhunde, and shows a photo of families gathered around a new hand pump beside a brick wall.
A Clean Water pin in Dhunde, opened on the live Impact Map. Your uploads appear in exactly this form.

Finding your pin

A new pin can be hard to spot. When the map first opens, it shows the whole country, and pins that sit close together are grouped into a numbered circle in their impact type's colour. Your pin is inside that number until you zoom in. Select a circle to zoom into it; closer still, the circle splits into its pins.

The quicker way is the Show on map link beside each published file in Your uploads. It opens the Impact Map in a new tab, in your dashboard language, already zoomed in on that pin with its panel open. The general View the Impact Map link on the Upload page opens the map in your language too.

Descriptions are translated for each visitor from the language you chose on the form. A note Shafiq writes in Urdu reaches an English visitor in English, with his original words shown beneath it, and a visitor reading the map in Urdu sees his words exactly as he wrote them.

9. In Shafiq's Language

The Upload page speaks all twelve dashboard languages, and Urdu and Arabic are laid out right to left. Every label, hint, status and error message comes in the uploader's own language, including the messages from the server. This is the page as Shafiq Bhatti sees it on his phone.

The Upload page on a phone in Urdu, laid out right to left. The form shows the impact type The Word in Urdu, the village bhubtian with an Urdu note that it is already on the map, the date 10/24/2026, and an Urdu description about audio Bibles.
The same form in Urdu on a phone, right to left. Village names stay in English letters; the description is in Urdu, and the map will translate it for every other visitor.

The language follows the account, the way the rest of the dashboard does: no second language picker, no English left behind on a page someone reads in Urdu.

10. From Uploads to the Monthly Newsletter

The CPMP newsletter goes out on the first Sunday of each month. Its stories now come from the field: Kiro reads the month's published uploads — the descriptions, the villages, the dates, the photos — writes the issue from them with Cory, and adds it to the newsletter archive. Each subscriber then receives it in their own language, translated shortly before the send.

That is why the description matters beyond the map. A sentence written in the moment, by the person who was there, is the most valuable thing an issue can carry. Two or three lines about who was helped and what changed for them is plenty.

November 2026 is skipped while the first uploads arrive. The first issue built from field uploads is planned for the first Sunday of December.

11. Administrator Tasks

Day to day, the system needs nothing from you. These are the few tasks an administrator does by hand, all through the admin SQL endpoint. Replace each value in angle brackets with your own; a sign-in email is the email address the person uses to sign in to the dashboard.

Give someone permission to upload

One row per folder. This gives a person all seven:

INSERT INTO field_upload_grants (email, impact_type, granted_by)
SELECT lower('<sign-in email>'), t, '<your name>'
FROM unnest(ARRAY['medical','water','wheelchair','freedom','provisions','word','education']) AS t
ON CONFLICT (email, impact_type) DO NOTHING;

To give fewer folders, list only those types. To take a folder away, delete its row. The person sees the change the next time their dashboard loads.

Give a new village its place

A village added without a place has no coordinates, and its pins wait at a temporary point. Set the village's place once, then move its waiting pins:

SELECT key, name FROM map_regions WHERE lat IS NULL;

UPDATE map_regions SET lat = <latitude>, lng = <longitude>, source = 'kiro', updated_at = now()
WHERE key = '<village key>';

UPDATE map_pins SET lat = <latitude>, lng = <longitude>
WHERE region = '<village name>' AND lat IS NULL;

Find an upload that is not on the map

When someone says a photo never appeared, the upload record says why:

SELECT created_at, impact_type, region, event_date, original_name, status, stop_reason, error
FROM field_uploads
WHERE status <> 'published'
ORDER BY created_at DESC
LIMIT 20;

For a file the page stopped (cancelled), stop_reason says why: connection_failed, storage_unavailable, finish_failed or signed_out, or abandoned when an administrator closed out an upload the page never reported on. Its error then holds the page's own detail, for example part 24 of 237, 8 attempts, last: put network; 184 of 1892 MB sent, which tells you which part failed, how, and how far the file got. The LPO server also logs every stop at warning level, as field upload <id> stopped by the page: reason=… detail=…, in the log group /aws/ecs/trinity-beast.

The error column holds the processor's own explanation for anything marked Could not be prepared. The processor's log lines all begin with [field-media]: photos, and every video hand-off, in the log group /aws/lambda/tbi-field-media-processor; the work on each video in /ecs/tbi-field-media-video, one stream per video. If anything goes wrong on the way, an alarm emails the operations list, so a problem is found before anyone has to report a missing pin.

Gather a month's uploads for the newsletter

SELECT event_date, impact_type, region, caption, caption_lang, public_url
FROM field_uploads
WHERE status = 'published'
  AND published_at >= date_trunc('month', now() - interval '1 month')
  AND published_at <  date_trunc('month', now())
ORDER BY event_date;

11.1 Finding and Correcting a Pin

Use the Map Pins page first. In the Account Dashboard, the Admin section's Map Pins page searches every pin, old and new, and saves a correction with the same rules as below, in the administrator's own language. It also corrects the date a photo or video was taken. It is described in the Account Dashboards guide, section 5.12. The SQL in this section is for when the dashboard cannot be used.

With SQL, an administrator can correct four things on any pin on the map: its description, the description's language, its impact type and its village. A description has 1 to 1,000 characters, the same limit as the Upload page, and the map shows all of it.

There are two kinds of pin, and each has its own correction. A pin made by the Upload page has an upload record as well. Most pins on the map are older: they were added before the Upload page existed and have no upload record, so only the pin itself changes.

1. Find the pin

This search covers every pin, old and new. Fill in any of the five values and leave the rest as NULL. The village and the words match any part of the text, in capital or small letters. The dates are the day the photo or video was taken; the second date is not included. It shows up to 50 pins, newest first.

WITH f AS (
  SELECT NULL::text AS village,       -- part of a village name, such as 'kasur'
         NULL::text AS impact_type,   -- medical, water, wheelchair, freedom, provisions, word or education
         NULL::text AS words,         -- words in the description, such as 'hand pump'
         NULL::date AS taken_from,    -- such as '2024-01-01'
         NULL::date AS taken_before   -- such as '2025-01-01'
)
SELECT p.id AS pin_id, u.id AS upload_id, p.date::date AS taken, p.type, p.region,
       p.caption, p.media_urls ->> 0 AS first_file
FROM map_pins p
CROSS JOIN f
LEFT JOIN field_uploads u ON u.map_pin_id = p.id
WHERE p.status = 'active'
  AND (f.village IS NULL OR p.region ILIKE '%' || f.village || '%')
  AND (f.impact_type IS NULL OR p.type = f.impact_type)
  AND (f.words IS NULL OR p.caption ILIKE '%' || f.words || '%')
  AND (f.taken_from IS NULL OR p.date >= f.taken_from)
  AND (f.taken_before IS NULL OR p.date < f.taken_before)
ORDER BY p.date DESC
LIMIT 50;

To look at a result on the map, open https://cpmp-site.org/map.html?pin=<pin id>; the map opens on that pin with its panel showing. If upload_id has a value, the pin came from the Upload page: follow steps 2 to 4. If it is empty, the pin is an older one: follow "Correcting an older pin" below.

Each published file is stored twice. Its upload record is what the uploader sees in Your uploads. Its map pin is what every visitor sees on the Impact Map. When the file is published, the server copies the description, its language, the impact type and the village from the upload into the new pin, and after that the two are separate rows. A correction must change both in one transaction, so that the list and the map can never disagree.

2. Keep a copy of both rows

Save the result of this query until the correction is checked. If anything looks wrong afterwards, it holds every value needed to put the rows back.

SELECT row_to_json(u) AS upload, row_to_json(p) AS pin
FROM field_uploads u
JOIN map_pins p ON p.id = u.map_pin_id
WHERE u.id = '<upload id>';

3. Make the correction

Fill in the upload's id and only the values that change. Leave the others as NULL and they stay as they are. Inside a value, write an apostrophe twice ('Shafiq''s'). The language is one of the twelve dashboard codes. Send the whole block as one query to /admin/sql with mode write. Do not split it, and do not send it through /admin/sql-batch, which runs each statement on its own and so is not one transaction.

DO $$
DECLARE
  v_upload  uuid := '<upload id>';
  v_caption text := NULL;  -- the new description, or NULL to keep it
  v_lang    text := NULL;  -- the language of the description: en, ar, de, es, fr, hi, it, ja, pt, ru, ur or zh
  v_type    text := NULL;  -- medical, water, wheelchair, freedom, provisions, word or education
  v_village text := NULL;  -- the village name, as in map_regions
  u field_uploads%ROWTYPE;
  r map_regions%ROWTYPE;
  n int;
BEGIN
  SELECT * INTO u FROM field_uploads WHERE id = v_upload AND status = 'published' FOR UPDATE;
  IF NOT FOUND THEN
    RAISE EXCEPTION 'no published upload %', v_upload;
  END IF;
  IF v_caption IS NOT NULL AND (btrim(v_caption) = '' OR char_length(v_caption) > 1000) THEN
    RAISE EXCEPTION 'a description must have 1 to 1000 characters';
  END IF;
  IF v_lang IS NOT NULL AND v_lang NOT IN ('en','ar','de','es','fr','hi','it','ja','pt','ru','ur','zh') THEN
    RAISE EXCEPTION 'unknown description language %', v_lang;
  END IF;
  IF v_village IS NOT NULL THEN
    SELECT * INTO r FROM map_regions
    WHERE key = regexp_replace(lower(btrim(v_village)), '[^a-z0-9]', '_', 'g');
    IF NOT FOUND THEN
      RAISE EXCEPTION 'no village %; add it to map_regions first', v_village;
    END IF;
  END IF;

  UPDATE field_uploads SET
    caption      = coalesce(v_caption, caption),
    caption_lang = coalesce(v_lang, caption_lang),
    impact_type  = coalesce(v_type, impact_type),
    region       = coalesce(r.name, region)
  WHERE id = u.id;

  UPDATE map_pins SET
    caption      = coalesce(v_caption, caption),
    caption_lang = coalesce(v_lang, caption_lang),
    type         = coalesce(v_type, type),
    region       = coalesce(r.name, region),
    lat          = CASE WHEN v_village IS NULL THEN lat ELSE r.lat END,
    lng          = CASE WHEN v_village IS NULL THEN lng ELSE r.lng END
  WHERE id = u.map_pin_id;
  GET DIAGNOSTICS n = ROW_COUNT;
  IF n <> 1 THEN
    RAISE EXCEPTION 'pin % not found; nothing was changed', u.map_pin_id;
  END IF;
END $$;

The block checks everything before it keeps anything. An unknown upload, language, impact type or village, a description that is blank or longer than 1,000 characters, or a missing pin, stops it with a message, and then neither row changes. The village is found the same way the Upload page finds it, so capital letters and spaces at either end do not matter, and both rows get the village's name exactly as map_regions spells it.

4. Check it, then delete the copy

SELECT u.caption = p.caption AS same_description,
       u.caption_lang, p.caption_lang AS pin_language,
       u.impact_type, p.type AS pin_type,
       u.region, p.region AS pin_village, p.lat, p.lng
FROM field_uploads u
JOIN map_pins p ON p.id = u.map_pin_id
WHERE u.id = '<upload id>';

Each pair should match, and the new values should be there. Then open the pin through the uploader's Show on map link, or reload the Impact Map. The map reads the pins from the database on every load, so the change shows at once. When both look right, delete the copy you saved in step 2.

To move a pin to a village that is not in the list yet, add the village first, with its place, then run the correction with its name. The key is the name in lower case, with every character other than a letter or a digit replaced by _:

INSERT INTO map_regions (key, name, lat, lng, source, created_by)
VALUES ('<village key>', '<village name>', <latitude>, <longitude>, 'kiro', '<your name>');

Correcting an older pin

An older pin has no upload record, so only the pin changes. Most older pins carry one of six standard descriptions, one for each kind of work, so this is also how a pin gets its own story. The same four values can be corrected, with the same rules: a new village moves the pin, and a new impact type changes its colour and group.

First keep a copy of the pin:

SELECT row_to_json(p) AS pin FROM map_pins p WHERE p.id = '<pin id>';

Then fill in the pin's id and only the values that change, and send the block as one query to /admin/sql with mode write:

DO $$
DECLARE
  v_pin     uuid := '<pin id>';
  v_caption text := NULL;  -- the new description, or NULL to keep it
  v_lang    text := NULL;  -- the language of the description: en, ar, de, es, fr, hi, it, ja, pt, ru, ur or zh
  v_type    text := NULL;  -- medical, water, wheelchair, freedom, provisions, word or education
  v_village text := NULL;  -- the village name, as in map_regions
  p map_pins%ROWTYPE;
  r map_regions%ROWTYPE;
BEGIN
  SELECT * INTO p FROM map_pins WHERE id = v_pin FOR UPDATE;
  IF NOT FOUND THEN
    RAISE EXCEPTION 'no pin %', v_pin;
  END IF;
  IF EXISTS (SELECT 1 FROM field_uploads WHERE map_pin_id = v_pin) THEN
    RAISE EXCEPTION 'pin % came from an upload; use the upload correction instead', v_pin;
  END IF;
  IF v_caption IS NOT NULL AND (btrim(v_caption) = '' OR char_length(v_caption) > 1000) THEN
    RAISE EXCEPTION 'a description must have 1 to 1000 characters';
  END IF;
  IF v_lang IS NOT NULL AND v_lang NOT IN ('en','ar','de','es','fr','hi','it','ja','pt','ru','ur','zh') THEN
    RAISE EXCEPTION 'unknown description language %', v_lang;
  END IF;
  IF v_type IS NOT NULL AND v_type NOT IN ('medical','water','wheelchair','freedom','provisions','word','education') THEN
    RAISE EXCEPTION 'unknown impact type %', v_type;
  END IF;
  IF v_village IS NOT NULL THEN
    SELECT * INTO r FROM map_regions
    WHERE key = regexp_replace(lower(btrim(v_village)), '[^a-z0-9]', '_', 'g');
    IF NOT FOUND THEN
      RAISE EXCEPTION 'no village %; add it to map_regions first', v_village;
    END IF;
  END IF;

  UPDATE map_pins SET
    caption      = coalesce(v_caption, caption),
    caption_lang = coalesce(v_lang, caption_lang),
    type         = coalesce(v_type, type),
    region       = coalesce(r.name, region),
    lat          = CASE WHEN v_village IS NULL THEN lat ELSE r.lat END,
    lng          = CASE WHEN v_village IS NULL THEN lng ELSE r.lng END
  WHERE id = p.id;
END $$;

The block refuses a pin that came from the Upload page, so a correction can never change a pin without its upload record. It checks the impact type itself, because the pins table has no rule of its own for it. Then run the search again with the pin's village or words, or open it on the map, to see the change. When it looks right, delete the copy.

12. Reference — Endpoints, Tables and Resources

Account Dashboard API

All require a dashboard session, and every one checks the folder permission itself.

MethodPathPurpose
GET/dashboard/api/uploads/configThe folders this account holds, the known villages, accepted file types and limits
GET/dashboard/api/uploadsThis account's 100 most recent uploads with their statuses, and more: whether older ones exist
POST/dashboard/api/uploadsStart one file: permission check, village, upload record, multipart upload
POST/dashboard/api/uploads/{id}/partsSigned URLs for up to 50 parts, valid for 1 hour
POST/dashboard/api/uploads/{id}/completeJoin the parts; the file moves to Being prepared
POST/dashboard/api/uploads/{id}/cancelStop an unfinished file and record why: optional reason and detail; a repeat only fills in a missing reason

Two more serve the Map Pins page. They need an administrator's own session and refuse one used for impersonation.

MethodPathPurpose
GET/dashboard/api/admin/map-pinsSearch every pin, with the village list for the edit form
POST/dashboard/api/admin/map-pins/{id}Save one pin, and its upload record when it has one, in one transaction

Admin API (used by the processor)

MethodPathPurpose
POST/admin/field-uploads/claimClaim an arrived file and reserve its public name; answers "nothing to do" for one already published
POST/admin/field-uploads/resultRecord the outcome; on success, create the pin and mark the upload published in one transaction

Aurora tables

TableHolds
field_upload_grantsThe folder permissions: one row per sign-in and impact type
field_uploadsOne row per file: who sent it, the four facts, the description's language, the original name, type and size, status and, for a stopped file, why it stopped (stop_reason), public name and address, the pin it became, and any error
map_regionsThe villages and their coordinates — the only copy of the village list
map_pinsThe map's pins; caption_lang records the language each description is written in. A published upload's pin is a copy of its upload's description, language, impact type and village, made when it is published; correct both together. Older pins have no upload record (section 11.1)

AWS resources

ResourceNameRole
Private buckettrinity-beast-field-uploadsThe originals. Public access fully blocked and encrypted. Writes need a URL the server signed for that one part of that one file, browsers may send them only from the dashboard's address, and unfinished uploads are cleared after three days
Processortbi-field-media-processorContainer Lambda with its own copy of the image and video tools. Prepares photos itself, at most ten at once, and hands each video to the video task. Also receives every stopped video task, and marks the upload Could not be prepared if the task stopped before finishing
Video tasktbi-field-media-videoOne Fargate task per video, from the same image: 4 vCPU, 8 GB of memory and 100 GB of working space. No time limit; it starts in about half a minute, stops when the video is done, and costs only while it runs. Full task definition in section 6.3
AlarmsTrinity-Beast-Lambda-Errors-tbi-field-media-processor, Trinity-Beast-FieldMedia-VideoTask-ProblemsEmail the operations list when the processor fails, or when a video task logs an error or stops before finishing
Website buckettrinity-beast-website-east2Public copies under map-pins/, served by the CDN at cpmp-site.org

Limits