Commit ·
3a5ca01
1
Parent(s): 6488653
fix: Fix directory references to use medicode
Browse files- README.md +4 -4
- assets/tailwind.config.js +2 -2
- config/dev.exs +1 -1
- config/runtime.exs +1 -1
- config/test.exs +1 -1
- lib/medicode_web/controllers/error_html.ex +2 -2
- lib/medicode_web/endpoint.ex +1 -1
- lib/medicode_web/telemetry.ex +5 -5
- lib/medicode_web/user_auth.ex +1 -1
- rel/overlays/bin/migrate +1 -1
- rel/overlays/bin/migrate.bat +1 -1
- rel/overlays/bin/server +1 -1
- rel/overlays/bin/server.bat +1 -1
- test/medicode_web/controllers/user_session_controller_test.exs +1 -1
- test/medicode_web/user_auth_test.exs +1 -1
README.md
CHANGED
|
@@ -28,7 +28,7 @@ The app is configured to deploy to Fly.io via a `fly.toml` file. To deploy, run
|
|
| 28 |
To build the code vectors for the ICD-9 codelist for the deployed environment:
|
| 29 |
|
| 30 |
1. Connect to the server with `fly ssh console`.
|
| 31 |
-
2. Run `/app/bin/
|
| 32 |
|
| 33 |
### Livebook
|
| 34 |
|
|
@@ -49,14 +49,14 @@ In addition to connecting to the deployed application via `iex`, Livebook suppor
|
|
| 49 |
- What the initial `1` for `chmod` means: <https://www.linuxnix.com/sticky-bit-set-linux/>
|
| 50 |
- How to update the permissions of a mounted volume: <https://serverfault.com/a/984599>
|
| 51 |
|
| 52 |
-
3. Build the image with: `docker build . -t headwayio/
|
| 53 |
-
4. Run a container with: `docker run --env-file ./.env -p 4000:4000 headwayio/
|
| 54 |
|
| 55 |
### Caveats
|
| 56 |
|
| 57 |
You may need to make a few changes to get the app running in Docker at the moment:
|
| 58 |
|
| 59 |
-
- In `lib/
|
| 60 |
- In `rel/env.sh.eex`, comment out the `ERL_AFLAGS`, `RELEASE_DISTRIBUTION`, and `RELEASE_NODE` environment variables.
|
| 61 |
|
| 62 |
## Learn more
|
|
|
|
| 28 |
To build the code vectors for the ICD-9 codelist for the deployed environment:
|
| 29 |
|
| 30 |
1. Connect to the server with `fly ssh console`.
|
| 31 |
+
2. Run `/app/bin/medicode eval Medicode.Release.precompute_code_vectors`. This will prepare the vectors in the database if they are not present.
|
| 32 |
|
| 33 |
### Livebook
|
| 34 |
|
|
|
|
| 49 |
- What the initial `1` for `chmod` means: <https://www.linuxnix.com/sticky-bit-set-linux/>
|
| 50 |
- How to update the permissions of a mounted volume: <https://serverfault.com/a/984599>
|
| 51 |
|
| 52 |
+
3. Build the image with: `docker build . -t headwayio/medicode`
|
| 53 |
+
4. Run a container with: `docker run --env-file ./.env -p 4000:4000 headwayio/medicode`
|
| 54 |
|
| 55 |
### Caveats
|
| 56 |
|
| 57 |
You may need to make a few changes to get the app running in Docker at the moment:
|
| 58 |
|
| 59 |
+
- In `lib/medicode/application.ex`, comment out the `DNSCluster` child spec.
|
| 60 |
- In `rel/env.sh.eex`, comment out the `ERL_AFLAGS`, `RELEASE_DISTRIBUTION`, and `RELEASE_NODE` environment variables.
|
| 61 |
|
| 62 |
## Learn more
|
assets/tailwind.config.js
CHANGED
|
@@ -10,8 +10,8 @@ module.exports = {
|
|
| 10 |
// important: ".medical-transcription-web",
|
| 11 |
content: [
|
| 12 |
"./js/**/*.js",
|
| 13 |
-
"../lib/
|
| 14 |
-
"../lib/
|
| 15 |
],
|
| 16 |
theme: {
|
| 17 |
extend: {
|
|
|
|
| 10 |
// important: ".medical-transcription-web",
|
| 11 |
content: [
|
| 12 |
"./js/**/*.js",
|
| 13 |
+
"../lib/medicode_web.ex",
|
| 14 |
+
"../lib/medicode_web/**/*.*ex",
|
| 15 |
],
|
| 16 |
theme: {
|
| 17 |
extend: {
|
config/dev.exs
CHANGED
|
@@ -57,7 +57,7 @@ config :medicode, MedicodeWeb.Endpoint,
|
|
| 57 |
patterns: [
|
| 58 |
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
|
| 59 |
~r"priv/gettext/.*(po)$",
|
| 60 |
-
~r"lib/
|
| 61 |
~r"storybook/.*(exs)$"
|
| 62 |
]
|
| 63 |
]
|
|
|
|
| 57 |
patterns: [
|
| 58 |
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
|
| 59 |
~r"priv/gettext/.*(po)$",
|
| 60 |
+
~r"lib/medicode_web/(controllers|live|components)/.*(ex|heex)$",
|
| 61 |
~r"storybook/.*(exs)$"
|
| 62 |
]
|
| 63 |
]
|
config/runtime.exs
CHANGED
|
@@ -12,7 +12,7 @@ import Config
|
|
| 12 |
# If you use `mix release`, you need to explicitly enable the server
|
| 13 |
# by passing the PHX_SERVER=true when you start it:
|
| 14 |
#
|
| 15 |
-
# PHX_SERVER=true bin/
|
| 16 |
#
|
| 17 |
# Alternatively, you can use `mix phx.gen.release` to generate a `bin/server`
|
| 18 |
# script that automatically sets the env var above.
|
|
|
|
| 12 |
# If you use `mix release`, you need to explicitly enable the server
|
| 13 |
# by passing the PHX_SERVER=true when you start it:
|
| 14 |
#
|
| 15 |
+
# PHX_SERVER=true bin/medicode start
|
| 16 |
#
|
| 17 |
# Alternatively, you can use `mix phx.gen.release` to generate a `bin/server`
|
| 18 |
# script that automatically sets the env var above.
|
config/test.exs
CHANGED
|
@@ -16,7 +16,7 @@ if System.get_env("DATABASE_URL") do
|
|
| 16 |
else
|
| 17 |
config :medicode, Medicode.Repo,
|
| 18 |
hostname: "localhost",
|
| 19 |
-
database: "
|
| 20 |
pool: Ecto.Adapters.SQL.Sandbox,
|
| 21 |
pool_size: 10
|
| 22 |
end
|
|
|
|
| 16 |
else
|
| 17 |
config :medicode, Medicode.Repo,
|
| 18 |
hostname: "localhost",
|
| 19 |
+
database: "medicode_test#{System.get_env("MIX_TEST_PARTITION")}",
|
| 20 |
pool: Ecto.Adapters.SQL.Sandbox,
|
| 21 |
pool_size: 10
|
| 22 |
end
|
lib/medicode_web/controllers/error_html.ex
CHANGED
|
@@ -5,8 +5,8 @@ defmodule MedicodeWeb.ErrorHTML do
|
|
| 5 |
# uncomment the embed_templates/1 call below
|
| 6 |
# and add pages to the error directory:
|
| 7 |
#
|
| 8 |
-
# * lib/
|
| 9 |
-
# * lib/
|
| 10 |
#
|
| 11 |
embed_templates "error_html/*"
|
| 12 |
|
|
|
|
| 5 |
# uncomment the embed_templates/1 call below
|
| 6 |
# and add pages to the error directory:
|
| 7 |
#
|
| 8 |
+
# * lib/medicode_web/controllers/error_html/404.html.heex
|
| 9 |
+
# * lib/medicode_web/controllers/error_html/500.html.heex
|
| 10 |
#
|
| 11 |
embed_templates "error_html/*"
|
| 12 |
|
lib/medicode_web/endpoint.ex
CHANGED
|
@@ -6,7 +6,7 @@ defmodule MedicodeWeb.Endpoint do
|
|
| 6 |
# Set :encryption_salt if you would also like to encrypt it.
|
| 7 |
@session_options [
|
| 8 |
store: :cookie,
|
| 9 |
-
key: "
|
| 10 |
signing_salt: "s8MyOPRO",
|
| 11 |
same_site: "Lax"
|
| 12 |
]
|
|
|
|
| 6 |
# Set :encryption_salt if you would also like to encrypt it.
|
| 7 |
@session_options [
|
| 8 |
store: :cookie,
|
| 9 |
+
key: "_medicode_key",
|
| 10 |
signing_salt: "s8MyOPRO",
|
| 11 |
same_site: "Lax"
|
| 12 |
]
|
lib/medicode_web/telemetry.ex
CHANGED
|
@@ -52,23 +52,23 @@ defmodule MedicodeWeb.Telemetry do
|
|
| 52 |
),
|
| 53 |
|
| 54 |
# Database Metrics
|
| 55 |
-
summary("
|
| 56 |
unit: {:native, :millisecond},
|
| 57 |
description: "The sum of the other measurements"
|
| 58 |
),
|
| 59 |
-
summary("
|
| 60 |
unit: {:native, :millisecond},
|
| 61 |
description: "The time spent decoding the data received from the database"
|
| 62 |
),
|
| 63 |
-
summary("
|
| 64 |
unit: {:native, :millisecond},
|
| 65 |
description: "The time spent executing the query"
|
| 66 |
),
|
| 67 |
-
summary("
|
| 68 |
unit: {:native, :millisecond},
|
| 69 |
description: "The time spent waiting for a database connection"
|
| 70 |
),
|
| 71 |
-
summary("
|
| 72 |
unit: {:native, :millisecond},
|
| 73 |
description:
|
| 74 |
"The time the connection spent waiting before being checked out for the query"
|
|
|
|
| 52 |
),
|
| 53 |
|
| 54 |
# Database Metrics
|
| 55 |
+
summary("medicode.repo.query.total_time",
|
| 56 |
unit: {:native, :millisecond},
|
| 57 |
description: "The sum of the other measurements"
|
| 58 |
),
|
| 59 |
+
summary("medicode.repo.query.decode_time",
|
| 60 |
unit: {:native, :millisecond},
|
| 61 |
description: "The time spent decoding the data received from the database"
|
| 62 |
),
|
| 63 |
+
summary("medicode.repo.query.query_time",
|
| 64 |
unit: {:native, :millisecond},
|
| 65 |
description: "The time spent executing the query"
|
| 66 |
),
|
| 67 |
+
summary("medicode.repo.query.queue_time",
|
| 68 |
unit: {:native, :millisecond},
|
| 69 |
description: "The time spent waiting for a database connection"
|
| 70 |
),
|
| 71 |
+
summary("medicode.repo.query.idle_time",
|
| 72 |
unit: {:native, :millisecond},
|
| 73 |
description:
|
| 74 |
"The time the connection spent waiting before being checked out for the query"
|
lib/medicode_web/user_auth.ex
CHANGED
|
@@ -14,7 +14,7 @@ defmodule MedicodeWeb.UserAuth do
|
|
| 14 |
# If you want bump or reduce this value, also change
|
| 15 |
# the token expiry itself in UserToken.
|
| 16 |
@max_age 60 * 60 * 24 * 60
|
| 17 |
-
@remember_me_cookie "
|
| 18 |
@remember_me_options [sign: true, max_age: @max_age, same_site: "Lax"]
|
| 19 |
|
| 20 |
@doc """
|
|
|
|
| 14 |
# If you want bump or reduce this value, also change
|
| 15 |
# the token expiry itself in UserToken.
|
| 16 |
@max_age 60 * 60 * 24 * 60
|
| 17 |
+
@remember_me_cookie "_medicode_web_user_remember_me"
|
| 18 |
@remember_me_options [sign: true, max_age: @max_age, same_site: "Lax"]
|
| 19 |
|
| 20 |
@doc """
|
rel/overlays/bin/migrate
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
#!/bin/sh
|
| 2 |
cd -P -- "$(dirname -- "$0")"
|
| 3 |
-
exec ./
|
|
|
|
| 1 |
#!/bin/sh
|
| 2 |
cd -P -- "$(dirname -- "$0")"
|
| 3 |
+
exec ./medicode eval Medicode.Release.migrate
|
rel/overlays/bin/migrate.bat
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
call "%~dp0\
|
|
|
|
| 1 |
+
call "%~dp0\medicode" eval Medicode.Release.migrate
|
rel/overlays/bin/server
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
#!/bin/sh
|
| 2 |
cd -P -- "$(dirname -- "$0")"
|
| 3 |
-
PHX_SERVER=true exec ./
|
|
|
|
| 1 |
#!/bin/sh
|
| 2 |
cd -P -- "$(dirname -- "$0")"
|
| 3 |
+
PHX_SERVER=true exec ./medicode start
|
rel/overlays/bin/server.bat
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
set PHX_SERVER=true
|
| 2 |
-
call "%~dp0\
|
|
|
|
| 1 |
set PHX_SERVER=true
|
| 2 |
+
call "%~dp0\medicode" start
|
test/medicode_web/controllers/user_session_controller_test.exs
CHANGED
|
@@ -35,7 +35,7 @@ defmodule MedicodeWeb.UserSessionControllerTest do
|
|
| 35 |
}
|
| 36 |
})
|
| 37 |
|
| 38 |
-
assert conn.resp_cookies["
|
| 39 |
assert redirected_to(conn) == ~p"/"
|
| 40 |
end
|
| 41 |
|
|
|
|
| 35 |
}
|
| 36 |
})
|
| 37 |
|
| 38 |
+
assert conn.resp_cookies["_medicode_web_user_remember_me"]
|
| 39 |
assert redirected_to(conn) == ~p"/"
|
| 40 |
end
|
| 41 |
|
test/medicode_web/user_auth_test.exs
CHANGED
|
@@ -7,7 +7,7 @@ defmodule MedicodeWeb.UserAuthTest do
|
|
| 7 |
|
| 8 |
import Medicode.AccountsFixtures
|
| 9 |
|
| 10 |
-
@remember_me_cookie "
|
| 11 |
|
| 12 |
setup %{conn: conn} do
|
| 13 |
conn =
|
|
|
|
| 7 |
|
| 8 |
import Medicode.AccountsFixtures
|
| 9 |
|
| 10 |
+
@remember_me_cookie "_medicode_web_user_remember_me"
|
| 11 |
|
| 12 |
setup %{conn: conn} do
|
| 13 |
conn =
|