Skip to content

Commit 85b7e36

Browse files
committed
update submit tutorial
1 parent ac3535a commit 85b7e36

File tree

2 files changed

+36
-16
lines changed

2 files changed

+36
-16
lines changed

README.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,6 @@ But we found that using the template required knowledge of Ruby which isn't a
2424

2525
We have customised the layout so that edits don't need any special knowledge other than creating and editing markdown files. To make a change simply edit the relevant document or create a new one in the docs directory and the sidenav will automatically update!
2626

27-
#### Optional
28-
29-
If creating a new markdown file, no knowledge is needed other than markdown. However, if you want titles to display in the browser tab, run:
30-
31-
```bash
32-
make frontmatter
33-
```
34-
35-
This will add a header to your page with the necessary metadata using the first heading you created in your markdown file.
36-
3727
[mit]: LICENCE
3828
[copyright]: http://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/
3929
[mmt]: https://middlemanapp.com/advanced/project_templates/
Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,41 @@
11
---
2-
title: Setting up and working on the Submit Service
2+
title: Working on the Submit Service
33
---
44

5-
### Architecture
6-
- Runs on [Datasette](datasette.planning.data.gov.uk) currently for all data queries,with an interest to move all queries to pipeline API / platform API for speed and cost savings.
7-
- All requests are made to the async service, can be run locally or with the docker file.
5+
## How the app is wired
6+
- The service is a Node + Express app, started from `index.js`.
7+
- App setup is split into small “setup” modules (middleware, routes, templating, session, error handling).
8+
- Runtime config comes from `config/` based on `NODE_ENV` (with `.env` overrides via `dotenv`).
9+
- All requests are sent to the [async service](https://github.com/digital-land/async-request-backend), this can be run locally or with the docker file. This actual 'computation' happens in this service with the idea that no business logic other than UI is done on this service.
810

9-
### Important Links
11+
## Middleware structure (how routes work)
12+
- Most pages are built as **middleware chains**: small, focused middleware functions composed in order.
13+
- Common responsibilities are split up (validate inputs → fetch data → transform into template params → render).
14+
- Shared helpers live in `src/middleware/common.middleware.js` and the “builder” helpers live in `src/middleware/middleware.builders.js`.
15+
16+
## Datasette
17+
- The service reads most of its data by querying [**Datasette**](datasette.planning.data.gov.uk).
18+
- Some queries are dataset-scoped (e.g. `digital-land`, `performance`), and a small set of reads use a platform API instead of SQL.
19+
- There is a interest to move all queries to (pipeline API)[https://github.com/digital-land/pipeline-internal-api] / or use the main platform API for speed and cost savings.
20+
21+
## Data Storage
22+
- **Sessions**: User journey state (including HMPO wizard state) is stored in the Express session. When Redis is configured and available, sessions are persisted in Redis; otherwise the app falls back to an in-memory session store.
23+
- **Redis-backed caches (performance)**: Redis is also used to cache a few “reference lists” to reduce repeat work and expensive queries.
24+
- Organisation list for the organisations page: cached for **6 hours**.
25+
- Dataset subject map (the grouped dataset list shown in the UI): cached with a shorter TTL in `local`/`development` and a longer TTL in other environments (currently **~1 minute** locally vs **~1 hour** elsewhere).
26+
- **What’s stored**: These caches store non-sensitive, derived data (lists/mappings) rather than uploaded files.
27+
- **Failure mode**: If Redis is unavailable, the service will still run, but will rebuild these lists more often (slower page loads, more upstream calls).
28+
29+
## HMPO form wizard (multi-step journeys)
30+
- Multi-page flows use `hmpo-form-wizard`.
31+
- There are two main wizards:
32+
- `/check` (the check tool)
33+
- `/submit` (endpoint submission form; typically feature-flagged)
34+
- Each wizard is defined by:
35+
- `steps.js` (the journey / routing between steps)
36+
- `fields.js` (field validation rules)
37+
- controllers for step-specific behaviour and session-backed state
38+
39+
## Important Links
1040
- [Architecture Diagrams](/architecture-and-infrastructure/solution-design/check-service/)
11-
- [Debugging Async Service](/development/live-service/debugging-live-services/)
41+
- [Debugging Async Service](/development/live-service/debugging-live-services/) Important to know how to use the Async service as well for this service, Postman is useful for checking what data is being sent between the services.

0 commit comments

Comments
 (0)