Use source patient identity for breast follow-up
This commit is contained in:
@@ -24,10 +24,9 @@ if os.name == 'nt':
|
||||
|
||||
|
||||
path = Path(os.environ['CAMA_SYNTHETIC_SQLITE']).resolve(strict=True)
|
||||
secret = os.environ['CAMA_COHORT_SECRET'].encode()
|
||||
token = os.environ['CAMA_COHORT_ACCESS_TOKEN']
|
||||
if len(secret) < 32 or len(token) < 32:
|
||||
raise ValueError('Both the cohort secret and access token must be at least 32 characters')
|
||||
if len(token) < 32:
|
||||
raise ValueError('The access token must be at least 32 characters')
|
||||
if not path.is_file():
|
||||
raise ValueError('The synthetic SQLite database must already exist')
|
||||
|
||||
@@ -47,7 +46,7 @@ app = create_app()
|
||||
|
||||
def read(cutoff):
|
||||
with Session(engine) as session:
|
||||
return CamaCohort(session, secret).rows(cutoff)
|
||||
return CamaCohort(session).rows(cutoff)
|
||||
|
||||
|
||||
def authorized(request):
|
||||
|
||||
@@ -9,20 +9,13 @@ import types
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--database', required=True, help='Existing disposable synthetic SQLite database')
|
||||
parser.add_argument('--secret-file', required=True, help='Persistent local pseudonym secret file')
|
||||
parser.add_argument('--port', type=int, default=5059)
|
||||
args = parser.parse_args()
|
||||
database = Path(args.database).resolve(strict=True)
|
||||
if not database.is_file():
|
||||
raise ValueError('The synthetic database must be an existing file')
|
||||
secret_file = Path(args.secret_file).resolve()
|
||||
if not secret_file.exists():
|
||||
with secret_file.open('x', encoding='ascii') as output:
|
||||
output.write(secrets.token_hex(32))
|
||||
secret = secret_file.read_text(encoding='ascii').strip()
|
||||
token = secrets.token_hex(32)
|
||||
os.environ.update(CAMA_DATABASE_URL='sqlite:///' + database.as_posix(),
|
||||
CAMA_COHORT_SYNTHETIC='1', CAMA_COHORT_SECRET=secret,
|
||||
CAMA_COHORT_ACCESS_TOKEN=token, MLFLOW_DISABLE_AGENT_HINT='1',
|
||||
MLFLOW_DISABLE_TELEMETRY='true')
|
||||
for domain in ('CACU', 'TEA', 'GOVERNANCE'):
|
||||
|
||||
Reference in New Issue
Block a user