Skip to content

Instantly share code, notes, and snippets.

Fungebra syntax

Expression syntax for composing and manipulating Python functions.

from fungebra import Function
from external_library import other_func

@Function
def my_func():
@jacksmith15
jacksmith15 / func.py
Last active September 23, 2022 15:12
from functools import partial, reduce
import operator
from typing import Callable, Iterable, Union
from funcy import compose, identity
class Function:
"""Function wrapper with composition methods."""
def __init__(self, func: Union[Callable, "Function"]):

Large Payloads testing work overview

There are 5 Pull Requests, which I recommend should be merged in the following order:

  • Genomic Record Referral Search bugfix: PR 813 This is a very small one (~21 lines), but has its own ticket. It blocks the test from passing.
  • Config Test data fix: PR 115
    Extremely tiny (~4 lines) - should only take a minute.
  • Genomic Record Bulk data generation command: PR 815 Contains a large amount of the work (~900 lines), specifically enables us to generate

Given these pairs:

patient,referral
p29286416172,r19529956641
p49607832635,r19293807841
p69929249091,r19057659047
p90250665558,r19821510137
p10572084327,r19585361336
p30893500781,r19349212531
p51214917243,r19113063730

Patient

Request

POST /sample-message/patient

{
  "query": {
    "human_readable_id": [
      "p10001400859"

Patient Status: Key Actions

Deactivating a patient

  1. Display the available reason concepts for the user to select GET /codes-search/patient_deactivation_reason
{
  "total": 2,
  "limit": 10,
  "offset": 0,
from collections import namedtuple
class ImmutableNamespaceMeta(type):
def __new__(cls, name, bases, dct):
x = super().__new__(cls, name, bases, dct)
public = {key: value for key, value in dct.items() if not key.startswith("_")}
typ_ = namedtuple(name + "Type", public.keys())
return typ_(**public)

Overview

This document provides some JSON examples to aid with re-integration of consumers to breaking API changes for patient records brought about by NDMS-1984.

Included are happy path before/after examples for common cases:

  • With and without NHS Number
  • Read and write payloads
  • With and without explicit reason for missing NHS Number

as well as some canonical invalid payloads.

Unique NHS Number

  • How to enforce at the data model layer whilst being compatible with cohorts?
    1. Currently sits in generic identifier table - this is hard to constrain at the model layer.
    2. Could be an attribute on the table - easier to constrain but NHS-specific. Would need to split NHS specific fields using inheritance.
  • How to enforce at the API layer?
    • If (1) above then would need to do an explicit lookup in the serializer to check uniqueness.
    • If (2) above then can use standard handling.
  • How to communicate correct error to UI?
    • This should be a 400 - will need an extra message or code to distinguish.

Clinician change summary

Summary of changes to DDF payload triggered by data model change

Before

  • Clinicians are found as an array of referral_clinicians, under an attribute with the same name.
  • Each referral_clinician contains:
    • a clinician (see below)
    • an organisation_uid reference
    • a referral_clinician_role_uid reference (always null)
  • a referral_uid reference (always the same as the outer referral)