You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-15Lines changed: 12 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -203,15 +203,13 @@ There are four types of `pytest` in this project:
203
203
- Unit: these _do not have_ any `@pytest.mark` markers;
204
204
- Integration: these have `@pytest.mark.integration` markers;
205
205
- Smoke: these have `@pytest.mark.smoke` markers;
206
-
- Matrix: these have `@pytest.mark.matrix` markers;
207
206
208
207
In order to run these you can do one of::
209
208
210
209
```shell
211
210
make test--unit
212
211
make test--integration # Will attempt to log you into AWS first
213
212
make test--smoke # Will attempt to log you into AWS first
214
-
make test--sds--matrix
215
213
```
216
214
217
215
If you would like to rerun all failed tests, you can append `--rerun` to the test command, e.g.:
@@ -230,7 +228,6 @@ Otherwise, feel free to run `pytest` from your `poetry` shell for more fine-grai
230
228
231
229
The VSCode settings for "Run and Debug" are also set up to run these tests if your prefer.
232
230
233
-
`make test--sds--matrix` is used for testing responses match in SDS FHIR between CPM and LDAP. You must provide `SDS_PROD_APIKEY` and `SDS_DEV_APIKEY`. There are 3 optional variables `USE_CPM_PROD`, defaults to `FALSE`, `COMPARISON_ENV`, defaults to `local` and `TEST_COUNT`, defaults to `10` and is the number of requests to make.
234
231
Add `PYTEST_FLAGS='-sv'`.
235
232
236
233
### End-to-End feature tests
@@ -296,27 +293,27 @@ TBC
296
293
297
294
#### Write-integrity (primary keys)
298
295
299
-
The Partition Key (`pk`) that we use for all objects\* in the database is a unique combination of prefix (aligned with the object type, e.g. `D#` for `Device`) and identifier (generally a UUID). The Sort Key (`sk`) that we use is always exactly equal to the Partition Key. This is opposed to having fully denormalised objects so that attributes are nested under their own `sk`. The reason for doing this is to limit multiple read operations for a given object, and also save I/O in our ETL process by reducing the number of database transactions required per object.
296
+
The Partition Key (`pk`) that we use for all objects\* in the database is a unique combination of prefix (aligned with the object type, e.g. `PT#` for `ProductTeam`) and identifier (generally a UUID). The Sort Key (`sk`) that we use is the id of the entity itself. We inject 2 columns into the row of each entity during writing and do not display on the domain classes themselves. These are `row_type` and `root`
300
297
301
-
Objects can additionally be indexed by any keys (see [Domain models](#domain-models)) that they have. For every key in an domain object,
298
+
The table is structured as below. (For purposes of clarity extra "entity specific" attributes have been left out.)
299
+
300
+
| PK | SK | row_type | Id | name | created_on | updated_on | deleted_on | status | pk_read_1 | sk_read_1 | pk_read_2 | sk_read_2 | root |
Product Teams can additionally be indexed by any keys (see [Domain models](#domain-models)) that they have. For every key in an domain object, that is of type product_team_alias_id,
302
307
a copy is made in the database with the index being that key, rather
303
308
than the object's identifier. Such copies are referred to as non-root
304
309
objects, whereas the "original" (indexed by identifier) is referred to
305
310
as the root object.
306
311
307
-
\* In the case of `Device` tags, which sit outside of the standard database model, `pk` is equal to a query string and `sk` is equal to `pk` of the object that is referred to. A tag-indexed `Device` is otherwise a copy of the root `Device`.
308
-
309
312
#### Read/search interface
310
313
311
-
We have implemented a Global Secondary Index (GSI) for attributes named `pk_read` and `sk_read`. The pattern that is place is as follows:
312
-
313
-
-`pk_read`: A concatenation of parent `pk` values (joined with `#`, e.g. `PT#<product_team_id>#P<product_id>`)
314
-
-`sk_read`: Equal to the `pk` of the object itself.
315
-
316
-
We refer to this as an "ownership" model, as it allows for reads to be
317
-
executed in a way that mirrors the API read operations (GET `grandparent/parent/child`), whilst also giving us the ability to return all objects owned by the object indicated in the `pk_read` - which is a common operation for us.
314
+
We have implemented 2 Global Secondary Indexes (GSI) for attributes named `pk_read_1`, `sk_read_1`, `pk_read_2` and `sk_read_2`. The pattern that is place is as follows:
318
315
319
-
A `read` and `search` is available on all `Repository` patterns (almost) for free (the base `_read` and `_search` require a shallow wrapper, but most of the work is done for you).
316
+
A `read` and `search` is available on all `Repository` patterns (almost) for free (the base `_read` and `_search` require a shallow wrapper).
0 commit comments