hexsha
stringlengths
40
40
size
int64
2
991k
ext
stringclasses
2 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
4
208
max_stars_repo_name
stringlengths
6
106
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
list
max_stars_count
int64
1
33.5k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
4
208
max_issues_repo_name
stringlengths
6
106
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
list
max_issues_count
int64
1
16.3k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
4
208
max_forks_repo_name
stringlengths
6
106
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
list
max_forks_count
int64
1
6.91k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
2
991k
avg_line_length
float64
1
36k
max_line_length
int64
1
977k
alphanum_fraction
float64
0
1
0350ff64c786b768454d20494cdc13da632e7439
194
ex
Elixir
lib/messaging_status_service_web/views/api/call_view.ex
ciroque/messaging_status_service
0d32873ac6e0a78c92a5cf08da373ba4aaf22da4
[ "MIT" ]
null
null
null
lib/messaging_status_service_web/views/api/call_view.ex
ciroque/messaging_status_service
0d32873ac6e0a78c92a5cf08da373ba4aaf22da4
[ "MIT" ]
null
null
null
lib/messaging_status_service_web/views/api/call_view.ex
ciroque/messaging_status_service
0d32873ac6e0a78c92a5cf08da373ba4aaf22da4
[ "MIT" ]
null
null
null
defmodule MessagingStatusServiceWeb.Api.CallView do use MessagingStatusServiceWeb, :view def render("create.json", %{}) do [] end def render("index.json", %{}) do [] end end
16.166667
51
0.664948
0351057aa83ca032b1f2efa98500e9fd757a3aba
132
exs
Elixir
Dining/philo/test/philo_test.exs
andfoy/cpd-exercises
f36ac16c74bb980d7edd6aaf5661a6d4d4b09489
[ "MIT" ]
null
null
null
Dining/philo/test/philo_test.exs
andfoy/cpd-exercises
f36ac16c74bb980d7edd6aaf5661a6d4d4b09489
[ "MIT" ]
null
null
null
Dining/philo/test/philo_test.exs
andfoy/cpd-exercises
f36ac16c74bb980d7edd6aaf5661a6d4d4b09489
[ "MIT" ]
null
null
null
defmodule PhiloTest do use ExUnit.Case doctest Philo test "greets the world" do assert Philo.hello() == :world end end
14.666667
34
0.69697
035128aba09413255f7cb50b707366b0a6934637
96
exs
Elixir
test/coop_minesweeper_web/views/page_view_test.exs
sdoering01/coop_minesweeper
4fc7265c3734584f93a325c2ceaa172da578f7a5
[ "MIT" ]
null
null
null
test/coop_minesweeper_web/views/page_view_test.exs
sdoering01/coop_minesweeper
4fc7265c3734584f93a325c2ceaa172da578f7a5
[ "MIT" ]
null
null
null
test/coop_minesweeper_web/views/page_view_test.exs
sdoering01/coop_minesweeper
4fc7265c3734584f93a325c2ceaa172da578f7a5
[ "MIT" ]
null
null
null
defmodule CoopMinesweeperWeb.PageViewTest do use CoopMinesweeperWeb.ConnCase, async: true end
24
46
0.854167
0351404fe3dea146d0d4c6a6ce0f771d97abab3c
138
exs
Elixir
test/mixduty_test.exs
bradediger/mixduty
7dd18dc4b7166a362a00cba7da038fe337cc5923
[ "MIT" ]
null
null
null
test/mixduty_test.exs
bradediger/mixduty
7dd18dc4b7166a362a00cba7da038fe337cc5923
[ "MIT" ]
null
null
null
test/mixduty_test.exs
bradediger/mixduty
7dd18dc4b7166a362a00cba7da038fe337cc5923
[ "MIT" ]
1
2020-03-20T16:49:17.000Z
2020-03-20T16:49:17.000Z
defmodule MixdutyTest do use ExUnit.Case doctest Mixduty test "greets the world" do assert Mixduty.hello() == :world end end
15.333333
36
0.710145
035175fd6b86259c0259a261c8c7f32c14d0f7cb
568
exs
Elixir
test/deck_test.exs
Danwhy/blackjack
f4a39c4bf4311f10c85bc969711180bacabef992
[ "MIT" ]
null
null
null
test/deck_test.exs
Danwhy/blackjack
f4a39c4bf4311f10c85bc969711180bacabef992
[ "MIT" ]
null
null
null
test/deck_test.exs
Danwhy/blackjack
f4a39c4bf4311f10c85bc969711180bacabef992
[ "MIT" ]
null
null
null
defmodule DeckTest do use ExUnit.Case alias Blackjack.Deck test "create a deck" do deck = Deck.create_deck() assert length(deck) == 52 end test "handle end of deck" do deck = [] {deck, hand} = Deck.deal(deck) assert hand == nil assert deck == [] end test "deal hands" do deck = Deck.create_deck() {deck, hand} = Deck.deal(deck) assert length(deck) == 50 assert length(hand) == 2 {deck, hand_2} = Deck.deal(deck) assert length(deck) == 48 assert length(Enum.uniq(hand ++ hand_2)) == 4 end end
17.75
49
0.605634
0351a276443c85e6855ca358e8e3476c851ede5b
1,705
ex
Elixir
RAEM/raem/lib/raem_web/controllers/enade_controller.ex
pedromcorreia/Rumo-ao-ensino-superior
be0b9bf417604bdf8a349fde8a8a1c0aaf4c4cdb
[ "MIT" ]
null
null
null
RAEM/raem/lib/raem_web/controllers/enade_controller.ex
pedromcorreia/Rumo-ao-ensino-superior
be0b9bf417604bdf8a349fde8a8a1c0aaf4c4cdb
[ "MIT" ]
null
null
null
RAEM/raem/lib/raem_web/controllers/enade_controller.ex
pedromcorreia/Rumo-ao-ensino-superior
be0b9bf417604bdf8a349fde8a8a1c0aaf4c4cdb
[ "MIT" ]
2
2018-02-24T19:56:21.000Z
2018-02-26T00:16:41.000Z
defmodule RaemWeb.EnadeController do use RaemWeb, :controller alias Raem.Enades alias Raem.Enades.Enade def index(conn, _params) do enades = Enades.list_enades() render(conn, "index.html", enades: enades) end def new(conn, _params) do changeset = Enades.change_enade(%Enade{}) render(conn, "new.html", changeset: changeset) end def create(conn, %{"enade" => enade_params}) do case Enades.create_enade(enade_params) do {:ok, enade} -> conn |> put_flash(:info, "Enade created successfully.") |> redirect(to: enade_path(conn, :show, enade)) {:error, %Ecto.Changeset{} = changeset} -> render(conn, "new.html", changeset: changeset) end end def show(conn, %{"id" => id}) do enade = Enades.get_enade!(id) render(conn, "show.html", enade: enade) end def edit(conn, %{"id" => id}) do enade = Enades.get_enade!(id) changeset = Enades.change_enade(enade) render(conn, "edit.html", enade: enade, changeset: changeset) end def update(conn, %{"id" => id, "enade" => enade_params}) do enade = Enades.get_enade!(id) case Enades.update_enade(enade, enade_params) do {:ok, enade} -> conn |> put_flash(:info, "Enade updated successfully.") |> redirect(to: enade_path(conn, :show, enade)) {:error, %Ecto.Changeset{} = changeset} -> render(conn, "edit.html", enade: enade, changeset: changeset) end end def delete(conn, %{"id" => id}) do enade = Enades.get_enade!(id) {:ok, _enade} = Enades.delete_enade(enade) conn |> put_flash(:info, "Enade deleted successfully.") |> redirect(to: enade_path(conn, :index)) end end
27.95082
69
0.626979
0351c02be077848b9e201a406f5c9986d5178857
2,102
ex
Elixir
clients/plus/lib/google_api/plus/v1/model/place.ex
matehat/elixir-google-api
c1b2523c2c4cdc9e6ca4653ac078c94796b393c3
[ "Apache-2.0" ]
1
2018-12-03T23:43:10.000Z
2018-12-03T23:43:10.000Z
clients/plus/lib/google_api/plus/v1/model/place.ex
matehat/elixir-google-api
c1b2523c2c4cdc9e6ca4653ac078c94796b393c3
[ "Apache-2.0" ]
null
null
null
clients/plus/lib/google_api/plus/v1/model/place.ex
matehat/elixir-google-api
c1b2523c2c4cdc9e6ca4653ac078c94796b393c3
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This class is auto generated by the elixir code generator program. # Do not edit the class manually. defmodule GoogleApi.Plus.V1.Model.Place do @moduledoc """ ## Attributes * `address` (*type:* `GoogleApi.Plus.V1.Model.PlaceAddress.t`, *default:* `nil`) - The physical address of the place. * `displayName` (*type:* `String.t`, *default:* `nil`) - The display name of the place. * `id` (*type:* `String.t`, *default:* `nil`) - The id of the place. * `kind` (*type:* `String.t`, *default:* `plus#place`) - Identifies this resource as a place. Value: "plus#place". * `position` (*type:* `GoogleApi.Plus.V1.Model.PlacePosition.t`, *default:* `nil`) - The position of the place. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :address => GoogleApi.Plus.V1.Model.PlaceAddress.t(), :displayName => String.t(), :id => String.t(), :kind => String.t(), :position => GoogleApi.Plus.V1.Model.PlacePosition.t() } field(:address, as: GoogleApi.Plus.V1.Model.PlaceAddress) field(:displayName) field(:id) field(:kind) field(:position, as: GoogleApi.Plus.V1.Model.PlacePosition) end defimpl Poison.Decoder, for: GoogleApi.Plus.V1.Model.Place do def decode(value, options) do GoogleApi.Plus.V1.Model.Place.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.Plus.V1.Model.Place do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
35.627119
121
0.689343
0351d94f4d772f744e581b7b2337c462bc5e4598
2,050
ex
Elixir
lib/20_run/running_example.ex
marick/ecto_test_dsl
6d460af093367098b7c78db709753deb45904d77
[ "Unlicense" ]
4
2021-02-09T17:26:34.000Z
2021-08-08T01:42:52.000Z
lib/20_run/running_example.ex
marick/transformer_test_support
6d460af093367098b7c78db709753deb45904d77
[ "Unlicense" ]
null
null
null
lib/20_run/running_example.ex
marick/transformer_test_support
6d460af093367098b7c78db709753deb45904d77
[ "Unlicense" ]
null
null
null
defmodule EctoTestDSL.Run.RunningExample do use EctoTestDSL.Drink.Me use EctoTestDSL.Drink.AndRun use EctoTestDSL.Drink.Assertively import MockeryExtras.Getters @enforce_keys [:example, :history] defstruct [:example, :history, script: :none_just_testing, tracer: :none] getters :example, [ eens: [], validation_changeset_checks: [], constraint_changeset_checks: [], result_fields: %{}, postcheck: nil, result_matches: :unused, ] getters :example, :metadata, [ :as_cast, :field_calculators, :name, :repo, :workflow_name, :variant, :format, :api_module, :usually_ignore, :insert_with, :changeset_with, :changeset_for_update_with, :update_with, :get_primary_key_with, :struct_for_update_with, :existing_ids_with ] getter :original_params, for: [:example, :params] def step_value!(~M{history}, step_name), do: History.fetch!(history, step_name) # A correct RunningExample will always match the above. If the first # argument does not, we are most likely mocking incorrectly. def step_value!(mocked, step_name) do elaborate_flunk("There does not seem to be a `step_value!` stub for `#{inspect step_name}`", left: "step_value!(#{inspect mocked}, #{inspect step_name})") end # Conveniences for history values we know will always have the same name. # Possibly a bad idea. def neighborhood(running), do: step_value!(running, :repo_setup) def expanded_params(running), do: step_value!(running, :params) def formatted_params(running) do expanded_params(running) |> Run.Params.format(format(running)) end def schema(running) do direct = Map.get(running.example.metadata, :schema) direct || api_module(running) end # ---------------------------------------------------------------------------- def from(example, opts \\ []) do %RunningExample{ example: example, script: Keyword.get(opts, :script, []), history: Keyword.get(opts, :history, History.new(example)) } end end
31.060606
96
0.670732
0351faf1950fa2717683cc6cb760eae2d7a1277e
2,076
exs
Elixir
clients/runtime_config/mix.exs
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
1
2021-12-20T03:40:53.000Z
2021-12-20T03:40:53.000Z
clients/runtime_config/mix.exs
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
1
2020-08-18T00:11:23.000Z
2020-08-18T00:44:16.000Z
clients/runtime_config/mix.exs
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.RuntimeConfig.Mixfile do use Mix.Project @version "0.13.0" def project() do [ app: :google_api_runtime_config, version: @version, elixir: "~> 1.6", build_embedded: Mix.env == :prod, start_permanent: Mix.env == :prod, description: description(), package: package(), deps: deps(), source_url: "https://github.com/googleapis/elixir-google-api/tree/master/clients/runtime_config" ] end def application() do [extra_applications: [:logger]] end defp deps() do [ {:google_gax, "~> 0.4"}, {:ex_doc, "~> 0.16", only: :dev} ] end defp description() do """ Cloud Runtime Configuration API client library. The Runtime Configurator allows you to dynamically configure and expose variables through Google Cloud Platform. In addition, you can also set Watchers and Waiters that will watch for changes to your data and return based on certain conditions. """ end defp package() do [ files: ["lib", "mix.exs", "README*", "LICENSE"], maintainers: ["Jeff Ching", "Daniel Azuma"], licenses: ["Apache 2.0"], links: %{ "GitHub" => "https://github.com/googleapis/elixir-google-api/tree/master/clients/runtime_config", "Homepage" => "https://cloud.google.com/deployment-manager/runtime-configurator/" } ] end end
30.985075
296
0.678709
0352006523e660dc2e1c61b2cce3cd95f68764ca
291
ex
Elixir
lib/bloggex_web/controllers/admin/dashboard_controller.ex
dreamingechoes/bloggex
9ead10ec1fd8fda0da3cb08106c43a9043188199
[ "MIT" ]
1
2020-01-14T03:17:51.000Z
2020-01-14T03:17:51.000Z
lib/bloggex_web/controllers/admin/dashboard_controller.ex
dreamingechoes/bloggex
9ead10ec1fd8fda0da3cb08106c43a9043188199
[ "MIT" ]
null
null
null
lib/bloggex_web/controllers/admin/dashboard_controller.ex
dreamingechoes/bloggex
9ead10ec1fd8fda0da3cb08106c43a9043188199
[ "MIT" ]
null
null
null
defmodule BloggexWeb.Admin.DashboardController do use BloggexWeb, :controller alias Bloggex.Accounts.Schemas.User alias Bloggex.Repo def index(conn, _params) do with users <- Repo.aggregate(User, :count, :id) do render(conn, "index.html", users: users) end end end
22.384615
54
0.718213
0352301582ce09b6d814a0654181bfa573b06fd9
15,353
ex
Elixir
lib/cforum/users.ex
MatthiasApsel/cforum_ex
52c621a583182d82692b74694b0b2792ac23b8ff
[ "MIT" ]
null
null
null
lib/cforum/users.ex
MatthiasApsel/cforum_ex
52c621a583182d82692b74694b0b2792ac23b8ff
[ "MIT" ]
null
null
null
lib/cforum/users.ex
MatthiasApsel/cforum_ex
52c621a583182d82692b74694b0b2792ac23b8ff
[ "MIT" ]
null
null
null
defmodule Cforum.Users do @moduledoc """ The boundary for the Accounts.Users system. """ import Ecto.Query, warn: false use Cforum.Constants alias Cforum.Repo alias Cforum.Users.User alias Cforum.Badges.Badge alias Cforum.Settings alias Cforum.Groups alias Cforum.Caching alias Cforum.Threads.ThreadCaching def discard_user_cache(%User{} = user) do Caching.del(:cforum, "users/#{user.user_id}") user end def discard_user_cache({:ok, user}) do Caching.del(:cforum, "users/#{user.user_id}") {:ok, user} end def discard_user_cache(val), do: val @doc """ Returns the list of users. ## Parameters - query_params: an option list containing a `order` and a `limit` option, describing the sort order and the offset/limit ## Examples iex> list_users() [%User{}, ...] """ def list_users(query_params \\ [order: nil, limit: nil, search: nil, include_self: true, user: nil, prefix: false]) do User |> Cforum.PagingApi.set_limit(query_params[:limit]) |> Cforum.OrderApi.set_ordering(query_params[:order], desc: :created_at) |> search_users(query_params[:search], query_params[:prefix]) |> maybe_leave_out_self(!query_params[:include_self], query_params[:user]) |> Repo.all() end def all_users() do from(user in User, order_by: [asc: :user_id]) |> Repo.all() end defp maybe_leave_out_self(q, false, _), do: q defp maybe_leave_out_self(q, _, nil), do: q defp maybe_leave_out_self(q, _, self), do: from(u in q, where: u.user_id != ^self.user_id) defp search_users(query, term, _) when is_nil(term) or term == "", do: query defp search_users(query, term, prefix) do clean_term = if prefix, do: String.trim(term) <> "%", else: "%" <> String.trim(term) <> "%" from(u in query, where: like(fragment("LOWER(?)", u.username), fragment("LOWER(?)", ^clean_term))) end def list_users_by_config_option(option, value) do from(user in User, join: setting in assoc(user, :settings), where: fragment("?->>? = ?", setting.options, ^option, ^value) ) |> Repo.all() end def get_users(ids, query_params \\ [order: nil]) do from(user in User, where: user.user_id in ^ids) |> Cforum.OrderApi.set_ordering(query_params[:order], desc: :created_at) |> Repo.all() end @doc """ Returns the number of users ## Examples iex> count_users() 0 """ def count_users do User |> select(count("*")) |> Repo.one() end @doc """ Gets a single user. Raises `Ecto.NoResultsError` if the User does not exist. ## Examples iex> get_user!(123) %User{} iex> get_user!(456) ** (Ecto.NoResultsError) """ def get_user!(id) do Caching.fetch(:cforum, "users/#{id}", fn -> from(u in User, preload: [:settings, :badges, [badges_users: :badge]], where: u.user_id == ^id) |> Repo.one!() end) end @doc """ Gets a single user. Returns `nil` if the User does not exist. ## Examples iex> get_user(123) %User{} iex> get_user(456) nil """ def get_user(id) do Caching.fetch(:cforum, "users/#{id}", fn -> from(u in User, preload: [:settings, :badges, [badges_users: :badge]], where: u.user_id == ^id) |> Repo.one() end) end def get_user_by_username(username, preloads \\ []) do from(u in User, preload: ^preloads, where: fragment("lower(?)", u.username) == fragment("lower(?)", ^username)) |> Repo.one() end @doc """ Gets the first user matching in either the username or the email column Returns nil if no user could be found ## Examples iex> get_user_user_by_username_or_email("Luke") %User{} iex> get_user_user_by_username_or_email("luke@example.org") %User{} iex> get_user_user_by_username_or_email("luke@aldebaran.gov") nil """ def get_user_by_username_or_email(login) do from( user in User, preload: [:settings, :badges, [badges_users: :badge]], where: user.active == true and (fragment("lower(?)", user.email) == fragment("lower(?)", ^login) or fragment("lower(?)", user.username) == fragment("lower(?)", ^login)) ) |> Repo.one() end @doc """ Gets a single user by a `reset_password_token`. Raises `Ecto.NoResultsError` if the User does not exist. ## Examples iex> get_user_by_reset_password_token!("aoeuaoeu") %User{} iex> get_user_by_reset_password_token!("nonexistant") ** (Ecto.NoResultsError) """ def get_user_by_reset_password_token!(reset_token) do Repo.get_by!(User, reset_password_token: reset_token) end @doc """ Creates a user. ## Examples iex> create_user(%{field: value}) {:ok, %User{}} iex> create_user(%{field: bad_value}) {:error, %Ecto.Changeset{}} """ def create_user(attrs) do Cforum.System.audited("create", nil, fn -> %User{} |> User.changeset(attrs) |> Repo.insert() end) |> Settings.discard_settings_cache() |> discard_user_cache() end @doc """ Creates a new user as allowed by admins. ## Examples iex> create_user(%{field: value}) {:ok, %User{}} iex> create_user(%{field: bad_value}) {:error, %Ecto.Changeset{}} """ def admin_create_user(current_user, attrs) do Cforum.System.audited("create", current_user, fn -> %User{} |> User.admin_changeset(attrs) |> Repo.insert() end) |> Settings.discard_settings_cache() |> discard_user_cache() end @doc """ Updates a user. ## Examples iex> update_user(user, %{field: new_value}) {:ok, %User{}} iex> update_user(user, %{field: bad_value}) {:error, %Ecto.Changeset{}} """ def update_user(%User{} = user, attrs) do user |> User.changeset(attrs) |> Repo.update() |> Settings.discard_settings_cache() |> discard_user_cache() |> ThreadCaching.refresh_cached_thread() end def update_last_visit(%User{} = user) do t = Timex.now() retval = from(user in User, where: user.user_id == ^user.user_id) |> Repo.update_all(set: [last_visit: t, inactivity_notification_sent_at: nil]) with {1, v} <- retval do Caching.update( :cforum, "users/#{user.user_id}", &{:commit, %User{&1 | last_visit: t, inactivity_notification_sent_at: nil}} ) {1, v} end end @doc """ Updates a user as allowed for admins. ## Examples iex> admin_update_user(user, %{field: new_value}) {:ok, %User{}} iex> admin_update_user(user, %{field: bad_value}) {:error, %Ecto.Changeset{}} """ def admin_update_user(current_user, %User{} = user, attrs) do Cforum.System.audited("update", current_user, fn -> user |> User.admin_changeset(attrs) |> Repo.update() end) |> Settings.discard_settings_cache() |> discard_user_cache() |> ThreadCaching.refresh_cached_thread() end @doc """ Updates the password of a user. ## Examples iex> update_user_password(user, %{password: new_value, password_confirmation: new_value}) {:ok, %User{}} iex> update_user_password(user, %{password: new_value, password_confirmation: other_value}) {:error, %Ecto.Changeset{}} """ def update_user_password(%User{} = user, attrs) do user |> User.password_changeset(attrs) |> Ecto.Changeset.change(%{reset_password_token: nil, reset_password_sent_at: nil}) |> Repo.update() |> discard_user_cache() end @doc """ Updates the `reset_password_token` of a user. ## Examples iex> update_user_password(user, %{reset_password_token: "111", reset_password_sent_at: Timex.now}) {:ok, %User{}} iex> update_user_password(user, %{reset_password_token: nil, reset_password_sent_at: Timex.now}) {:error, %Ecto.Changeset{}} """ def update_user_reset_password_token(%User{} = user, attrs) do user |> User.reset_password_token_changeset(attrs) |> Repo.update() |> discard_user_cache() end @doc """ Deletes a User. ## Examples iex> delete_user(user) {:ok, %User{}} iex> delete_user(user) {:error, %Ecto.Changeset{}} """ def delete_user(current_user, %User{} = user) do {:ok, user} = user |> Ecto.Changeset.change(%{active: false}) |> Repo.update() Cforum.Jobs.DeleteUserJob.enqueue(user, current_user) {:ok, user} end @doc """ Returns an `%Ecto.Changeset{}` for tracking user changes. ## Examples iex> change_user(user) %Ecto.Changeset{source: %User{}} """ def change_user(%User{} = user) do User.changeset(user, %{}) end @doc """ Returns an `%Ecto.Changeset{}` for tracking user changes as allowed for admins. ## Examples iex> admin_change_user(user) %Ecto.Changeset{source: %User{}} """ def admin_change_user(%User{} = user) do User.changeset(user, %{}) end @doc """ Returns an `%Ecto.Changeset{}` for tracking user password changes. ## Examples iex> change_user_password(user) %Ecto.Changeset{source: %User{}} """ def change_user_password(%User{} = user) do User.password_changeset(user, %{}) end @doc """ Registers a new user (creates an uncorfirmed new user) ## Examples iex> register_user(%{field: value}) {:ok, %User{}} iex> register_user(%{field: bad_value}) {:error, %Ecto.Changeset{}} """ def register_user(attrs) do Cforum.System.audited("create", nil, fn -> %User{active: true} |> User.register_changeset(attrs) |> Repo.insert() end) |> Settings.discard_settings_cache() |> discard_user_cache() end @doc """ Confirms an unconfirmed user ## Examples iex> confirm_user("auaoeu") {:ok, %User{}} iex> confirm_user("nonexistant") {:error, nil} """ def confirm_user(token) do case Repo.get_by(User, confirmation_token: token) do nil -> {:error, nil} user -> Cforum.System.audited("confirm", user, fn -> User.confirmation_changeset(user, %{confirmed_at: Timex.now(), confirmation_token: nil}) |> Repo.update() end) end |> discard_user_cache() end @doc """ Generates a new `reset_password_token` for a user ## Examples iex> get_reset_password_token(%User{}) %User{} """ def get_reset_password_token(user) do token = :crypto.strong_rand_bytes(32) |> Base.encode64() |> binary_part(0, 32) {:ok, user} = update_user_reset_password_token(user, %{reset_password_token: token, reset_password_sent_at: Timex.now()}) discard_user_cache({:ok, user}) user end @doc """ Returns a list of unique badges for a user ## Examples iex> unique_badges(user) [%Badge{}, ...] """ def unique_badges(user) do user.badges_users |> Enum.reduce(%{}, fn bu, acc -> Map.update( acc, bu.badge_id, %{badge: bu.badge, created_at: bu.created_at, times: 1}, &%{&1 | times: &1.times + 1} ) end) |> Map.values() |> Enum.sort(&(&1[:times] >= &2[:times])) end @doc """ Returns the configuration value for the directive specified by `config_name`; if the user is nil or has no settings of that name it returns the default value from the `Cforum.ConfigManager` ## Examples iex> conf(%User{}, "foo") "yes" """ def conf(user, config_name) def conf(nil, name), do: Cforum.ConfigManager.defaults()[name] def conf(%User{settings: nil}, name), do: Cforum.ConfigManager.defaults()[name] def conf(%User{settings: settings}, name) do settings.options[name] || Cforum.ConfigManager.defaults()[name] end @doc """ Authenticates a user specified by the login (email or username) and the password ## Examples iex> authenticate_user("luke", "foobar") {:ok, %User{}} iex> authenticate_user("luke", "wrong") {:error, %Ecto.Changeset{}} """ def authenticate_user(login, password) do user = get_user_by_username_or_email(login) cond do user && Comeonin.Bcrypt.checkpw(password, user.encrypted_password) -> {:ok, user} user -> {:error, User.login_changeset(user, %{"login" => login, "password" => password})} true -> # just waste some time for timing sidechannel attacks Comeonin.Bcrypt.dummy_checkpw() {:error, User.login_changeset(%User{}, %{"login" => login, "password" => password})} end end @doc """ Returns true if the user has a badge of the type specified by `badge` ## Examples iex> badge?(%User{}, "seo_profi") true iex> badge?(%User{}, "seo_profi") false """ def badge?(user, badge, active \\ true) def badge?(user, %Badge{} = badge, active), do: Enum.find(user.badges_users, &(&1.badge_id == badge.badge_id && check_active(active, &1.active))) != nil def badge?(user, {key, value}, active), do: Enum.find(user.badges_users, &(Map.get(&1.badge, key) == value && check_active(active, &1.active))) != nil def badge?(user, badge, active), do: Enum.find(user.badges_users, &(&1.badge.badge_type == badge && check_active(active, &1.active))) != nil defp check_active(false, _), do: true defp check_active(true, true), do: true defp check_active(_, _), do: false @doc """ Returns true if the user is a moderator (in any forum) ## Examples iex> moderator?(%User{admin: true}) true iex> moderator?(%User{}) false """ def moderator?(nil), do: false def moderator?(%User{admin: true}), do: true def moderator?(user) do cond do badge?(user, @badge_moderator_tools) -> true Groups.permission?(Groups.list_permissions_for_user(user), @permission_moderate) -> true true -> false end end def list_moderators() do from(u in User, where: u.admin == true or u.user_id in fragment( "SELECT user_id FROM groups_users WHERE group_id IN (SELECT group_id FROM forums_groups_permissions WHERE permission = ?)", ^@permission_moderate ) or u.user_id in fragment( "SELECT user_id FROM badges_users INNER JOIN badges USING(badge_id) WHERE badge_type = ?", ^@badge_moderator_tools ), order_by: [asc: :username] ) |> Repo.all() end def list_moderators(forum) do from(u in User, where: u.admin == true or u.user_id in fragment( "SELECT user_id FROM groups_users WHERE group_id IN (SELECT group_id FROM forums_groups_permissions WHERE permission = ? AND forum_id = ?)", ^@permission_moderate, ^forum.forum_id ) or u.user_id in fragment( "SELECT user_id FROM badges_users INNER JOIN badges USING(badge_id) WHERE badge_type = ?", ^@badge_moderator_tools ), order_by: [asc: :username] ) |> Repo.all() end def username_taken?(username) do clean_name = String.trim(username) from(u in User, where: fragment("lower(?)", u.username) == fragment("lower(?)", ^clean_name)) |> Repo.exists?() end end
24.139937
152
0.618967
03525f1ac6f8981f2fe7fb59fa33f0ab918db0b3
421
ex
Elixir
lib/hl7/2.5/segments/sft.ex
calvinb/elixir-hl7
5e953fa11f9184857c0ec4dda8662889f35a6bec
[ "Apache-2.0" ]
null
null
null
lib/hl7/2.5/segments/sft.ex
calvinb/elixir-hl7
5e953fa11f9184857c0ec4dda8662889f35a6bec
[ "Apache-2.0" ]
null
null
null
lib/hl7/2.5/segments/sft.ex
calvinb/elixir-hl7
5e953fa11f9184857c0ec4dda8662889f35a6bec
[ "Apache-2.0" ]
null
null
null
defmodule HL7.V2_5.Segments.SFT do @moduledoc false require Logger alias HL7.V2_5.{DataTypes} use HL7.Segment, fields: [ segment: nil, software_vendor_organization: DataTypes.Xon, software_certified_version_or_release_number: nil, software_product_name: nil, software_binary_id: nil, software_product_information: nil, software_install_date: DataTypes.Ts ] end
23.388889
56
0.72209
03526185a63a6c9682d700776955f688ab9aa388
3,492
ex
Elixir
lib/storage/jsondb.ex
aeturnum/twitch_discord_connector
b965ba1164540c92a925d2bd08e3fa299dfd457a
[ "MIT" ]
null
null
null
lib/storage/jsondb.ex
aeturnum/twitch_discord_connector
b965ba1164540c92a925d2bd08e3fa299dfd457a
[ "MIT" ]
null
null
null
lib/storage/jsondb.ex
aeturnum/twitch_discord_connector
b965ba1164540c92a925d2bd08e3fa299dfd457a
[ "MIT" ]
null
null
null
defmodule TwitchDiscordConnector.JsonDB do @moduledoc """ Small key-based "database" that's stored as a json file on disc. Intended for retaining long running state between runs in a way that's easy to read on the command line. """ use GenServer @name JsonDB @null_value :this_value_does_not_exist @default_path "db.json" def start_link(opts) do GenServer.start_link(__MODULE__, opts, name: @name) end def init(opts) do { :ok, { Keyword.get(opts, :path, @default_path), load(opts) } } end @doc """ Get a key if it exists, return `def` otherwise. Returns Value stored in the DB under `key` or `def`. """ def get(key, def \\ nil) do GenServer.call(@name, {:get, {key, def}}) end @doc """ Set the value stored in the db under `key` Returns `:ok` """ def set(key, value) do GenServer.call(@name, {:set, {key, value}}) end @doc """ Insert `value` into container stored under `db_key` Options: - key: If the container stored under `db_key` is a map, insert into the map with the key specified by this option - default: If the container does not exist, place this container in the JsonDB under `db_key` before inserting `value` Returns `:ok` """ def insert(db_key, value, opts \\ []) do GenServer.call(@name, {:insert, {db_key, value, opts}}) end def handle_cast(any, state) do IO.puts("jsonDB: unexpected cast: #{inspect(any)}") {:noreply, state} end def handle_call({:get, {key, def}}, _from, state) do {:reply, state |> elem(1) |> Map.get(key, def), state} end def handle_call({:set, {key, value}}, _from, {p, json}) do new_json = Map.put(json, key, value) |> write_to_disk(p) # IO.puts("JsonDB.set(#{inspect(key)} = #{inspect(value)}) -> #{inspect(new_json)}") {:reply, :ok, {p, new_json}} end def handle_call({:insert, {db_key, value, opts}}, _from, {p, json}) do container_key = Keyword.get(opts, :key, @null_value) default = case container_key do # use a list if they don't specify anything @null_value -> Keyword.get(opts, :default, []) # use a map if they do specify a key _ -> Keyword.get(opts, :default, %{}) end new_json = case Map.get(json, db_key, @null_value) do @null_value -> do_insert(json, db_key, default, container_key, value) old_value -> do_insert(json, db_key, old_value, container_key, value) end |> write_to_disk(p) # IO.puts("JsonDB.insert(#{inspect(db_key)} = #{inspect(value)} [#{inspect(opts)}]) -> #{inspect(new_json)}") { :reply, :ok, { p, new_json } } end defp do_insert(json, db_key, cont, _c_key, v) when is_list(cont) do Map.put(json, db_key, cont ++ [v]) end defp do_insert(json, db_key, cont, c_key, v) when is_map(cont) do Map.put(json, db_key, Map.put(cont, c_key, v)) end defp load(opts) do {:ok, _} = Application.ensure_all_started(:poison) path = Keyword.get(opts, :path, @default_path) if Keyword.get(opts, :wipe, false) do File.rm(path) end # optionally load base from an image file load_path = Keyword.get(opts, :image, path) case File.exists?(load_path) do true -> File.read!(load_path) false -> "{}" end |> Poison.decode!() end defp write_to_disk(json, path) do File.write!(path, Poison.encode!(json, pretty: true)) json end end
26.059701
122
0.619989
03526933c4194a48ebbdc36222f4c19711982321
3,277
ex
Elixir
lib/delirium_tremex.ex
floatingpointio/delirium_tremexs
6b7bb1918b7a8a02c4af3b7e266e30b67eba59bc
[ "MIT" ]
4
2019-09-24T09:32:31.000Z
2021-02-21T13:13:18.000Z
lib/delirium_tremex.ex
floatingpointio/delirium_tremexs
6b7bb1918b7a8a02c4af3b7e266e30b67eba59bc
[ "MIT" ]
2
2019-02-20T14:24:43.000Z
2019-05-08T08:54:49.000Z
lib/delirium_tremex.ex
floatingpointio/delirium_tremexs
6b7bb1918b7a8a02c4af3b7e266e30b67eba59bc
[ "MIT" ]
1
2020-02-19T19:43:11.000Z
2020-02-19T19:43:11.000Z
defmodule DeliriumTremex do @moduledoc """ DeliriumTremex is a library for standardized [GraphQL](http://graphql.org/) error handling through [Absinthe](https://hex.pm/packages/absinthe). ## Idea All errors should be returned it the `errors` field. Errors have the following format: ```JSON { "key": "username", "message": "Username is already taken", "messages": ["is already taken", "is too short"], "fullMessages": ["Username is already taken", "Username is too short"], "index": null, "subErrors": null } ``` Field explantion: * `key` - The key the error is attached to * `message` - A single error message associated to the key * `messages` - List of all the non-formatted error messages associated with the key * `fullMessages` - List of all the formatted error messages associated with the key * `index` - If the error is a nested error, specifies the index in the array at which the error occured * `subErrors` - Contains all sub-errors of the key Sub-errors are errors that occur in nested data. E.g. let's say that you are creating an article together with an array of comments. If any of those comments fail validation their errors would be returned in the `subErrors` array. E.g.: If the second comment's content is too short. ```JSON { "key": "comments", "message": "Error validating all comments", "messages": null, "fullMessages": null, "index": null, "subErrors": [ { "key": "content", "message": "Content is too short", "messages": ["is too short"], "fullMessages": ["Content is too short"], "index": 1, "subErrors": null } ] } ``` Note that sub-errors can also have sub-errors which allows for basically infinite nesting. This should satisfy most use cases. ## Integrations Currently `DeliriumTremex` integrates with: * [Ecto](https://github.com/elixir-ecto/ecto) - Automatically formats validation errors if passed a changeset. ## Installation Add the following to your `mix.exs` file: ```Elixir defp deps do [ {:absinthe, "~> 1.4"}, {:delirium_tremex, "~> 0.1.0"} ] end ``` If you have other dependencies just append the contents of the list above to your dependencies. ## Usage In your GraphQL/Absinthe schema add the following middleware to the queries/mutations for which you want the errors to be formatted. e.g. ```Elixir alias DeliriumTremex.Middleware.HandleErrors query do field :current_account, type: :account do resolve &AccountResolver.current_account/2 middleware HandleErrors # <-- This line adds the error handeling end end mutation do field :register, type: :account do arg :username, :string arg :password, :string resolve &AccountResolver.register/2 middleware HandleErrors # <-- This line adds the error handeling end end ``` ## Contribution For suggestions, fixes or questions, please feel free to open an issue. Pull requests are always welcome. ## License This project is licensed under the GPLv3. It comes with absolutely no warranty. [The license is available in this repository.](/LICENSE.txt) """ end
26.216
112
0.672566
035295b2bc8502ffd036747690d09916c125bde6
406,041
ex
Elixir
lib/codes/codes_s32.ex
badubizzle/icd_code
4c625733f92b7b1d616e272abc3009bb8b916c0c
[ "Apache-2.0" ]
null
null
null
lib/codes/codes_s32.ex
badubizzle/icd_code
4c625733f92b7b1d616e272abc3009bb8b916c0c
[ "Apache-2.0" ]
null
null
null
lib/codes/codes_s32.ex
badubizzle/icd_code
4c625733f92b7b1d616e272abc3009bb8b916c0c
[ "Apache-2.0" ]
null
null
null
defmodule IcdCode.ICDCode.Codes_S32 do alias IcdCode.ICDCode def _S32000A do %ICDCode{full_code: "S32000A", category_code: "S32", short_code: "000A", full_name: "Wedge compression fracture of unspecified lumbar vertebra, initial encounter for closed fracture", short_name: "Wedge compression fracture of unspecified lumbar vertebra, initial encounter for closed fracture", category_name: "Wedge compression fracture of unspecified lumbar vertebra, initial encounter for closed fracture" } end def _S32000B do %ICDCode{full_code: "S32000B", category_code: "S32", short_code: "000B", full_name: "Wedge compression fracture of unspecified lumbar vertebra, initial encounter for open fracture", short_name: "Wedge compression fracture of unspecified lumbar vertebra, initial encounter for open fracture", category_name: "Wedge compression fracture of unspecified lumbar vertebra, initial encounter for open fracture" } end def _S32000D do %ICDCode{full_code: "S32000D", category_code: "S32", short_code: "000D", full_name: "Wedge compression fracture of unspecified lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Wedge compression fracture of unspecified lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Wedge compression fracture of unspecified lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32000G do %ICDCode{full_code: "S32000G", category_code: "S32", short_code: "000G", full_name: "Wedge compression fracture of unspecified lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Wedge compression fracture of unspecified lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Wedge compression fracture of unspecified lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32000K do %ICDCode{full_code: "S32000K", category_code: "S32", short_code: "000K", full_name: "Wedge compression fracture of unspecified lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Wedge compression fracture of unspecified lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Wedge compression fracture of unspecified lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32000S do %ICDCode{full_code: "S32000S", category_code: "S32", short_code: "000S", full_name: "Wedge compression fracture of unspecified lumbar vertebra, sequela", short_name: "Wedge compression fracture of unspecified lumbar vertebra, sequela", category_name: "Wedge compression fracture of unspecified lumbar vertebra, sequela" } end def _S32001A do %ICDCode{full_code: "S32001A", category_code: "S32", short_code: "001A", full_name: "Stable burst fracture of unspecified lumbar vertebra, initial encounter for closed fracture", short_name: "Stable burst fracture of unspecified lumbar vertebra, initial encounter for closed fracture", category_name: "Stable burst fracture of unspecified lumbar vertebra, initial encounter for closed fracture" } end def _S32001B do %ICDCode{full_code: "S32001B", category_code: "S32", short_code: "001B", full_name: "Stable burst fracture of unspecified lumbar vertebra, initial encounter for open fracture", short_name: "Stable burst fracture of unspecified lumbar vertebra, initial encounter for open fracture", category_name: "Stable burst fracture of unspecified lumbar vertebra, initial encounter for open fracture" } end def _S32001D do %ICDCode{full_code: "S32001D", category_code: "S32", short_code: "001D", full_name: "Stable burst fracture of unspecified lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Stable burst fracture of unspecified lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Stable burst fracture of unspecified lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32001G do %ICDCode{full_code: "S32001G", category_code: "S32", short_code: "001G", full_name: "Stable burst fracture of unspecified lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Stable burst fracture of unspecified lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Stable burst fracture of unspecified lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32001K do %ICDCode{full_code: "S32001K", category_code: "S32", short_code: "001K", full_name: "Stable burst fracture of unspecified lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Stable burst fracture of unspecified lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Stable burst fracture of unspecified lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32001S do %ICDCode{full_code: "S32001S", category_code: "S32", short_code: "001S", full_name: "Stable burst fracture of unspecified lumbar vertebra, sequela", short_name: "Stable burst fracture of unspecified lumbar vertebra, sequela", category_name: "Stable burst fracture of unspecified lumbar vertebra, sequela" } end def _S32002A do %ICDCode{full_code: "S32002A", category_code: "S32", short_code: "002A", full_name: "Unstable burst fracture of unspecified lumbar vertebra, initial encounter for closed fracture", short_name: "Unstable burst fracture of unspecified lumbar vertebra, initial encounter for closed fracture", category_name: "Unstable burst fracture of unspecified lumbar vertebra, initial encounter for closed fracture" } end def _S32002B do %ICDCode{full_code: "S32002B", category_code: "S32", short_code: "002B", full_name: "Unstable burst fracture of unspecified lumbar vertebra, initial encounter for open fracture", short_name: "Unstable burst fracture of unspecified lumbar vertebra, initial encounter for open fracture", category_name: "Unstable burst fracture of unspecified lumbar vertebra, initial encounter for open fracture" } end def _S32002D do %ICDCode{full_code: "S32002D", category_code: "S32", short_code: "002D", full_name: "Unstable burst fracture of unspecified lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Unstable burst fracture of unspecified lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Unstable burst fracture of unspecified lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32002G do %ICDCode{full_code: "S32002G", category_code: "S32", short_code: "002G", full_name: "Unstable burst fracture of unspecified lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Unstable burst fracture of unspecified lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Unstable burst fracture of unspecified lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32002K do %ICDCode{full_code: "S32002K", category_code: "S32", short_code: "002K", full_name: "Unstable burst fracture of unspecified lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Unstable burst fracture of unspecified lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Unstable burst fracture of unspecified lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32002S do %ICDCode{full_code: "S32002S", category_code: "S32", short_code: "002S", full_name: "Unstable burst fracture of unspecified lumbar vertebra, sequela", short_name: "Unstable burst fracture of unspecified lumbar vertebra, sequela", category_name: "Unstable burst fracture of unspecified lumbar vertebra, sequela" } end def _S32008A do %ICDCode{full_code: "S32008A", category_code: "S32", short_code: "008A", full_name: "Other fracture of unspecified lumbar vertebra, initial encounter for closed fracture", short_name: "Other fracture of unspecified lumbar vertebra, initial encounter for closed fracture", category_name: "Other fracture of unspecified lumbar vertebra, initial encounter for closed fracture" } end def _S32008B do %ICDCode{full_code: "S32008B", category_code: "S32", short_code: "008B", full_name: "Other fracture of unspecified lumbar vertebra, initial encounter for open fracture", short_name: "Other fracture of unspecified lumbar vertebra, initial encounter for open fracture", category_name: "Other fracture of unspecified lumbar vertebra, initial encounter for open fracture" } end def _S32008D do %ICDCode{full_code: "S32008D", category_code: "S32", short_code: "008D", full_name: "Other fracture of unspecified lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Other fracture of unspecified lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Other fracture of unspecified lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32008G do %ICDCode{full_code: "S32008G", category_code: "S32", short_code: "008G", full_name: "Other fracture of unspecified lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Other fracture of unspecified lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Other fracture of unspecified lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32008K do %ICDCode{full_code: "S32008K", category_code: "S32", short_code: "008K", full_name: "Other fracture of unspecified lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Other fracture of unspecified lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Other fracture of unspecified lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32008S do %ICDCode{full_code: "S32008S", category_code: "S32", short_code: "008S", full_name: "Other fracture of unspecified lumbar vertebra, sequela", short_name: "Other fracture of unspecified lumbar vertebra, sequela", category_name: "Other fracture of unspecified lumbar vertebra, sequela" } end def _S32009A do %ICDCode{full_code: "S32009A", category_code: "S32", short_code: "009A", full_name: "Unspecified fracture of unspecified lumbar vertebra, initial encounter for closed fracture", short_name: "Unspecified fracture of unspecified lumbar vertebra, initial encounter for closed fracture", category_name: "Unspecified fracture of unspecified lumbar vertebra, initial encounter for closed fracture" } end def _S32009B do %ICDCode{full_code: "S32009B", category_code: "S32", short_code: "009B", full_name: "Unspecified fracture of unspecified lumbar vertebra, initial encounter for open fracture", short_name: "Unspecified fracture of unspecified lumbar vertebra, initial encounter for open fracture", category_name: "Unspecified fracture of unspecified lumbar vertebra, initial encounter for open fracture" } end def _S32009D do %ICDCode{full_code: "S32009D", category_code: "S32", short_code: "009D", full_name: "Unspecified fracture of unspecified lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Unspecified fracture of unspecified lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Unspecified fracture of unspecified lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32009G do %ICDCode{full_code: "S32009G", category_code: "S32", short_code: "009G", full_name: "Unspecified fracture of unspecified lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Unspecified fracture of unspecified lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Unspecified fracture of unspecified lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32009K do %ICDCode{full_code: "S32009K", category_code: "S32", short_code: "009K", full_name: "Unspecified fracture of unspecified lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Unspecified fracture of unspecified lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Unspecified fracture of unspecified lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32009S do %ICDCode{full_code: "S32009S", category_code: "S32", short_code: "009S", full_name: "Unspecified fracture of unspecified lumbar vertebra, sequela", short_name: "Unspecified fracture of unspecified lumbar vertebra, sequela", category_name: "Unspecified fracture of unspecified lumbar vertebra, sequela" } end def _S32010A do %ICDCode{full_code: "S32010A", category_code: "S32", short_code: "010A", full_name: "Wedge compression fracture of first lumbar vertebra, initial encounter for closed fracture", short_name: "Wedge compression fracture of first lumbar vertebra, initial encounter for closed fracture", category_name: "Wedge compression fracture of first lumbar vertebra, initial encounter for closed fracture" } end def _S32010B do %ICDCode{full_code: "S32010B", category_code: "S32", short_code: "010B", full_name: "Wedge compression fracture of first lumbar vertebra, initial encounter for open fracture", short_name: "Wedge compression fracture of first lumbar vertebra, initial encounter for open fracture", category_name: "Wedge compression fracture of first lumbar vertebra, initial encounter for open fracture" } end def _S32010D do %ICDCode{full_code: "S32010D", category_code: "S32", short_code: "010D", full_name: "Wedge compression fracture of first lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Wedge compression fracture of first lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Wedge compression fracture of first lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32010G do %ICDCode{full_code: "S32010G", category_code: "S32", short_code: "010G", full_name: "Wedge compression fracture of first lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Wedge compression fracture of first lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Wedge compression fracture of first lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32010K do %ICDCode{full_code: "S32010K", category_code: "S32", short_code: "010K", full_name: "Wedge compression fracture of first lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Wedge compression fracture of first lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Wedge compression fracture of first lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32010S do %ICDCode{full_code: "S32010S", category_code: "S32", short_code: "010S", full_name: "Wedge compression fracture of first lumbar vertebra, sequela", short_name: "Wedge compression fracture of first lumbar vertebra, sequela", category_name: "Wedge compression fracture of first lumbar vertebra, sequela" } end def _S32011A do %ICDCode{full_code: "S32011A", category_code: "S32", short_code: "011A", full_name: "Stable burst fracture of first lumbar vertebra, initial encounter for closed fracture", short_name: "Stable burst fracture of first lumbar vertebra, initial encounter for closed fracture", category_name: "Stable burst fracture of first lumbar vertebra, initial encounter for closed fracture" } end def _S32011B do %ICDCode{full_code: "S32011B", category_code: "S32", short_code: "011B", full_name: "Stable burst fracture of first lumbar vertebra, initial encounter for open fracture", short_name: "Stable burst fracture of first lumbar vertebra, initial encounter for open fracture", category_name: "Stable burst fracture of first lumbar vertebra, initial encounter for open fracture" } end def _S32011D do %ICDCode{full_code: "S32011D", category_code: "S32", short_code: "011D", full_name: "Stable burst fracture of first lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Stable burst fracture of first lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Stable burst fracture of first lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32011G do %ICDCode{full_code: "S32011G", category_code: "S32", short_code: "011G", full_name: "Stable burst fracture of first lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Stable burst fracture of first lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Stable burst fracture of first lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32011K do %ICDCode{full_code: "S32011K", category_code: "S32", short_code: "011K", full_name: "Stable burst fracture of first lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Stable burst fracture of first lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Stable burst fracture of first lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32011S do %ICDCode{full_code: "S32011S", category_code: "S32", short_code: "011S", full_name: "Stable burst fracture of first lumbar vertebra, sequela", short_name: "Stable burst fracture of first lumbar vertebra, sequela", category_name: "Stable burst fracture of first lumbar vertebra, sequela" } end def _S32012A do %ICDCode{full_code: "S32012A", category_code: "S32", short_code: "012A", full_name: "Unstable burst fracture of first lumbar vertebra, initial encounter for closed fracture", short_name: "Unstable burst fracture of first lumbar vertebra, initial encounter for closed fracture", category_name: "Unstable burst fracture of first lumbar vertebra, initial encounter for closed fracture" } end def _S32012B do %ICDCode{full_code: "S32012B", category_code: "S32", short_code: "012B", full_name: "Unstable burst fracture of first lumbar vertebra, initial encounter for open fracture", short_name: "Unstable burst fracture of first lumbar vertebra, initial encounter for open fracture", category_name: "Unstable burst fracture of first lumbar vertebra, initial encounter for open fracture" } end def _S32012D do %ICDCode{full_code: "S32012D", category_code: "S32", short_code: "012D", full_name: "Unstable burst fracture of first lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Unstable burst fracture of first lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Unstable burst fracture of first lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32012G do %ICDCode{full_code: "S32012G", category_code: "S32", short_code: "012G", full_name: "Unstable burst fracture of first lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Unstable burst fracture of first lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Unstable burst fracture of first lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32012K do %ICDCode{full_code: "S32012K", category_code: "S32", short_code: "012K", full_name: "Unstable burst fracture of first lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Unstable burst fracture of first lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Unstable burst fracture of first lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32012S do %ICDCode{full_code: "S32012S", category_code: "S32", short_code: "012S", full_name: "Unstable burst fracture of first lumbar vertebra, sequela", short_name: "Unstable burst fracture of first lumbar vertebra, sequela", category_name: "Unstable burst fracture of first lumbar vertebra, sequela" } end def _S32018A do %ICDCode{full_code: "S32018A", category_code: "S32", short_code: "018A", full_name: "Other fracture of first lumbar vertebra, initial encounter for closed fracture", short_name: "Other fracture of first lumbar vertebra, initial encounter for closed fracture", category_name: "Other fracture of first lumbar vertebra, initial encounter for closed fracture" } end def _S32018B do %ICDCode{full_code: "S32018B", category_code: "S32", short_code: "018B", full_name: "Other fracture of first lumbar vertebra, initial encounter for open fracture", short_name: "Other fracture of first lumbar vertebra, initial encounter for open fracture", category_name: "Other fracture of first lumbar vertebra, initial encounter for open fracture" } end def _S32018D do %ICDCode{full_code: "S32018D", category_code: "S32", short_code: "018D", full_name: "Other fracture of first lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Other fracture of first lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Other fracture of first lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32018G do %ICDCode{full_code: "S32018G", category_code: "S32", short_code: "018G", full_name: "Other fracture of first lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Other fracture of first lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Other fracture of first lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32018K do %ICDCode{full_code: "S32018K", category_code: "S32", short_code: "018K", full_name: "Other fracture of first lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Other fracture of first lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Other fracture of first lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32018S do %ICDCode{full_code: "S32018S", category_code: "S32", short_code: "018S", full_name: "Other fracture of first lumbar vertebra, sequela", short_name: "Other fracture of first lumbar vertebra, sequela", category_name: "Other fracture of first lumbar vertebra, sequela" } end def _S32019A do %ICDCode{full_code: "S32019A", category_code: "S32", short_code: "019A", full_name: "Unspecified fracture of first lumbar vertebra, initial encounter for closed fracture", short_name: "Unspecified fracture of first lumbar vertebra, initial encounter for closed fracture", category_name: "Unspecified fracture of first lumbar vertebra, initial encounter for closed fracture" } end def _S32019B do %ICDCode{full_code: "S32019B", category_code: "S32", short_code: "019B", full_name: "Unspecified fracture of first lumbar vertebra, initial encounter for open fracture", short_name: "Unspecified fracture of first lumbar vertebra, initial encounter for open fracture", category_name: "Unspecified fracture of first lumbar vertebra, initial encounter for open fracture" } end def _S32019D do %ICDCode{full_code: "S32019D", category_code: "S32", short_code: "019D", full_name: "Unspecified fracture of first lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Unspecified fracture of first lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Unspecified fracture of first lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32019G do %ICDCode{full_code: "S32019G", category_code: "S32", short_code: "019G", full_name: "Unspecified fracture of first lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Unspecified fracture of first lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Unspecified fracture of first lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32019K do %ICDCode{full_code: "S32019K", category_code: "S32", short_code: "019K", full_name: "Unspecified fracture of first lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Unspecified fracture of first lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Unspecified fracture of first lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32019S do %ICDCode{full_code: "S32019S", category_code: "S32", short_code: "019S", full_name: "Unspecified fracture of first lumbar vertebra, sequela", short_name: "Unspecified fracture of first lumbar vertebra, sequela", category_name: "Unspecified fracture of first lumbar vertebra, sequela" } end def _S32020A do %ICDCode{full_code: "S32020A", category_code: "S32", short_code: "020A", full_name: "Wedge compression fracture of second lumbar vertebra, initial encounter for closed fracture", short_name: "Wedge compression fracture of second lumbar vertebra, initial encounter for closed fracture", category_name: "Wedge compression fracture of second lumbar vertebra, initial encounter for closed fracture" } end def _S32020B do %ICDCode{full_code: "S32020B", category_code: "S32", short_code: "020B", full_name: "Wedge compression fracture of second lumbar vertebra, initial encounter for open fracture", short_name: "Wedge compression fracture of second lumbar vertebra, initial encounter for open fracture", category_name: "Wedge compression fracture of second lumbar vertebra, initial encounter for open fracture" } end def _S32020D do %ICDCode{full_code: "S32020D", category_code: "S32", short_code: "020D", full_name: "Wedge compression fracture of second lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Wedge compression fracture of second lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Wedge compression fracture of second lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32020G do %ICDCode{full_code: "S32020G", category_code: "S32", short_code: "020G", full_name: "Wedge compression fracture of second lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Wedge compression fracture of second lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Wedge compression fracture of second lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32020K do %ICDCode{full_code: "S32020K", category_code: "S32", short_code: "020K", full_name: "Wedge compression fracture of second lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Wedge compression fracture of second lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Wedge compression fracture of second lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32020S do %ICDCode{full_code: "S32020S", category_code: "S32", short_code: "020S", full_name: "Wedge compression fracture of second lumbar vertebra, sequela", short_name: "Wedge compression fracture of second lumbar vertebra, sequela", category_name: "Wedge compression fracture of second lumbar vertebra, sequela" } end def _S32021A do %ICDCode{full_code: "S32021A", category_code: "S32", short_code: "021A", full_name: "Stable burst fracture of second lumbar vertebra, initial encounter for closed fracture", short_name: "Stable burst fracture of second lumbar vertebra, initial encounter for closed fracture", category_name: "Stable burst fracture of second lumbar vertebra, initial encounter for closed fracture" } end def _S32021B do %ICDCode{full_code: "S32021B", category_code: "S32", short_code: "021B", full_name: "Stable burst fracture of second lumbar vertebra, initial encounter for open fracture", short_name: "Stable burst fracture of second lumbar vertebra, initial encounter for open fracture", category_name: "Stable burst fracture of second lumbar vertebra, initial encounter for open fracture" } end def _S32021D do %ICDCode{full_code: "S32021D", category_code: "S32", short_code: "021D", full_name: "Stable burst fracture of second lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Stable burst fracture of second lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Stable burst fracture of second lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32021G do %ICDCode{full_code: "S32021G", category_code: "S32", short_code: "021G", full_name: "Stable burst fracture of second lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Stable burst fracture of second lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Stable burst fracture of second lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32021K do %ICDCode{full_code: "S32021K", category_code: "S32", short_code: "021K", full_name: "Stable burst fracture of second lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Stable burst fracture of second lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Stable burst fracture of second lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32021S do %ICDCode{full_code: "S32021S", category_code: "S32", short_code: "021S", full_name: "Stable burst fracture of second lumbar vertebra, sequela", short_name: "Stable burst fracture of second lumbar vertebra, sequela", category_name: "Stable burst fracture of second lumbar vertebra, sequela" } end def _S32022A do %ICDCode{full_code: "S32022A", category_code: "S32", short_code: "022A", full_name: "Unstable burst fracture of second lumbar vertebra, initial encounter for closed fracture", short_name: "Unstable burst fracture of second lumbar vertebra, initial encounter for closed fracture", category_name: "Unstable burst fracture of second lumbar vertebra, initial encounter for closed fracture" } end def _S32022B do %ICDCode{full_code: "S32022B", category_code: "S32", short_code: "022B", full_name: "Unstable burst fracture of second lumbar vertebra, initial encounter for open fracture", short_name: "Unstable burst fracture of second lumbar vertebra, initial encounter for open fracture", category_name: "Unstable burst fracture of second lumbar vertebra, initial encounter for open fracture" } end def _S32022D do %ICDCode{full_code: "S32022D", category_code: "S32", short_code: "022D", full_name: "Unstable burst fracture of second lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Unstable burst fracture of second lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Unstable burst fracture of second lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32022G do %ICDCode{full_code: "S32022G", category_code: "S32", short_code: "022G", full_name: "Unstable burst fracture of second lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Unstable burst fracture of second lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Unstable burst fracture of second lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32022K do %ICDCode{full_code: "S32022K", category_code: "S32", short_code: "022K", full_name: "Unstable burst fracture of second lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Unstable burst fracture of second lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Unstable burst fracture of second lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32022S do %ICDCode{full_code: "S32022S", category_code: "S32", short_code: "022S", full_name: "Unstable burst fracture of second lumbar vertebra, sequela", short_name: "Unstable burst fracture of second lumbar vertebra, sequela", category_name: "Unstable burst fracture of second lumbar vertebra, sequela" } end def _S32028A do %ICDCode{full_code: "S32028A", category_code: "S32", short_code: "028A", full_name: "Other fracture of second lumbar vertebra, initial encounter for closed fracture", short_name: "Other fracture of second lumbar vertebra, initial encounter for closed fracture", category_name: "Other fracture of second lumbar vertebra, initial encounter for closed fracture" } end def _S32028B do %ICDCode{full_code: "S32028B", category_code: "S32", short_code: "028B", full_name: "Other fracture of second lumbar vertebra, initial encounter for open fracture", short_name: "Other fracture of second lumbar vertebra, initial encounter for open fracture", category_name: "Other fracture of second lumbar vertebra, initial encounter for open fracture" } end def _S32028D do %ICDCode{full_code: "S32028D", category_code: "S32", short_code: "028D", full_name: "Other fracture of second lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Other fracture of second lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Other fracture of second lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32028G do %ICDCode{full_code: "S32028G", category_code: "S32", short_code: "028G", full_name: "Other fracture of second lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Other fracture of second lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Other fracture of second lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32028K do %ICDCode{full_code: "S32028K", category_code: "S32", short_code: "028K", full_name: "Other fracture of second lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Other fracture of second lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Other fracture of second lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32028S do %ICDCode{full_code: "S32028S", category_code: "S32", short_code: "028S", full_name: "Other fracture of second lumbar vertebra, sequela", short_name: "Other fracture of second lumbar vertebra, sequela", category_name: "Other fracture of second lumbar vertebra, sequela" } end def _S32029A do %ICDCode{full_code: "S32029A", category_code: "S32", short_code: "029A", full_name: "Unspecified fracture of second lumbar vertebra, initial encounter for closed fracture", short_name: "Unspecified fracture of second lumbar vertebra, initial encounter for closed fracture", category_name: "Unspecified fracture of second lumbar vertebra, initial encounter for closed fracture" } end def _S32029B do %ICDCode{full_code: "S32029B", category_code: "S32", short_code: "029B", full_name: "Unspecified fracture of second lumbar vertebra, initial encounter for open fracture", short_name: "Unspecified fracture of second lumbar vertebra, initial encounter for open fracture", category_name: "Unspecified fracture of second lumbar vertebra, initial encounter for open fracture" } end def _S32029D do %ICDCode{full_code: "S32029D", category_code: "S32", short_code: "029D", full_name: "Unspecified fracture of second lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Unspecified fracture of second lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Unspecified fracture of second lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32029G do %ICDCode{full_code: "S32029G", category_code: "S32", short_code: "029G", full_name: "Unspecified fracture of second lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Unspecified fracture of second lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Unspecified fracture of second lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32029K do %ICDCode{full_code: "S32029K", category_code: "S32", short_code: "029K", full_name: "Unspecified fracture of second lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Unspecified fracture of second lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Unspecified fracture of second lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32029S do %ICDCode{full_code: "S32029S", category_code: "S32", short_code: "029S", full_name: "Unspecified fracture of second lumbar vertebra, sequela", short_name: "Unspecified fracture of second lumbar vertebra, sequela", category_name: "Unspecified fracture of second lumbar vertebra, sequela" } end def _S32030A do %ICDCode{full_code: "S32030A", category_code: "S32", short_code: "030A", full_name: "Wedge compression fracture of third lumbar vertebra, initial encounter for closed fracture", short_name: "Wedge compression fracture of third lumbar vertebra, initial encounter for closed fracture", category_name: "Wedge compression fracture of third lumbar vertebra, initial encounter for closed fracture" } end def _S32030B do %ICDCode{full_code: "S32030B", category_code: "S32", short_code: "030B", full_name: "Wedge compression fracture of third lumbar vertebra, initial encounter for open fracture", short_name: "Wedge compression fracture of third lumbar vertebra, initial encounter for open fracture", category_name: "Wedge compression fracture of third lumbar vertebra, initial encounter for open fracture" } end def _S32030D do %ICDCode{full_code: "S32030D", category_code: "S32", short_code: "030D", full_name: "Wedge compression fracture of third lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Wedge compression fracture of third lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Wedge compression fracture of third lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32030G do %ICDCode{full_code: "S32030G", category_code: "S32", short_code: "030G", full_name: "Wedge compression fracture of third lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Wedge compression fracture of third lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Wedge compression fracture of third lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32030K do %ICDCode{full_code: "S32030K", category_code: "S32", short_code: "030K", full_name: "Wedge compression fracture of third lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Wedge compression fracture of third lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Wedge compression fracture of third lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32030S do %ICDCode{full_code: "S32030S", category_code: "S32", short_code: "030S", full_name: "Wedge compression fracture of third lumbar vertebra, sequela", short_name: "Wedge compression fracture of third lumbar vertebra, sequela", category_name: "Wedge compression fracture of third lumbar vertebra, sequela" } end def _S32031A do %ICDCode{full_code: "S32031A", category_code: "S32", short_code: "031A", full_name: "Stable burst fracture of third lumbar vertebra, initial encounter for closed fracture", short_name: "Stable burst fracture of third lumbar vertebra, initial encounter for closed fracture", category_name: "Stable burst fracture of third lumbar vertebra, initial encounter for closed fracture" } end def _S32031B do %ICDCode{full_code: "S32031B", category_code: "S32", short_code: "031B", full_name: "Stable burst fracture of third lumbar vertebra, initial encounter for open fracture", short_name: "Stable burst fracture of third lumbar vertebra, initial encounter for open fracture", category_name: "Stable burst fracture of third lumbar vertebra, initial encounter for open fracture" } end def _S32031D do %ICDCode{full_code: "S32031D", category_code: "S32", short_code: "031D", full_name: "Stable burst fracture of third lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Stable burst fracture of third lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Stable burst fracture of third lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32031G do %ICDCode{full_code: "S32031G", category_code: "S32", short_code: "031G", full_name: "Stable burst fracture of third lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Stable burst fracture of third lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Stable burst fracture of third lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32031K do %ICDCode{full_code: "S32031K", category_code: "S32", short_code: "031K", full_name: "Stable burst fracture of third lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Stable burst fracture of third lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Stable burst fracture of third lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32031S do %ICDCode{full_code: "S32031S", category_code: "S32", short_code: "031S", full_name: "Stable burst fracture of third lumbar vertebra, sequela", short_name: "Stable burst fracture of third lumbar vertebra, sequela", category_name: "Stable burst fracture of third lumbar vertebra, sequela" } end def _S32032A do %ICDCode{full_code: "S32032A", category_code: "S32", short_code: "032A", full_name: "Unstable burst fracture of third lumbar vertebra, initial encounter for closed fracture", short_name: "Unstable burst fracture of third lumbar vertebra, initial encounter for closed fracture", category_name: "Unstable burst fracture of third lumbar vertebra, initial encounter for closed fracture" } end def _S32032B do %ICDCode{full_code: "S32032B", category_code: "S32", short_code: "032B", full_name: "Unstable burst fracture of third lumbar vertebra, initial encounter for open fracture", short_name: "Unstable burst fracture of third lumbar vertebra, initial encounter for open fracture", category_name: "Unstable burst fracture of third lumbar vertebra, initial encounter for open fracture" } end def _S32032D do %ICDCode{full_code: "S32032D", category_code: "S32", short_code: "032D", full_name: "Unstable burst fracture of third lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Unstable burst fracture of third lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Unstable burst fracture of third lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32032G do %ICDCode{full_code: "S32032G", category_code: "S32", short_code: "032G", full_name: "Unstable burst fracture of third lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Unstable burst fracture of third lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Unstable burst fracture of third lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32032K do %ICDCode{full_code: "S32032K", category_code: "S32", short_code: "032K", full_name: "Unstable burst fracture of third lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Unstable burst fracture of third lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Unstable burst fracture of third lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32032S do %ICDCode{full_code: "S32032S", category_code: "S32", short_code: "032S", full_name: "Unstable burst fracture of third lumbar vertebra, sequela", short_name: "Unstable burst fracture of third lumbar vertebra, sequela", category_name: "Unstable burst fracture of third lumbar vertebra, sequela" } end def _S32038A do %ICDCode{full_code: "S32038A", category_code: "S32", short_code: "038A", full_name: "Other fracture of third lumbar vertebra, initial encounter for closed fracture", short_name: "Other fracture of third lumbar vertebra, initial encounter for closed fracture", category_name: "Other fracture of third lumbar vertebra, initial encounter for closed fracture" } end def _S32038B do %ICDCode{full_code: "S32038B", category_code: "S32", short_code: "038B", full_name: "Other fracture of third lumbar vertebra, initial encounter for open fracture", short_name: "Other fracture of third lumbar vertebra, initial encounter for open fracture", category_name: "Other fracture of third lumbar vertebra, initial encounter for open fracture" } end def _S32038D do %ICDCode{full_code: "S32038D", category_code: "S32", short_code: "038D", full_name: "Other fracture of third lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Other fracture of third lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Other fracture of third lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32038G do %ICDCode{full_code: "S32038G", category_code: "S32", short_code: "038G", full_name: "Other fracture of third lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Other fracture of third lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Other fracture of third lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32038K do %ICDCode{full_code: "S32038K", category_code: "S32", short_code: "038K", full_name: "Other fracture of third lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Other fracture of third lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Other fracture of third lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32038S do %ICDCode{full_code: "S32038S", category_code: "S32", short_code: "038S", full_name: "Other fracture of third lumbar vertebra, sequela", short_name: "Other fracture of third lumbar vertebra, sequela", category_name: "Other fracture of third lumbar vertebra, sequela" } end def _S32039A do %ICDCode{full_code: "S32039A", category_code: "S32", short_code: "039A", full_name: "Unspecified fracture of third lumbar vertebra, initial encounter for closed fracture", short_name: "Unspecified fracture of third lumbar vertebra, initial encounter for closed fracture", category_name: "Unspecified fracture of third lumbar vertebra, initial encounter for closed fracture" } end def _S32039B do %ICDCode{full_code: "S32039B", category_code: "S32", short_code: "039B", full_name: "Unspecified fracture of third lumbar vertebra, initial encounter for open fracture", short_name: "Unspecified fracture of third lumbar vertebra, initial encounter for open fracture", category_name: "Unspecified fracture of third lumbar vertebra, initial encounter for open fracture" } end def _S32039D do %ICDCode{full_code: "S32039D", category_code: "S32", short_code: "039D", full_name: "Unspecified fracture of third lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Unspecified fracture of third lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Unspecified fracture of third lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32039G do %ICDCode{full_code: "S32039G", category_code: "S32", short_code: "039G", full_name: "Unspecified fracture of third lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Unspecified fracture of third lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Unspecified fracture of third lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32039K do %ICDCode{full_code: "S32039K", category_code: "S32", short_code: "039K", full_name: "Unspecified fracture of third lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Unspecified fracture of third lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Unspecified fracture of third lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32039S do %ICDCode{full_code: "S32039S", category_code: "S32", short_code: "039S", full_name: "Unspecified fracture of third lumbar vertebra, sequela", short_name: "Unspecified fracture of third lumbar vertebra, sequela", category_name: "Unspecified fracture of third lumbar vertebra, sequela" } end def _S32040A do %ICDCode{full_code: "S32040A", category_code: "S32", short_code: "040A", full_name: "Wedge compression fracture of fourth lumbar vertebra, initial encounter for closed fracture", short_name: "Wedge compression fracture of fourth lumbar vertebra, initial encounter for closed fracture", category_name: "Wedge compression fracture of fourth lumbar vertebra, initial encounter for closed fracture" } end def _S32040B do %ICDCode{full_code: "S32040B", category_code: "S32", short_code: "040B", full_name: "Wedge compression fracture of fourth lumbar vertebra, initial encounter for open fracture", short_name: "Wedge compression fracture of fourth lumbar vertebra, initial encounter for open fracture", category_name: "Wedge compression fracture of fourth lumbar vertebra, initial encounter for open fracture" } end def _S32040D do %ICDCode{full_code: "S32040D", category_code: "S32", short_code: "040D", full_name: "Wedge compression fracture of fourth lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Wedge compression fracture of fourth lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Wedge compression fracture of fourth lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32040G do %ICDCode{full_code: "S32040G", category_code: "S32", short_code: "040G", full_name: "Wedge compression fracture of fourth lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Wedge compression fracture of fourth lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Wedge compression fracture of fourth lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32040K do %ICDCode{full_code: "S32040K", category_code: "S32", short_code: "040K", full_name: "Wedge compression fracture of fourth lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Wedge compression fracture of fourth lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Wedge compression fracture of fourth lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32040S do %ICDCode{full_code: "S32040S", category_code: "S32", short_code: "040S", full_name: "Wedge compression fracture of fourth lumbar vertebra, sequela", short_name: "Wedge compression fracture of fourth lumbar vertebra, sequela", category_name: "Wedge compression fracture of fourth lumbar vertebra, sequela" } end def _S32041A do %ICDCode{full_code: "S32041A", category_code: "S32", short_code: "041A", full_name: "Stable burst fracture of fourth lumbar vertebra, initial encounter for closed fracture", short_name: "Stable burst fracture of fourth lumbar vertebra, initial encounter for closed fracture", category_name: "Stable burst fracture of fourth lumbar vertebra, initial encounter for closed fracture" } end def _S32041B do %ICDCode{full_code: "S32041B", category_code: "S32", short_code: "041B", full_name: "Stable burst fracture of fourth lumbar vertebra, initial encounter for open fracture", short_name: "Stable burst fracture of fourth lumbar vertebra, initial encounter for open fracture", category_name: "Stable burst fracture of fourth lumbar vertebra, initial encounter for open fracture" } end def _S32041D do %ICDCode{full_code: "S32041D", category_code: "S32", short_code: "041D", full_name: "Stable burst fracture of fourth lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Stable burst fracture of fourth lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Stable burst fracture of fourth lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32041G do %ICDCode{full_code: "S32041G", category_code: "S32", short_code: "041G", full_name: "Stable burst fracture of fourth lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Stable burst fracture of fourth lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Stable burst fracture of fourth lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32041K do %ICDCode{full_code: "S32041K", category_code: "S32", short_code: "041K", full_name: "Stable burst fracture of fourth lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Stable burst fracture of fourth lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Stable burst fracture of fourth lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32041S do %ICDCode{full_code: "S32041S", category_code: "S32", short_code: "041S", full_name: "Stable burst fracture of fourth lumbar vertebra, sequela", short_name: "Stable burst fracture of fourth lumbar vertebra, sequela", category_name: "Stable burst fracture of fourth lumbar vertebra, sequela" } end def _S32042A do %ICDCode{full_code: "S32042A", category_code: "S32", short_code: "042A", full_name: "Unstable burst fracture of fourth lumbar vertebra, initial encounter for closed fracture", short_name: "Unstable burst fracture of fourth lumbar vertebra, initial encounter for closed fracture", category_name: "Unstable burst fracture of fourth lumbar vertebra, initial encounter for closed fracture" } end def _S32042B do %ICDCode{full_code: "S32042B", category_code: "S32", short_code: "042B", full_name: "Unstable burst fracture of fourth lumbar vertebra, initial encounter for open fracture", short_name: "Unstable burst fracture of fourth lumbar vertebra, initial encounter for open fracture", category_name: "Unstable burst fracture of fourth lumbar vertebra, initial encounter for open fracture" } end def _S32042D do %ICDCode{full_code: "S32042D", category_code: "S32", short_code: "042D", full_name: "Unstable burst fracture of fourth lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Unstable burst fracture of fourth lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Unstable burst fracture of fourth lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32042G do %ICDCode{full_code: "S32042G", category_code: "S32", short_code: "042G", full_name: "Unstable burst fracture of fourth lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Unstable burst fracture of fourth lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Unstable burst fracture of fourth lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32042K do %ICDCode{full_code: "S32042K", category_code: "S32", short_code: "042K", full_name: "Unstable burst fracture of fourth lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Unstable burst fracture of fourth lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Unstable burst fracture of fourth lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32042S do %ICDCode{full_code: "S32042S", category_code: "S32", short_code: "042S", full_name: "Unstable burst fracture of fourth lumbar vertebra, sequela", short_name: "Unstable burst fracture of fourth lumbar vertebra, sequela", category_name: "Unstable burst fracture of fourth lumbar vertebra, sequela" } end def _S32048A do %ICDCode{full_code: "S32048A", category_code: "S32", short_code: "048A", full_name: "Other fracture of fourth lumbar vertebra, initial encounter for closed fracture", short_name: "Other fracture of fourth lumbar vertebra, initial encounter for closed fracture", category_name: "Other fracture of fourth lumbar vertebra, initial encounter for closed fracture" } end def _S32048B do %ICDCode{full_code: "S32048B", category_code: "S32", short_code: "048B", full_name: "Other fracture of fourth lumbar vertebra, initial encounter for open fracture", short_name: "Other fracture of fourth lumbar vertebra, initial encounter for open fracture", category_name: "Other fracture of fourth lumbar vertebra, initial encounter for open fracture" } end def _S32048D do %ICDCode{full_code: "S32048D", category_code: "S32", short_code: "048D", full_name: "Other fracture of fourth lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Other fracture of fourth lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Other fracture of fourth lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32048G do %ICDCode{full_code: "S32048G", category_code: "S32", short_code: "048G", full_name: "Other fracture of fourth lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Other fracture of fourth lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Other fracture of fourth lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32048K do %ICDCode{full_code: "S32048K", category_code: "S32", short_code: "048K", full_name: "Other fracture of fourth lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Other fracture of fourth lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Other fracture of fourth lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32048S do %ICDCode{full_code: "S32048S", category_code: "S32", short_code: "048S", full_name: "Other fracture of fourth lumbar vertebra, sequela", short_name: "Other fracture of fourth lumbar vertebra, sequela", category_name: "Other fracture of fourth lumbar vertebra, sequela" } end def _S32049A do %ICDCode{full_code: "S32049A", category_code: "S32", short_code: "049A", full_name: "Unspecified fracture of fourth lumbar vertebra, initial encounter for closed fracture", short_name: "Unspecified fracture of fourth lumbar vertebra, initial encounter for closed fracture", category_name: "Unspecified fracture of fourth lumbar vertebra, initial encounter for closed fracture" } end def _S32049B do %ICDCode{full_code: "S32049B", category_code: "S32", short_code: "049B", full_name: "Unspecified fracture of fourth lumbar vertebra, initial encounter for open fracture", short_name: "Unspecified fracture of fourth lumbar vertebra, initial encounter for open fracture", category_name: "Unspecified fracture of fourth lumbar vertebra, initial encounter for open fracture" } end def _S32049D do %ICDCode{full_code: "S32049D", category_code: "S32", short_code: "049D", full_name: "Unspecified fracture of fourth lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Unspecified fracture of fourth lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Unspecified fracture of fourth lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32049G do %ICDCode{full_code: "S32049G", category_code: "S32", short_code: "049G", full_name: "Unspecified fracture of fourth lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Unspecified fracture of fourth lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Unspecified fracture of fourth lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32049K do %ICDCode{full_code: "S32049K", category_code: "S32", short_code: "049K", full_name: "Unspecified fracture of fourth lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Unspecified fracture of fourth lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Unspecified fracture of fourth lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32049S do %ICDCode{full_code: "S32049S", category_code: "S32", short_code: "049S", full_name: "Unspecified fracture of fourth lumbar vertebra, sequela", short_name: "Unspecified fracture of fourth lumbar vertebra, sequela", category_name: "Unspecified fracture of fourth lumbar vertebra, sequela" } end def _S32050A do %ICDCode{full_code: "S32050A", category_code: "S32", short_code: "050A", full_name: "Wedge compression fracture of fifth lumbar vertebra, initial encounter for closed fracture", short_name: "Wedge compression fracture of fifth lumbar vertebra, initial encounter for closed fracture", category_name: "Wedge compression fracture of fifth lumbar vertebra, initial encounter for closed fracture" } end def _S32050B do %ICDCode{full_code: "S32050B", category_code: "S32", short_code: "050B", full_name: "Wedge compression fracture of fifth lumbar vertebra, initial encounter for open fracture", short_name: "Wedge compression fracture of fifth lumbar vertebra, initial encounter for open fracture", category_name: "Wedge compression fracture of fifth lumbar vertebra, initial encounter for open fracture" } end def _S32050D do %ICDCode{full_code: "S32050D", category_code: "S32", short_code: "050D", full_name: "Wedge compression fracture of fifth lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Wedge compression fracture of fifth lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Wedge compression fracture of fifth lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32050G do %ICDCode{full_code: "S32050G", category_code: "S32", short_code: "050G", full_name: "Wedge compression fracture of fifth lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Wedge compression fracture of fifth lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Wedge compression fracture of fifth lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32050K do %ICDCode{full_code: "S32050K", category_code: "S32", short_code: "050K", full_name: "Wedge compression fracture of fifth lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Wedge compression fracture of fifth lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Wedge compression fracture of fifth lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32050S do %ICDCode{full_code: "S32050S", category_code: "S32", short_code: "050S", full_name: "Wedge compression fracture of fifth lumbar vertebra, sequela", short_name: "Wedge compression fracture of fifth lumbar vertebra, sequela", category_name: "Wedge compression fracture of fifth lumbar vertebra, sequela" } end def _S32051A do %ICDCode{full_code: "S32051A", category_code: "S32", short_code: "051A", full_name: "Stable burst fracture of fifth lumbar vertebra, initial encounter for closed fracture", short_name: "Stable burst fracture of fifth lumbar vertebra, initial encounter for closed fracture", category_name: "Stable burst fracture of fifth lumbar vertebra, initial encounter for closed fracture" } end def _S32051B do %ICDCode{full_code: "S32051B", category_code: "S32", short_code: "051B", full_name: "Stable burst fracture of fifth lumbar vertebra, initial encounter for open fracture", short_name: "Stable burst fracture of fifth lumbar vertebra, initial encounter for open fracture", category_name: "Stable burst fracture of fifth lumbar vertebra, initial encounter for open fracture" } end def _S32051D do %ICDCode{full_code: "S32051D", category_code: "S32", short_code: "051D", full_name: "Stable burst fracture of fifth lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Stable burst fracture of fifth lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Stable burst fracture of fifth lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32051G do %ICDCode{full_code: "S32051G", category_code: "S32", short_code: "051G", full_name: "Stable burst fracture of fifth lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Stable burst fracture of fifth lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Stable burst fracture of fifth lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32051K do %ICDCode{full_code: "S32051K", category_code: "S32", short_code: "051K", full_name: "Stable burst fracture of fifth lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Stable burst fracture of fifth lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Stable burst fracture of fifth lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32051S do %ICDCode{full_code: "S32051S", category_code: "S32", short_code: "051S", full_name: "Stable burst fracture of fifth lumbar vertebra, sequela", short_name: "Stable burst fracture of fifth lumbar vertebra, sequela", category_name: "Stable burst fracture of fifth lumbar vertebra, sequela" } end def _S32052A do %ICDCode{full_code: "S32052A", category_code: "S32", short_code: "052A", full_name: "Unstable burst fracture of fifth lumbar vertebra, initial encounter for closed fracture", short_name: "Unstable burst fracture of fifth lumbar vertebra, initial encounter for closed fracture", category_name: "Unstable burst fracture of fifth lumbar vertebra, initial encounter for closed fracture" } end def _S32052B do %ICDCode{full_code: "S32052B", category_code: "S32", short_code: "052B", full_name: "Unstable burst fracture of fifth lumbar vertebra, initial encounter for open fracture", short_name: "Unstable burst fracture of fifth lumbar vertebra, initial encounter for open fracture", category_name: "Unstable burst fracture of fifth lumbar vertebra, initial encounter for open fracture" } end def _S32052D do %ICDCode{full_code: "S32052D", category_code: "S32", short_code: "052D", full_name: "Unstable burst fracture of fifth lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Unstable burst fracture of fifth lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Unstable burst fracture of fifth lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32052G do %ICDCode{full_code: "S32052G", category_code: "S32", short_code: "052G", full_name: "Unstable burst fracture of fifth lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Unstable burst fracture of fifth lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Unstable burst fracture of fifth lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32052K do %ICDCode{full_code: "S32052K", category_code: "S32", short_code: "052K", full_name: "Unstable burst fracture of fifth lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Unstable burst fracture of fifth lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Unstable burst fracture of fifth lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32052S do %ICDCode{full_code: "S32052S", category_code: "S32", short_code: "052S", full_name: "Unstable burst fracture of fifth lumbar vertebra, sequela", short_name: "Unstable burst fracture of fifth lumbar vertebra, sequela", category_name: "Unstable burst fracture of fifth lumbar vertebra, sequela" } end def _S32058A do %ICDCode{full_code: "S32058A", category_code: "S32", short_code: "058A", full_name: "Other fracture of fifth lumbar vertebra, initial encounter for closed fracture", short_name: "Other fracture of fifth lumbar vertebra, initial encounter for closed fracture", category_name: "Other fracture of fifth lumbar vertebra, initial encounter for closed fracture" } end def _S32058B do %ICDCode{full_code: "S32058B", category_code: "S32", short_code: "058B", full_name: "Other fracture of fifth lumbar vertebra, initial encounter for open fracture", short_name: "Other fracture of fifth lumbar vertebra, initial encounter for open fracture", category_name: "Other fracture of fifth lumbar vertebra, initial encounter for open fracture" } end def _S32058D do %ICDCode{full_code: "S32058D", category_code: "S32", short_code: "058D", full_name: "Other fracture of fifth lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Other fracture of fifth lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Other fracture of fifth lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32058G do %ICDCode{full_code: "S32058G", category_code: "S32", short_code: "058G", full_name: "Other fracture of fifth lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Other fracture of fifth lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Other fracture of fifth lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32058K do %ICDCode{full_code: "S32058K", category_code: "S32", short_code: "058K", full_name: "Other fracture of fifth lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Other fracture of fifth lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Other fracture of fifth lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32058S do %ICDCode{full_code: "S32058S", category_code: "S32", short_code: "058S", full_name: "Other fracture of fifth lumbar vertebra, sequela", short_name: "Other fracture of fifth lumbar vertebra, sequela", category_name: "Other fracture of fifth lumbar vertebra, sequela" } end def _S32059A do %ICDCode{full_code: "S32059A", category_code: "S32", short_code: "059A", full_name: "Unspecified fracture of fifth lumbar vertebra, initial encounter for closed fracture", short_name: "Unspecified fracture of fifth lumbar vertebra, initial encounter for closed fracture", category_name: "Unspecified fracture of fifth lumbar vertebra, initial encounter for closed fracture" } end def _S32059B do %ICDCode{full_code: "S32059B", category_code: "S32", short_code: "059B", full_name: "Unspecified fracture of fifth lumbar vertebra, initial encounter for open fracture", short_name: "Unspecified fracture of fifth lumbar vertebra, initial encounter for open fracture", category_name: "Unspecified fracture of fifth lumbar vertebra, initial encounter for open fracture" } end def _S32059D do %ICDCode{full_code: "S32059D", category_code: "S32", short_code: "059D", full_name: "Unspecified fracture of fifth lumbar vertebra, subsequent encounter for fracture with routine healing", short_name: "Unspecified fracture of fifth lumbar vertebra, subsequent encounter for fracture with routine healing", category_name: "Unspecified fracture of fifth lumbar vertebra, subsequent encounter for fracture with routine healing" } end def _S32059G do %ICDCode{full_code: "S32059G", category_code: "S32", short_code: "059G", full_name: "Unspecified fracture of fifth lumbar vertebra, subsequent encounter for fracture with delayed healing", short_name: "Unspecified fracture of fifth lumbar vertebra, subsequent encounter for fracture with delayed healing", category_name: "Unspecified fracture of fifth lumbar vertebra, subsequent encounter for fracture with delayed healing" } end def _S32059K do %ICDCode{full_code: "S32059K", category_code: "S32", short_code: "059K", full_name: "Unspecified fracture of fifth lumbar vertebra, subsequent encounter for fracture with nonunion", short_name: "Unspecified fracture of fifth lumbar vertebra, subsequent encounter for fracture with nonunion", category_name: "Unspecified fracture of fifth lumbar vertebra, subsequent encounter for fracture with nonunion" } end def _S32059S do %ICDCode{full_code: "S32059S", category_code: "S32", short_code: "059S", full_name: "Unspecified fracture of fifth lumbar vertebra, sequela", short_name: "Unspecified fracture of fifth lumbar vertebra, sequela", category_name: "Unspecified fracture of fifth lumbar vertebra, sequela" } end def _S3210XA do %ICDCode{full_code: "S3210XA", category_code: "S32", short_code: "10XA", full_name: "Unspecified fracture of sacrum, initial encounter for closed fracture", short_name: "Unspecified fracture of sacrum, initial encounter for closed fracture", category_name: "Unspecified fracture of sacrum, initial encounter for closed fracture" } end def _S3210XB do %ICDCode{full_code: "S3210XB", category_code: "S32", short_code: "10XB", full_name: "Unspecified fracture of sacrum, initial encounter for open fracture", short_name: "Unspecified fracture of sacrum, initial encounter for open fracture", category_name: "Unspecified fracture of sacrum, initial encounter for open fracture" } end def _S3210XD do %ICDCode{full_code: "S3210XD", category_code: "S32", short_code: "10XD", full_name: "Unspecified fracture of sacrum, subsequent encounter for fracture with routine healing", short_name: "Unspecified fracture of sacrum, subsequent encounter for fracture with routine healing", category_name: "Unspecified fracture of sacrum, subsequent encounter for fracture with routine healing" } end def _S3210XG do %ICDCode{full_code: "S3210XG", category_code: "S32", short_code: "10XG", full_name: "Unspecified fracture of sacrum, subsequent encounter for fracture with delayed healing", short_name: "Unspecified fracture of sacrum, subsequent encounter for fracture with delayed healing", category_name: "Unspecified fracture of sacrum, subsequent encounter for fracture with delayed healing" } end def _S3210XK do %ICDCode{full_code: "S3210XK", category_code: "S32", short_code: "10XK", full_name: "Unspecified fracture of sacrum, subsequent encounter for fracture with nonunion", short_name: "Unspecified fracture of sacrum, subsequent encounter for fracture with nonunion", category_name: "Unspecified fracture of sacrum, subsequent encounter for fracture with nonunion" } end def _S3210XS do %ICDCode{full_code: "S3210XS", category_code: "S32", short_code: "10XS", full_name: "Unspecified fracture of sacrum, sequela", short_name: "Unspecified fracture of sacrum, sequela", category_name: "Unspecified fracture of sacrum, sequela" } end def _S32110A do %ICDCode{full_code: "S32110A", category_code: "S32", short_code: "110A", full_name: "Nondisplaced Zone I fracture of sacrum, initial encounter for closed fracture", short_name: "Nondisplaced Zone I fracture of sacrum, initial encounter for closed fracture", category_name: "Nondisplaced Zone I fracture of sacrum, initial encounter for closed fracture" } end def _S32110B do %ICDCode{full_code: "S32110B", category_code: "S32", short_code: "110B", full_name: "Nondisplaced Zone I fracture of sacrum, initial encounter for open fracture", short_name: "Nondisplaced Zone I fracture of sacrum, initial encounter for open fracture", category_name: "Nondisplaced Zone I fracture of sacrum, initial encounter for open fracture" } end def _S32110D do %ICDCode{full_code: "S32110D", category_code: "S32", short_code: "110D", full_name: "Nondisplaced Zone I fracture of sacrum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced Zone I fracture of sacrum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced Zone I fracture of sacrum, subsequent encounter for fracture with routine healing" } end def _S32110G do %ICDCode{full_code: "S32110G", category_code: "S32", short_code: "110G", full_name: "Nondisplaced Zone I fracture of sacrum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced Zone I fracture of sacrum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced Zone I fracture of sacrum, subsequent encounter for fracture with delayed healing" } end def _S32110K do %ICDCode{full_code: "S32110K", category_code: "S32", short_code: "110K", full_name: "Nondisplaced Zone I fracture of sacrum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced Zone I fracture of sacrum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced Zone I fracture of sacrum, subsequent encounter for fracture with nonunion" } end def _S32110S do %ICDCode{full_code: "S32110S", category_code: "S32", short_code: "110S", full_name: "Nondisplaced Zone I fracture of sacrum, sequela", short_name: "Nondisplaced Zone I fracture of sacrum, sequela", category_name: "Nondisplaced Zone I fracture of sacrum, sequela" } end def _S32111A do %ICDCode{full_code: "S32111A", category_code: "S32", short_code: "111A", full_name: "Minimally displaced Zone I fracture of sacrum, initial encounter for closed fracture", short_name: "Minimally displaced Zone I fracture of sacrum, initial encounter for closed fracture", category_name: "Minimally displaced Zone I fracture of sacrum, initial encounter for closed fracture" } end def _S32111B do %ICDCode{full_code: "S32111B", category_code: "S32", short_code: "111B", full_name: "Minimally displaced Zone I fracture of sacrum, initial encounter for open fracture", short_name: "Minimally displaced Zone I fracture of sacrum, initial encounter for open fracture", category_name: "Minimally displaced Zone I fracture of sacrum, initial encounter for open fracture" } end def _S32111D do %ICDCode{full_code: "S32111D", category_code: "S32", short_code: "111D", full_name: "Minimally displaced Zone I fracture of sacrum, subsequent encounter for fracture with routine healing", short_name: "Minimally displaced Zone I fracture of sacrum, subsequent encounter for fracture with routine healing", category_name: "Minimally displaced Zone I fracture of sacrum, subsequent encounter for fracture with routine healing" } end def _S32111G do %ICDCode{full_code: "S32111G", category_code: "S32", short_code: "111G", full_name: "Minimally displaced Zone I fracture of sacrum, subsequent encounter for fracture with delayed healing", short_name: "Minimally displaced Zone I fracture of sacrum, subsequent encounter for fracture with delayed healing", category_name: "Minimally displaced Zone I fracture of sacrum, subsequent encounter for fracture with delayed healing" } end def _S32111K do %ICDCode{full_code: "S32111K", category_code: "S32", short_code: "111K", full_name: "Minimally displaced Zone I fracture of sacrum, subsequent encounter for fracture with nonunion", short_name: "Minimally displaced Zone I fracture of sacrum, subsequent encounter for fracture with nonunion", category_name: "Minimally displaced Zone I fracture of sacrum, subsequent encounter for fracture with nonunion" } end def _S32111S do %ICDCode{full_code: "S32111S", category_code: "S32", short_code: "111S", full_name: "Minimally displaced Zone I fracture of sacrum, sequela", short_name: "Minimally displaced Zone I fracture of sacrum, sequela", category_name: "Minimally displaced Zone I fracture of sacrum, sequela" } end def _S32112A do %ICDCode{full_code: "S32112A", category_code: "S32", short_code: "112A", full_name: "Severely displaced Zone I fracture of sacrum, initial encounter for closed fracture", short_name: "Severely displaced Zone I fracture of sacrum, initial encounter for closed fracture", category_name: "Severely displaced Zone I fracture of sacrum, initial encounter for closed fracture" } end def _S32112B do %ICDCode{full_code: "S32112B", category_code: "S32", short_code: "112B", full_name: "Severely displaced Zone I fracture of sacrum, initial encounter for open fracture", short_name: "Severely displaced Zone I fracture of sacrum, initial encounter for open fracture", category_name: "Severely displaced Zone I fracture of sacrum, initial encounter for open fracture" } end def _S32112D do %ICDCode{full_code: "S32112D", category_code: "S32", short_code: "112D", full_name: "Severely displaced Zone I fracture of sacrum, subsequent encounter for fracture with routine healing", short_name: "Severely displaced Zone I fracture of sacrum, subsequent encounter for fracture with routine healing", category_name: "Severely displaced Zone I fracture of sacrum, subsequent encounter for fracture with routine healing" } end def _S32112G do %ICDCode{full_code: "S32112G", category_code: "S32", short_code: "112G", full_name: "Severely displaced Zone I fracture of sacrum, subsequent encounter for fracture with delayed healing", short_name: "Severely displaced Zone I fracture of sacrum, subsequent encounter for fracture with delayed healing", category_name: "Severely displaced Zone I fracture of sacrum, subsequent encounter for fracture with delayed healing" } end def _S32112K do %ICDCode{full_code: "S32112K", category_code: "S32", short_code: "112K", full_name: "Severely displaced Zone I fracture of sacrum, subsequent encounter for fracture with nonunion", short_name: "Severely displaced Zone I fracture of sacrum, subsequent encounter for fracture with nonunion", category_name: "Severely displaced Zone I fracture of sacrum, subsequent encounter for fracture with nonunion" } end def _S32112S do %ICDCode{full_code: "S32112S", category_code: "S32", short_code: "112S", full_name: "Severely displaced Zone I fracture of sacrum, sequela", short_name: "Severely displaced Zone I fracture of sacrum, sequela", category_name: "Severely displaced Zone I fracture of sacrum, sequela" } end def _S32119A do %ICDCode{full_code: "S32119A", category_code: "S32", short_code: "119A", full_name: "Unspecified Zone I fracture of sacrum, initial encounter for closed fracture", short_name: "Unspecified Zone I fracture of sacrum, initial encounter for closed fracture", category_name: "Unspecified Zone I fracture of sacrum, initial encounter for closed fracture" } end def _S32119B do %ICDCode{full_code: "S32119B", category_code: "S32", short_code: "119B", full_name: "Unspecified Zone I fracture of sacrum, initial encounter for open fracture", short_name: "Unspecified Zone I fracture of sacrum, initial encounter for open fracture", category_name: "Unspecified Zone I fracture of sacrum, initial encounter for open fracture" } end def _S32119D do %ICDCode{full_code: "S32119D", category_code: "S32", short_code: "119D", full_name: "Unspecified Zone I fracture of sacrum, subsequent encounter for fracture with routine healing", short_name: "Unspecified Zone I fracture of sacrum, subsequent encounter for fracture with routine healing", category_name: "Unspecified Zone I fracture of sacrum, subsequent encounter for fracture with routine healing" } end def _S32119G do %ICDCode{full_code: "S32119G", category_code: "S32", short_code: "119G", full_name: "Unspecified Zone I fracture of sacrum, subsequent encounter for fracture with delayed healing", short_name: "Unspecified Zone I fracture of sacrum, subsequent encounter for fracture with delayed healing", category_name: "Unspecified Zone I fracture of sacrum, subsequent encounter for fracture with delayed healing" } end def _S32119K do %ICDCode{full_code: "S32119K", category_code: "S32", short_code: "119K", full_name: "Unspecified Zone I fracture of sacrum, subsequent encounter for fracture with nonunion", short_name: "Unspecified Zone I fracture of sacrum, subsequent encounter for fracture with nonunion", category_name: "Unspecified Zone I fracture of sacrum, subsequent encounter for fracture with nonunion" } end def _S32119S do %ICDCode{full_code: "S32119S", category_code: "S32", short_code: "119S", full_name: "Unspecified Zone I fracture of sacrum, sequela", short_name: "Unspecified Zone I fracture of sacrum, sequela", category_name: "Unspecified Zone I fracture of sacrum, sequela" } end def _S32120A do %ICDCode{full_code: "S32120A", category_code: "S32", short_code: "120A", full_name: "Nondisplaced Zone II fracture of sacrum, initial encounter for closed fracture", short_name: "Nondisplaced Zone II fracture of sacrum, initial encounter for closed fracture", category_name: "Nondisplaced Zone II fracture of sacrum, initial encounter for closed fracture" } end def _S32120B do %ICDCode{full_code: "S32120B", category_code: "S32", short_code: "120B", full_name: "Nondisplaced Zone II fracture of sacrum, initial encounter for open fracture", short_name: "Nondisplaced Zone II fracture of sacrum, initial encounter for open fracture", category_name: "Nondisplaced Zone II fracture of sacrum, initial encounter for open fracture" } end def _S32120D do %ICDCode{full_code: "S32120D", category_code: "S32", short_code: "120D", full_name: "Nondisplaced Zone II fracture of sacrum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced Zone II fracture of sacrum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced Zone II fracture of sacrum, subsequent encounter for fracture with routine healing" } end def _S32120G do %ICDCode{full_code: "S32120G", category_code: "S32", short_code: "120G", full_name: "Nondisplaced Zone II fracture of sacrum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced Zone II fracture of sacrum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced Zone II fracture of sacrum, subsequent encounter for fracture with delayed healing" } end def _S32120K do %ICDCode{full_code: "S32120K", category_code: "S32", short_code: "120K", full_name: "Nondisplaced Zone II fracture of sacrum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced Zone II fracture of sacrum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced Zone II fracture of sacrum, subsequent encounter for fracture with nonunion" } end def _S32120S do %ICDCode{full_code: "S32120S", category_code: "S32", short_code: "120S", full_name: "Nondisplaced Zone II fracture of sacrum, sequela", short_name: "Nondisplaced Zone II fracture of sacrum, sequela", category_name: "Nondisplaced Zone II fracture of sacrum, sequela" } end def _S32121A do %ICDCode{full_code: "S32121A", category_code: "S32", short_code: "121A", full_name: "Minimally displaced Zone II fracture of sacrum, initial encounter for closed fracture", short_name: "Minimally displaced Zone II fracture of sacrum, initial encounter for closed fracture", category_name: "Minimally displaced Zone II fracture of sacrum, initial encounter for closed fracture" } end def _S32121B do %ICDCode{full_code: "S32121B", category_code: "S32", short_code: "121B", full_name: "Minimally displaced Zone II fracture of sacrum, initial encounter for open fracture", short_name: "Minimally displaced Zone II fracture of sacrum, initial encounter for open fracture", category_name: "Minimally displaced Zone II fracture of sacrum, initial encounter for open fracture" } end def _S32121D do %ICDCode{full_code: "S32121D", category_code: "S32", short_code: "121D", full_name: "Minimally displaced Zone II fracture of sacrum, subsequent encounter for fracture with routine healing", short_name: "Minimally displaced Zone II fracture of sacrum, subsequent encounter for fracture with routine healing", category_name: "Minimally displaced Zone II fracture of sacrum, subsequent encounter for fracture with routine healing" } end def _S32121G do %ICDCode{full_code: "S32121G", category_code: "S32", short_code: "121G", full_name: "Minimally displaced Zone II fracture of sacrum, subsequent encounter for fracture with delayed healing", short_name: "Minimally displaced Zone II fracture of sacrum, subsequent encounter for fracture with delayed healing", category_name: "Minimally displaced Zone II fracture of sacrum, subsequent encounter for fracture with delayed healing" } end def _S32121K do %ICDCode{full_code: "S32121K", category_code: "S32", short_code: "121K", full_name: "Minimally displaced Zone II fracture of sacrum, subsequent encounter for fracture with nonunion", short_name: "Minimally displaced Zone II fracture of sacrum, subsequent encounter for fracture with nonunion", category_name: "Minimally displaced Zone II fracture of sacrum, subsequent encounter for fracture with nonunion" } end def _S32121S do %ICDCode{full_code: "S32121S", category_code: "S32", short_code: "121S", full_name: "Minimally displaced Zone II fracture of sacrum, sequela", short_name: "Minimally displaced Zone II fracture of sacrum, sequela", category_name: "Minimally displaced Zone II fracture of sacrum, sequela" } end def _S32122A do %ICDCode{full_code: "S32122A", category_code: "S32", short_code: "122A", full_name: "Severely displaced Zone II fracture of sacrum, initial encounter for closed fracture", short_name: "Severely displaced Zone II fracture of sacrum, initial encounter for closed fracture", category_name: "Severely displaced Zone II fracture of sacrum, initial encounter for closed fracture" } end def _S32122B do %ICDCode{full_code: "S32122B", category_code: "S32", short_code: "122B", full_name: "Severely displaced Zone II fracture of sacrum, initial encounter for open fracture", short_name: "Severely displaced Zone II fracture of sacrum, initial encounter for open fracture", category_name: "Severely displaced Zone II fracture of sacrum, initial encounter for open fracture" } end def _S32122D do %ICDCode{full_code: "S32122D", category_code: "S32", short_code: "122D", full_name: "Severely displaced Zone II fracture of sacrum, subsequent encounter for fracture with routine healing", short_name: "Severely displaced Zone II fracture of sacrum, subsequent encounter for fracture with routine healing", category_name: "Severely displaced Zone II fracture of sacrum, subsequent encounter for fracture with routine healing" } end def _S32122G do %ICDCode{full_code: "S32122G", category_code: "S32", short_code: "122G", full_name: "Severely displaced Zone II fracture of sacrum, subsequent encounter for fracture with delayed healing", short_name: "Severely displaced Zone II fracture of sacrum, subsequent encounter for fracture with delayed healing", category_name: "Severely displaced Zone II fracture of sacrum, subsequent encounter for fracture with delayed healing" } end def _S32122K do %ICDCode{full_code: "S32122K", category_code: "S32", short_code: "122K", full_name: "Severely displaced Zone II fracture of sacrum, subsequent encounter for fracture with nonunion", short_name: "Severely displaced Zone II fracture of sacrum, subsequent encounter for fracture with nonunion", category_name: "Severely displaced Zone II fracture of sacrum, subsequent encounter for fracture with nonunion" } end def _S32122S do %ICDCode{full_code: "S32122S", category_code: "S32", short_code: "122S", full_name: "Severely displaced Zone II fracture of sacrum, sequela", short_name: "Severely displaced Zone II fracture of sacrum, sequela", category_name: "Severely displaced Zone II fracture of sacrum, sequela" } end def _S32129A do %ICDCode{full_code: "S32129A", category_code: "S32", short_code: "129A", full_name: "Unspecified Zone II fracture of sacrum, initial encounter for closed fracture", short_name: "Unspecified Zone II fracture of sacrum, initial encounter for closed fracture", category_name: "Unspecified Zone II fracture of sacrum, initial encounter for closed fracture" } end def _S32129B do %ICDCode{full_code: "S32129B", category_code: "S32", short_code: "129B", full_name: "Unspecified Zone II fracture of sacrum, initial encounter for open fracture", short_name: "Unspecified Zone II fracture of sacrum, initial encounter for open fracture", category_name: "Unspecified Zone II fracture of sacrum, initial encounter for open fracture" } end def _S32129D do %ICDCode{full_code: "S32129D", category_code: "S32", short_code: "129D", full_name: "Unspecified Zone II fracture of sacrum, subsequent encounter for fracture with routine healing", short_name: "Unspecified Zone II fracture of sacrum, subsequent encounter for fracture with routine healing", category_name: "Unspecified Zone II fracture of sacrum, subsequent encounter for fracture with routine healing" } end def _S32129G do %ICDCode{full_code: "S32129G", category_code: "S32", short_code: "129G", full_name: "Unspecified Zone II fracture of sacrum, subsequent encounter for fracture with delayed healing", short_name: "Unspecified Zone II fracture of sacrum, subsequent encounter for fracture with delayed healing", category_name: "Unspecified Zone II fracture of sacrum, subsequent encounter for fracture with delayed healing" } end def _S32129K do %ICDCode{full_code: "S32129K", category_code: "S32", short_code: "129K", full_name: "Unspecified Zone II fracture of sacrum, subsequent encounter for fracture with nonunion", short_name: "Unspecified Zone II fracture of sacrum, subsequent encounter for fracture with nonunion", category_name: "Unspecified Zone II fracture of sacrum, subsequent encounter for fracture with nonunion" } end def _S32129S do %ICDCode{full_code: "S32129S", category_code: "S32", short_code: "129S", full_name: "Unspecified Zone II fracture of sacrum, sequela", short_name: "Unspecified Zone II fracture of sacrum, sequela", category_name: "Unspecified Zone II fracture of sacrum, sequela" } end def _S32130A do %ICDCode{full_code: "S32130A", category_code: "S32", short_code: "130A", full_name: "Nondisplaced Zone III fracture of sacrum, initial encounter for closed fracture", short_name: "Nondisplaced Zone III fracture of sacrum, initial encounter for closed fracture", category_name: "Nondisplaced Zone III fracture of sacrum, initial encounter for closed fracture" } end def _S32130B do %ICDCode{full_code: "S32130B", category_code: "S32", short_code: "130B", full_name: "Nondisplaced Zone III fracture of sacrum, initial encounter for open fracture", short_name: "Nondisplaced Zone III fracture of sacrum, initial encounter for open fracture", category_name: "Nondisplaced Zone III fracture of sacrum, initial encounter for open fracture" } end def _S32130D do %ICDCode{full_code: "S32130D", category_code: "S32", short_code: "130D", full_name: "Nondisplaced Zone III fracture of sacrum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced Zone III fracture of sacrum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced Zone III fracture of sacrum, subsequent encounter for fracture with routine healing" } end def _S32130G do %ICDCode{full_code: "S32130G", category_code: "S32", short_code: "130G", full_name: "Nondisplaced Zone III fracture of sacrum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced Zone III fracture of sacrum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced Zone III fracture of sacrum, subsequent encounter for fracture with delayed healing" } end def _S32130K do %ICDCode{full_code: "S32130K", category_code: "S32", short_code: "130K", full_name: "Nondisplaced Zone III fracture of sacrum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced Zone III fracture of sacrum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced Zone III fracture of sacrum, subsequent encounter for fracture with nonunion" } end def _S32130S do %ICDCode{full_code: "S32130S", category_code: "S32", short_code: "130S", full_name: "Nondisplaced Zone III fracture of sacrum, sequela", short_name: "Nondisplaced Zone III fracture of sacrum, sequela", category_name: "Nondisplaced Zone III fracture of sacrum, sequela" } end def _S32131A do %ICDCode{full_code: "S32131A", category_code: "S32", short_code: "131A", full_name: "Minimally displaced Zone III fracture of sacrum, initial encounter for closed fracture", short_name: "Minimally displaced Zone III fracture of sacrum, initial encounter for closed fracture", category_name: "Minimally displaced Zone III fracture of sacrum, initial encounter for closed fracture" } end def _S32131B do %ICDCode{full_code: "S32131B", category_code: "S32", short_code: "131B", full_name: "Minimally displaced Zone III fracture of sacrum, initial encounter for open fracture", short_name: "Minimally displaced Zone III fracture of sacrum, initial encounter for open fracture", category_name: "Minimally displaced Zone III fracture of sacrum, initial encounter for open fracture" } end def _S32131D do %ICDCode{full_code: "S32131D", category_code: "S32", short_code: "131D", full_name: "Minimally displaced Zone III fracture of sacrum, subsequent encounter for fracture with routine healing", short_name: "Minimally displaced Zone III fracture of sacrum, subsequent encounter for fracture with routine healing", category_name: "Minimally displaced Zone III fracture of sacrum, subsequent encounter for fracture with routine healing" } end def _S32131G do %ICDCode{full_code: "S32131G", category_code: "S32", short_code: "131G", full_name: "Minimally displaced Zone III fracture of sacrum, subsequent encounter for fracture with delayed healing", short_name: "Minimally displaced Zone III fracture of sacrum, subsequent encounter for fracture with delayed healing", category_name: "Minimally displaced Zone III fracture of sacrum, subsequent encounter for fracture with delayed healing" } end def _S32131K do %ICDCode{full_code: "S32131K", category_code: "S32", short_code: "131K", full_name: "Minimally displaced Zone III fracture of sacrum, subsequent encounter for fracture with nonunion", short_name: "Minimally displaced Zone III fracture of sacrum, subsequent encounter for fracture with nonunion", category_name: "Minimally displaced Zone III fracture of sacrum, subsequent encounter for fracture with nonunion" } end def _S32131S do %ICDCode{full_code: "S32131S", category_code: "S32", short_code: "131S", full_name: "Minimally displaced Zone III fracture of sacrum, sequela", short_name: "Minimally displaced Zone III fracture of sacrum, sequela", category_name: "Minimally displaced Zone III fracture of sacrum, sequela" } end def _S32132A do %ICDCode{full_code: "S32132A", category_code: "S32", short_code: "132A", full_name: "Severely displaced Zone III fracture of sacrum, initial encounter for closed fracture", short_name: "Severely displaced Zone III fracture of sacrum, initial encounter for closed fracture", category_name: "Severely displaced Zone III fracture of sacrum, initial encounter for closed fracture" } end def _S32132B do %ICDCode{full_code: "S32132B", category_code: "S32", short_code: "132B", full_name: "Severely displaced Zone III fracture of sacrum, initial encounter for open fracture", short_name: "Severely displaced Zone III fracture of sacrum, initial encounter for open fracture", category_name: "Severely displaced Zone III fracture of sacrum, initial encounter for open fracture" } end def _S32132D do %ICDCode{full_code: "S32132D", category_code: "S32", short_code: "132D", full_name: "Severely displaced Zone III fracture of sacrum, subsequent encounter for fracture with routine healing", short_name: "Severely displaced Zone III fracture of sacrum, subsequent encounter for fracture with routine healing", category_name: "Severely displaced Zone III fracture of sacrum, subsequent encounter for fracture with routine healing" } end def _S32132G do %ICDCode{full_code: "S32132G", category_code: "S32", short_code: "132G", full_name: "Severely displaced Zone III fracture of sacrum, subsequent encounter for fracture with delayed healing", short_name: "Severely displaced Zone III fracture of sacrum, subsequent encounter for fracture with delayed healing", category_name: "Severely displaced Zone III fracture of sacrum, subsequent encounter for fracture with delayed healing" } end def _S32132K do %ICDCode{full_code: "S32132K", category_code: "S32", short_code: "132K", full_name: "Severely displaced Zone III fracture of sacrum, subsequent encounter for fracture with nonunion", short_name: "Severely displaced Zone III fracture of sacrum, subsequent encounter for fracture with nonunion", category_name: "Severely displaced Zone III fracture of sacrum, subsequent encounter for fracture with nonunion" } end def _S32132S do %ICDCode{full_code: "S32132S", category_code: "S32", short_code: "132S", full_name: "Severely displaced Zone III fracture of sacrum, sequela", short_name: "Severely displaced Zone III fracture of sacrum, sequela", category_name: "Severely displaced Zone III fracture of sacrum, sequela" } end def _S32139A do %ICDCode{full_code: "S32139A", category_code: "S32", short_code: "139A", full_name: "Unspecified Zone III fracture of sacrum, initial encounter for closed fracture", short_name: "Unspecified Zone III fracture of sacrum, initial encounter for closed fracture", category_name: "Unspecified Zone III fracture of sacrum, initial encounter for closed fracture" } end def _S32139B do %ICDCode{full_code: "S32139B", category_code: "S32", short_code: "139B", full_name: "Unspecified Zone III fracture of sacrum, initial encounter for open fracture", short_name: "Unspecified Zone III fracture of sacrum, initial encounter for open fracture", category_name: "Unspecified Zone III fracture of sacrum, initial encounter for open fracture" } end def _S32139D do %ICDCode{full_code: "S32139D", category_code: "S32", short_code: "139D", full_name: "Unspecified Zone III fracture of sacrum, subsequent encounter for fracture with routine healing", short_name: "Unspecified Zone III fracture of sacrum, subsequent encounter for fracture with routine healing", category_name: "Unspecified Zone III fracture of sacrum, subsequent encounter for fracture with routine healing" } end def _S32139G do %ICDCode{full_code: "S32139G", category_code: "S32", short_code: "139G", full_name: "Unspecified Zone III fracture of sacrum, subsequent encounter for fracture with delayed healing", short_name: "Unspecified Zone III fracture of sacrum, subsequent encounter for fracture with delayed healing", category_name: "Unspecified Zone III fracture of sacrum, subsequent encounter for fracture with delayed healing" } end def _S32139K do %ICDCode{full_code: "S32139K", category_code: "S32", short_code: "139K", full_name: "Unspecified Zone III fracture of sacrum, subsequent encounter for fracture with nonunion", short_name: "Unspecified Zone III fracture of sacrum, subsequent encounter for fracture with nonunion", category_name: "Unspecified Zone III fracture of sacrum, subsequent encounter for fracture with nonunion" } end def _S32139S do %ICDCode{full_code: "S32139S", category_code: "S32", short_code: "139S", full_name: "Unspecified Zone III fracture of sacrum, sequela", short_name: "Unspecified Zone III fracture of sacrum, sequela", category_name: "Unspecified Zone III fracture of sacrum, sequela" } end def _S3214XA do %ICDCode{full_code: "S3214XA", category_code: "S32", short_code: "14XA", full_name: "Type 1 fracture of sacrum, initial encounter for closed fracture", short_name: "Type 1 fracture of sacrum, initial encounter for closed fracture", category_name: "Type 1 fracture of sacrum, initial encounter for closed fracture" } end def _S3214XB do %ICDCode{full_code: "S3214XB", category_code: "S32", short_code: "14XB", full_name: "Type 1 fracture of sacrum, initial encounter for open fracture", short_name: "Type 1 fracture of sacrum, initial encounter for open fracture", category_name: "Type 1 fracture of sacrum, initial encounter for open fracture" } end def _S3214XD do %ICDCode{full_code: "S3214XD", category_code: "S32", short_code: "14XD", full_name: "Type 1 fracture of sacrum, subsequent encounter for fracture with routine healing", short_name: "Type 1 fracture of sacrum, subsequent encounter for fracture with routine healing", category_name: "Type 1 fracture of sacrum, subsequent encounter for fracture with routine healing" } end def _S3214XG do %ICDCode{full_code: "S3214XG", category_code: "S32", short_code: "14XG", full_name: "Type 1 fracture of sacrum, subsequent encounter for fracture with delayed healing", short_name: "Type 1 fracture of sacrum, subsequent encounter for fracture with delayed healing", category_name: "Type 1 fracture of sacrum, subsequent encounter for fracture with delayed healing" } end def _S3214XK do %ICDCode{full_code: "S3214XK", category_code: "S32", short_code: "14XK", full_name: "Type 1 fracture of sacrum, subsequent encounter for fracture with nonunion", short_name: "Type 1 fracture of sacrum, subsequent encounter for fracture with nonunion", category_name: "Type 1 fracture of sacrum, subsequent encounter for fracture with nonunion" } end def _S3214XS do %ICDCode{full_code: "S3214XS", category_code: "S32", short_code: "14XS", full_name: "Type 1 fracture of sacrum, sequela", short_name: "Type 1 fracture of sacrum, sequela", category_name: "Type 1 fracture of sacrum, sequela" } end def _S3215XA do %ICDCode{full_code: "S3215XA", category_code: "S32", short_code: "15XA", full_name: "Type 2 fracture of sacrum, initial encounter for closed fracture", short_name: "Type 2 fracture of sacrum, initial encounter for closed fracture", category_name: "Type 2 fracture of sacrum, initial encounter for closed fracture" } end def _S3215XB do %ICDCode{full_code: "S3215XB", category_code: "S32", short_code: "15XB", full_name: "Type 2 fracture of sacrum, initial encounter for open fracture", short_name: "Type 2 fracture of sacrum, initial encounter for open fracture", category_name: "Type 2 fracture of sacrum, initial encounter for open fracture" } end def _S3215XD do %ICDCode{full_code: "S3215XD", category_code: "S32", short_code: "15XD", full_name: "Type 2 fracture of sacrum, subsequent encounter for fracture with routine healing", short_name: "Type 2 fracture of sacrum, subsequent encounter for fracture with routine healing", category_name: "Type 2 fracture of sacrum, subsequent encounter for fracture with routine healing" } end def _S3215XG do %ICDCode{full_code: "S3215XG", category_code: "S32", short_code: "15XG", full_name: "Type 2 fracture of sacrum, subsequent encounter for fracture with delayed healing", short_name: "Type 2 fracture of sacrum, subsequent encounter for fracture with delayed healing", category_name: "Type 2 fracture of sacrum, subsequent encounter for fracture with delayed healing" } end def _S3215XK do %ICDCode{full_code: "S3215XK", category_code: "S32", short_code: "15XK", full_name: "Type 2 fracture of sacrum, subsequent encounter for fracture with nonunion", short_name: "Type 2 fracture of sacrum, subsequent encounter for fracture with nonunion", category_name: "Type 2 fracture of sacrum, subsequent encounter for fracture with nonunion" } end def _S3215XS do %ICDCode{full_code: "S3215XS", category_code: "S32", short_code: "15XS", full_name: "Type 2 fracture of sacrum, sequela", short_name: "Type 2 fracture of sacrum, sequela", category_name: "Type 2 fracture of sacrum, sequela" } end def _S3216XA do %ICDCode{full_code: "S3216XA", category_code: "S32", short_code: "16XA", full_name: "Type 3 fracture of sacrum, initial encounter for closed fracture", short_name: "Type 3 fracture of sacrum, initial encounter for closed fracture", category_name: "Type 3 fracture of sacrum, initial encounter for closed fracture" } end def _S3216XB do %ICDCode{full_code: "S3216XB", category_code: "S32", short_code: "16XB", full_name: "Type 3 fracture of sacrum, initial encounter for open fracture", short_name: "Type 3 fracture of sacrum, initial encounter for open fracture", category_name: "Type 3 fracture of sacrum, initial encounter for open fracture" } end def _S3216XD do %ICDCode{full_code: "S3216XD", category_code: "S32", short_code: "16XD", full_name: "Type 3 fracture of sacrum, subsequent encounter for fracture with routine healing", short_name: "Type 3 fracture of sacrum, subsequent encounter for fracture with routine healing", category_name: "Type 3 fracture of sacrum, subsequent encounter for fracture with routine healing" } end def _S3216XG do %ICDCode{full_code: "S3216XG", category_code: "S32", short_code: "16XG", full_name: "Type 3 fracture of sacrum, subsequent encounter for fracture with delayed healing", short_name: "Type 3 fracture of sacrum, subsequent encounter for fracture with delayed healing", category_name: "Type 3 fracture of sacrum, subsequent encounter for fracture with delayed healing" } end def _S3216XK do %ICDCode{full_code: "S3216XK", category_code: "S32", short_code: "16XK", full_name: "Type 3 fracture of sacrum, subsequent encounter for fracture with nonunion", short_name: "Type 3 fracture of sacrum, subsequent encounter for fracture with nonunion", category_name: "Type 3 fracture of sacrum, subsequent encounter for fracture with nonunion" } end def _S3216XS do %ICDCode{full_code: "S3216XS", category_code: "S32", short_code: "16XS", full_name: "Type 3 fracture of sacrum, sequela", short_name: "Type 3 fracture of sacrum, sequela", category_name: "Type 3 fracture of sacrum, sequela" } end def _S3217XA do %ICDCode{full_code: "S3217XA", category_code: "S32", short_code: "17XA", full_name: "Type 4 fracture of sacrum, initial encounter for closed fracture", short_name: "Type 4 fracture of sacrum, initial encounter for closed fracture", category_name: "Type 4 fracture of sacrum, initial encounter for closed fracture" } end def _S3217XB do %ICDCode{full_code: "S3217XB", category_code: "S32", short_code: "17XB", full_name: "Type 4 fracture of sacrum, initial encounter for open fracture", short_name: "Type 4 fracture of sacrum, initial encounter for open fracture", category_name: "Type 4 fracture of sacrum, initial encounter for open fracture" } end def _S3217XD do %ICDCode{full_code: "S3217XD", category_code: "S32", short_code: "17XD", full_name: "Type 4 fracture of sacrum, subsequent encounter for fracture with routine healing", short_name: "Type 4 fracture of sacrum, subsequent encounter for fracture with routine healing", category_name: "Type 4 fracture of sacrum, subsequent encounter for fracture with routine healing" } end def _S3217XG do %ICDCode{full_code: "S3217XG", category_code: "S32", short_code: "17XG", full_name: "Type 4 fracture of sacrum, subsequent encounter for fracture with delayed healing", short_name: "Type 4 fracture of sacrum, subsequent encounter for fracture with delayed healing", category_name: "Type 4 fracture of sacrum, subsequent encounter for fracture with delayed healing" } end def _S3217XK do %ICDCode{full_code: "S3217XK", category_code: "S32", short_code: "17XK", full_name: "Type 4 fracture of sacrum, subsequent encounter for fracture with nonunion", short_name: "Type 4 fracture of sacrum, subsequent encounter for fracture with nonunion", category_name: "Type 4 fracture of sacrum, subsequent encounter for fracture with nonunion" } end def _S3217XS do %ICDCode{full_code: "S3217XS", category_code: "S32", short_code: "17XS", full_name: "Type 4 fracture of sacrum, sequela", short_name: "Type 4 fracture of sacrum, sequela", category_name: "Type 4 fracture of sacrum, sequela" } end def _S3219XA do %ICDCode{full_code: "S3219XA", category_code: "S32", short_code: "19XA", full_name: "Other fracture of sacrum, initial encounter for closed fracture", short_name: "Other fracture of sacrum, initial encounter for closed fracture", category_name: "Other fracture of sacrum, initial encounter for closed fracture" } end def _S3219XB do %ICDCode{full_code: "S3219XB", category_code: "S32", short_code: "19XB", full_name: "Other fracture of sacrum, initial encounter for open fracture", short_name: "Other fracture of sacrum, initial encounter for open fracture", category_name: "Other fracture of sacrum, initial encounter for open fracture" } end def _S3219XD do %ICDCode{full_code: "S3219XD", category_code: "S32", short_code: "19XD", full_name: "Other fracture of sacrum, subsequent encounter for fracture with routine healing", short_name: "Other fracture of sacrum, subsequent encounter for fracture with routine healing", category_name: "Other fracture of sacrum, subsequent encounter for fracture with routine healing" } end def _S3219XG do %ICDCode{full_code: "S3219XG", category_code: "S32", short_code: "19XG", full_name: "Other fracture of sacrum, subsequent encounter for fracture with delayed healing", short_name: "Other fracture of sacrum, subsequent encounter for fracture with delayed healing", category_name: "Other fracture of sacrum, subsequent encounter for fracture with delayed healing" } end def _S3219XK do %ICDCode{full_code: "S3219XK", category_code: "S32", short_code: "19XK", full_name: "Other fracture of sacrum, subsequent encounter for fracture with nonunion", short_name: "Other fracture of sacrum, subsequent encounter for fracture with nonunion", category_name: "Other fracture of sacrum, subsequent encounter for fracture with nonunion" } end def _S3219XS do %ICDCode{full_code: "S3219XS", category_code: "S32", short_code: "19XS", full_name: "Other fracture of sacrum, sequela", short_name: "Other fracture of sacrum, sequela", category_name: "Other fracture of sacrum, sequela" } end def _S322XXA do %ICDCode{full_code: "S322XXA", category_code: "S32", short_code: "2XXA", full_name: "Fracture of coccyx, initial encounter for closed fracture", short_name: "Fracture of coccyx, initial encounter for closed fracture", category_name: "Fracture of coccyx, initial encounter for closed fracture" } end def _S322XXB do %ICDCode{full_code: "S322XXB", category_code: "S32", short_code: "2XXB", full_name: "Fracture of coccyx, initial encounter for open fracture", short_name: "Fracture of coccyx, initial encounter for open fracture", category_name: "Fracture of coccyx, initial encounter for open fracture" } end def _S322XXD do %ICDCode{full_code: "S322XXD", category_code: "S32", short_code: "2XXD", full_name: "Fracture of coccyx, subsequent encounter for fracture with routine healing", short_name: "Fracture of coccyx, subsequent encounter for fracture with routine healing", category_name: "Fracture of coccyx, subsequent encounter for fracture with routine healing" } end def _S322XXG do %ICDCode{full_code: "S322XXG", category_code: "S32", short_code: "2XXG", full_name: "Fracture of coccyx, subsequent encounter for fracture with delayed healing", short_name: "Fracture of coccyx, subsequent encounter for fracture with delayed healing", category_name: "Fracture of coccyx, subsequent encounter for fracture with delayed healing" } end def _S322XXK do %ICDCode{full_code: "S322XXK", category_code: "S32", short_code: "2XXK", full_name: "Fracture of coccyx, subsequent encounter for fracture with nonunion", short_name: "Fracture of coccyx, subsequent encounter for fracture with nonunion", category_name: "Fracture of coccyx, subsequent encounter for fracture with nonunion" } end def _S322XXS do %ICDCode{full_code: "S322XXS", category_code: "S32", short_code: "2XXS", full_name: "Fracture of coccyx, sequela", short_name: "Fracture of coccyx, sequela", category_name: "Fracture of coccyx, sequela" } end def _S32301A do %ICDCode{full_code: "S32301A", category_code: "S32", short_code: "301A", full_name: "Unspecified fracture of right ilium, initial encounter for closed fracture", short_name: "Unspecified fracture of right ilium, initial encounter for closed fracture", category_name: "Unspecified fracture of right ilium, initial encounter for closed fracture" } end def _S32301B do %ICDCode{full_code: "S32301B", category_code: "S32", short_code: "301B", full_name: "Unspecified fracture of right ilium, initial encounter for open fracture", short_name: "Unspecified fracture of right ilium, initial encounter for open fracture", category_name: "Unspecified fracture of right ilium, initial encounter for open fracture" } end def _S32301D do %ICDCode{full_code: "S32301D", category_code: "S32", short_code: "301D", full_name: "Unspecified fracture of right ilium, subsequent encounter for fracture with routine healing", short_name: "Unspecified fracture of right ilium, subsequent encounter for fracture with routine healing", category_name: "Unspecified fracture of right ilium, subsequent encounter for fracture with routine healing" } end def _S32301G do %ICDCode{full_code: "S32301G", category_code: "S32", short_code: "301G", full_name: "Unspecified fracture of right ilium, subsequent encounter for fracture with delayed healing", short_name: "Unspecified fracture of right ilium, subsequent encounter for fracture with delayed healing", category_name: "Unspecified fracture of right ilium, subsequent encounter for fracture with delayed healing" } end def _S32301K do %ICDCode{full_code: "S32301K", category_code: "S32", short_code: "301K", full_name: "Unspecified fracture of right ilium, subsequent encounter for fracture with nonunion", short_name: "Unspecified fracture of right ilium, subsequent encounter for fracture with nonunion", category_name: "Unspecified fracture of right ilium, subsequent encounter for fracture with nonunion" } end def _S32301S do %ICDCode{full_code: "S32301S", category_code: "S32", short_code: "301S", full_name: "Unspecified fracture of right ilium, sequela", short_name: "Unspecified fracture of right ilium, sequela", category_name: "Unspecified fracture of right ilium, sequela" } end def _S32302A do %ICDCode{full_code: "S32302A", category_code: "S32", short_code: "302A", full_name: "Unspecified fracture of left ilium, initial encounter for closed fracture", short_name: "Unspecified fracture of left ilium, initial encounter for closed fracture", category_name: "Unspecified fracture of left ilium, initial encounter for closed fracture" } end def _S32302B do %ICDCode{full_code: "S32302B", category_code: "S32", short_code: "302B", full_name: "Unspecified fracture of left ilium, initial encounter for open fracture", short_name: "Unspecified fracture of left ilium, initial encounter for open fracture", category_name: "Unspecified fracture of left ilium, initial encounter for open fracture" } end def _S32302D do %ICDCode{full_code: "S32302D", category_code: "S32", short_code: "302D", full_name: "Unspecified fracture of left ilium, subsequent encounter for fracture with routine healing", short_name: "Unspecified fracture of left ilium, subsequent encounter for fracture with routine healing", category_name: "Unspecified fracture of left ilium, subsequent encounter for fracture with routine healing" } end def _S32302G do %ICDCode{full_code: "S32302G", category_code: "S32", short_code: "302G", full_name: "Unspecified fracture of left ilium, subsequent encounter for fracture with delayed healing", short_name: "Unspecified fracture of left ilium, subsequent encounter for fracture with delayed healing", category_name: "Unspecified fracture of left ilium, subsequent encounter for fracture with delayed healing" } end def _S32302K do %ICDCode{full_code: "S32302K", category_code: "S32", short_code: "302K", full_name: "Unspecified fracture of left ilium, subsequent encounter for fracture with nonunion", short_name: "Unspecified fracture of left ilium, subsequent encounter for fracture with nonunion", category_name: "Unspecified fracture of left ilium, subsequent encounter for fracture with nonunion" } end def _S32302S do %ICDCode{full_code: "S32302S", category_code: "S32", short_code: "302S", full_name: "Unspecified fracture of left ilium, sequela", short_name: "Unspecified fracture of left ilium, sequela", category_name: "Unspecified fracture of left ilium, sequela" } end def _S32309A do %ICDCode{full_code: "S32309A", category_code: "S32", short_code: "309A", full_name: "Unspecified fracture of unspecified ilium, initial encounter for closed fracture", short_name: "Unspecified fracture of unspecified ilium, initial encounter for closed fracture", category_name: "Unspecified fracture of unspecified ilium, initial encounter for closed fracture" } end def _S32309B do %ICDCode{full_code: "S32309B", category_code: "S32", short_code: "309B", full_name: "Unspecified fracture of unspecified ilium, initial encounter for open fracture", short_name: "Unspecified fracture of unspecified ilium, initial encounter for open fracture", category_name: "Unspecified fracture of unspecified ilium, initial encounter for open fracture" } end def _S32309D do %ICDCode{full_code: "S32309D", category_code: "S32", short_code: "309D", full_name: "Unspecified fracture of unspecified ilium, subsequent encounter for fracture with routine healing", short_name: "Unspecified fracture of unspecified ilium, subsequent encounter for fracture with routine healing", category_name: "Unspecified fracture of unspecified ilium, subsequent encounter for fracture with routine healing" } end def _S32309G do %ICDCode{full_code: "S32309G", category_code: "S32", short_code: "309G", full_name: "Unspecified fracture of unspecified ilium, subsequent encounter for fracture with delayed healing", short_name: "Unspecified fracture of unspecified ilium, subsequent encounter for fracture with delayed healing", category_name: "Unspecified fracture of unspecified ilium, subsequent encounter for fracture with delayed healing" } end def _S32309K do %ICDCode{full_code: "S32309K", category_code: "S32", short_code: "309K", full_name: "Unspecified fracture of unspecified ilium, subsequent encounter for fracture with nonunion", short_name: "Unspecified fracture of unspecified ilium, subsequent encounter for fracture with nonunion", category_name: "Unspecified fracture of unspecified ilium, subsequent encounter for fracture with nonunion" } end def _S32309S do %ICDCode{full_code: "S32309S", category_code: "S32", short_code: "309S", full_name: "Unspecified fracture of unspecified ilium, sequela", short_name: "Unspecified fracture of unspecified ilium, sequela", category_name: "Unspecified fracture of unspecified ilium, sequela" } end def _S32311A do %ICDCode{full_code: "S32311A", category_code: "S32", short_code: "311A", full_name: "Displaced avulsion fracture of right ilium, initial encounter for closed fracture", short_name: "Displaced avulsion fracture of right ilium, initial encounter for closed fracture", category_name: "Displaced avulsion fracture of right ilium, initial encounter for closed fracture" } end def _S32311B do %ICDCode{full_code: "S32311B", category_code: "S32", short_code: "311B", full_name: "Displaced avulsion fracture of right ilium, initial encounter for open fracture", short_name: "Displaced avulsion fracture of right ilium, initial encounter for open fracture", category_name: "Displaced avulsion fracture of right ilium, initial encounter for open fracture" } end def _S32311D do %ICDCode{full_code: "S32311D", category_code: "S32", short_code: "311D", full_name: "Displaced avulsion fracture of right ilium, subsequent encounter for fracture with routine healing", short_name: "Displaced avulsion fracture of right ilium, subsequent encounter for fracture with routine healing", category_name: "Displaced avulsion fracture of right ilium, subsequent encounter for fracture with routine healing" } end def _S32311G do %ICDCode{full_code: "S32311G", category_code: "S32", short_code: "311G", full_name: "Displaced avulsion fracture of right ilium, subsequent encounter for fracture with delayed healing", short_name: "Displaced avulsion fracture of right ilium, subsequent encounter for fracture with delayed healing", category_name: "Displaced avulsion fracture of right ilium, subsequent encounter for fracture with delayed healing" } end def _S32311K do %ICDCode{full_code: "S32311K", category_code: "S32", short_code: "311K", full_name: "Displaced avulsion fracture of right ilium, subsequent encounter for fracture with nonunion", short_name: "Displaced avulsion fracture of right ilium, subsequent encounter for fracture with nonunion", category_name: "Displaced avulsion fracture of right ilium, subsequent encounter for fracture with nonunion" } end def _S32311S do %ICDCode{full_code: "S32311S", category_code: "S32", short_code: "311S", full_name: "Displaced avulsion fracture of right ilium, sequela", short_name: "Displaced avulsion fracture of right ilium, sequela", category_name: "Displaced avulsion fracture of right ilium, sequela" } end def _S32312A do %ICDCode{full_code: "S32312A", category_code: "S32", short_code: "312A", full_name: "Displaced avulsion fracture of left ilium, initial encounter for closed fracture", short_name: "Displaced avulsion fracture of left ilium, initial encounter for closed fracture", category_name: "Displaced avulsion fracture of left ilium, initial encounter for closed fracture" } end def _S32312B do %ICDCode{full_code: "S32312B", category_code: "S32", short_code: "312B", full_name: "Displaced avulsion fracture of left ilium, initial encounter for open fracture", short_name: "Displaced avulsion fracture of left ilium, initial encounter for open fracture", category_name: "Displaced avulsion fracture of left ilium, initial encounter for open fracture" } end def _S32312D do %ICDCode{full_code: "S32312D", category_code: "S32", short_code: "312D", full_name: "Displaced avulsion fracture of left ilium, subsequent encounter for fracture with routine healing", short_name: "Displaced avulsion fracture of left ilium, subsequent encounter for fracture with routine healing", category_name: "Displaced avulsion fracture of left ilium, subsequent encounter for fracture with routine healing" } end def _S32312G do %ICDCode{full_code: "S32312G", category_code: "S32", short_code: "312G", full_name: "Displaced avulsion fracture of left ilium, subsequent encounter for fracture with delayed healing", short_name: "Displaced avulsion fracture of left ilium, subsequent encounter for fracture with delayed healing", category_name: "Displaced avulsion fracture of left ilium, subsequent encounter for fracture with delayed healing" } end def _S32312K do %ICDCode{full_code: "S32312K", category_code: "S32", short_code: "312K", full_name: "Displaced avulsion fracture of left ilium, subsequent encounter for fracture with nonunion", short_name: "Displaced avulsion fracture of left ilium, subsequent encounter for fracture with nonunion", category_name: "Displaced avulsion fracture of left ilium, subsequent encounter for fracture with nonunion" } end def _S32312S do %ICDCode{full_code: "S32312S", category_code: "S32", short_code: "312S", full_name: "Displaced avulsion fracture of left ilium, sequela", short_name: "Displaced avulsion fracture of left ilium, sequela", category_name: "Displaced avulsion fracture of left ilium, sequela" } end def _S32313A do %ICDCode{full_code: "S32313A", category_code: "S32", short_code: "313A", full_name: "Displaced avulsion fracture of unspecified ilium, initial encounter for closed fracture", short_name: "Displaced avulsion fracture of unspecified ilium, initial encounter for closed fracture", category_name: "Displaced avulsion fracture of unspecified ilium, initial encounter for closed fracture" } end def _S32313B do %ICDCode{full_code: "S32313B", category_code: "S32", short_code: "313B", full_name: "Displaced avulsion fracture of unspecified ilium, initial encounter for open fracture", short_name: "Displaced avulsion fracture of unspecified ilium, initial encounter for open fracture", category_name: "Displaced avulsion fracture of unspecified ilium, initial encounter for open fracture" } end def _S32313D do %ICDCode{full_code: "S32313D", category_code: "S32", short_code: "313D", full_name: "Displaced avulsion fracture of unspecified ilium, subsequent encounter for fracture with routine healing", short_name: "Displaced avulsion fracture of unspecified ilium, subsequent encounter for fracture with routine healing", category_name: "Displaced avulsion fracture of unspecified ilium, subsequent encounter for fracture with routine healing" } end def _S32313G do %ICDCode{full_code: "S32313G", category_code: "S32", short_code: "313G", full_name: "Displaced avulsion fracture of unspecified ilium, subsequent encounter for fracture with delayed healing", short_name: "Displaced avulsion fracture of unspecified ilium, subsequent encounter for fracture with delayed healing", category_name: "Displaced avulsion fracture of unspecified ilium, subsequent encounter for fracture with delayed healing" } end def _S32313K do %ICDCode{full_code: "S32313K", category_code: "S32", short_code: "313K", full_name: "Displaced avulsion fracture of unspecified ilium, subsequent encounter for fracture with nonunion", short_name: "Displaced avulsion fracture of unspecified ilium, subsequent encounter for fracture with nonunion", category_name: "Displaced avulsion fracture of unspecified ilium, subsequent encounter for fracture with nonunion" } end def _S32313S do %ICDCode{full_code: "S32313S", category_code: "S32", short_code: "313S", full_name: "Displaced avulsion fracture of unspecified ilium, sequela", short_name: "Displaced avulsion fracture of unspecified ilium, sequela", category_name: "Displaced avulsion fracture of unspecified ilium, sequela" } end def _S32314A do %ICDCode{full_code: "S32314A", category_code: "S32", short_code: "314A", full_name: "Nondisplaced avulsion fracture of right ilium, initial encounter for closed fracture", short_name: "Nondisplaced avulsion fracture of right ilium, initial encounter for closed fracture", category_name: "Nondisplaced avulsion fracture of right ilium, initial encounter for closed fracture" } end def _S32314B do %ICDCode{full_code: "S32314B", category_code: "S32", short_code: "314B", full_name: "Nondisplaced avulsion fracture of right ilium, initial encounter for open fracture", short_name: "Nondisplaced avulsion fracture of right ilium, initial encounter for open fracture", category_name: "Nondisplaced avulsion fracture of right ilium, initial encounter for open fracture" } end def _S32314D do %ICDCode{full_code: "S32314D", category_code: "S32", short_code: "314D", full_name: "Nondisplaced avulsion fracture of right ilium, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced avulsion fracture of right ilium, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced avulsion fracture of right ilium, subsequent encounter for fracture with routine healing" } end def _S32314G do %ICDCode{full_code: "S32314G", category_code: "S32", short_code: "314G", full_name: "Nondisplaced avulsion fracture of right ilium, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced avulsion fracture of right ilium, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced avulsion fracture of right ilium, subsequent encounter for fracture with delayed healing" } end def _S32314K do %ICDCode{full_code: "S32314K", category_code: "S32", short_code: "314K", full_name: "Nondisplaced avulsion fracture of right ilium, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced avulsion fracture of right ilium, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced avulsion fracture of right ilium, subsequent encounter for fracture with nonunion" } end def _S32314S do %ICDCode{full_code: "S32314S", category_code: "S32", short_code: "314S", full_name: "Nondisplaced avulsion fracture of right ilium, sequela", short_name: "Nondisplaced avulsion fracture of right ilium, sequela", category_name: "Nondisplaced avulsion fracture of right ilium, sequela" } end def _S32315A do %ICDCode{full_code: "S32315A", category_code: "S32", short_code: "315A", full_name: "Nondisplaced avulsion fracture of left ilium, initial encounter for closed fracture", short_name: "Nondisplaced avulsion fracture of left ilium, initial encounter for closed fracture", category_name: "Nondisplaced avulsion fracture of left ilium, initial encounter for closed fracture" } end def _S32315B do %ICDCode{full_code: "S32315B", category_code: "S32", short_code: "315B", full_name: "Nondisplaced avulsion fracture of left ilium, initial encounter for open fracture", short_name: "Nondisplaced avulsion fracture of left ilium, initial encounter for open fracture", category_name: "Nondisplaced avulsion fracture of left ilium, initial encounter for open fracture" } end def _S32315D do %ICDCode{full_code: "S32315D", category_code: "S32", short_code: "315D", full_name: "Nondisplaced avulsion fracture of left ilium, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced avulsion fracture of left ilium, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced avulsion fracture of left ilium, subsequent encounter for fracture with routine healing" } end def _S32315G do %ICDCode{full_code: "S32315G", category_code: "S32", short_code: "315G", full_name: "Nondisplaced avulsion fracture of left ilium, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced avulsion fracture of left ilium, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced avulsion fracture of left ilium, subsequent encounter for fracture with delayed healing" } end def _S32315K do %ICDCode{full_code: "S32315K", category_code: "S32", short_code: "315K", full_name: "Nondisplaced avulsion fracture of left ilium, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced avulsion fracture of left ilium, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced avulsion fracture of left ilium, subsequent encounter for fracture with nonunion" } end def _S32315S do %ICDCode{full_code: "S32315S", category_code: "S32", short_code: "315S", full_name: "Nondisplaced avulsion fracture of left ilium, sequela", short_name: "Nondisplaced avulsion fracture of left ilium, sequela", category_name: "Nondisplaced avulsion fracture of left ilium, sequela" } end def _S32316A do %ICDCode{full_code: "S32316A", category_code: "S32", short_code: "316A", full_name: "Nondisplaced avulsion fracture of unspecified ilium, initial encounter for closed fracture", short_name: "Nondisplaced avulsion fracture of unspecified ilium, initial encounter for closed fracture", category_name: "Nondisplaced avulsion fracture of unspecified ilium, initial encounter for closed fracture" } end def _S32316B do %ICDCode{full_code: "S32316B", category_code: "S32", short_code: "316B", full_name: "Nondisplaced avulsion fracture of unspecified ilium, initial encounter for open fracture", short_name: "Nondisplaced avulsion fracture of unspecified ilium, initial encounter for open fracture", category_name: "Nondisplaced avulsion fracture of unspecified ilium, initial encounter for open fracture" } end def _S32316D do %ICDCode{full_code: "S32316D", category_code: "S32", short_code: "316D", full_name: "Nondisplaced avulsion fracture of unspecified ilium, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced avulsion fracture of unspecified ilium, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced avulsion fracture of unspecified ilium, subsequent encounter for fracture with routine healing" } end def _S32316G do %ICDCode{full_code: "S32316G", category_code: "S32", short_code: "316G", full_name: "Nondisplaced avulsion fracture of unspecified ilium, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced avulsion fracture of unspecified ilium, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced avulsion fracture of unspecified ilium, subsequent encounter for fracture with delayed healing" } end def _S32316K do %ICDCode{full_code: "S32316K", category_code: "S32", short_code: "316K", full_name: "Nondisplaced avulsion fracture of unspecified ilium, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced avulsion fracture of unspecified ilium, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced avulsion fracture of unspecified ilium, subsequent encounter for fracture with nonunion" } end def _S32316S do %ICDCode{full_code: "S32316S", category_code: "S32", short_code: "316S", full_name: "Nondisplaced avulsion fracture of unspecified ilium, sequela", short_name: "Nondisplaced avulsion fracture of unspecified ilium, sequela", category_name: "Nondisplaced avulsion fracture of unspecified ilium, sequela" } end def _S32391A do %ICDCode{full_code: "S32391A", category_code: "S32", short_code: "391A", full_name: "Other fracture of right ilium, initial encounter for closed fracture", short_name: "Other fracture of right ilium, initial encounter for closed fracture", category_name: "Other fracture of right ilium, initial encounter for closed fracture" } end def _S32391B do %ICDCode{full_code: "S32391B", category_code: "S32", short_code: "391B", full_name: "Other fracture of right ilium, initial encounter for open fracture", short_name: "Other fracture of right ilium, initial encounter for open fracture", category_name: "Other fracture of right ilium, initial encounter for open fracture" } end def _S32391D do %ICDCode{full_code: "S32391D", category_code: "S32", short_code: "391D", full_name: "Other fracture of right ilium, subsequent encounter for fracture with routine healing", short_name: "Other fracture of right ilium, subsequent encounter for fracture with routine healing", category_name: "Other fracture of right ilium, subsequent encounter for fracture with routine healing" } end def _S32391G do %ICDCode{full_code: "S32391G", category_code: "S32", short_code: "391G", full_name: "Other fracture of right ilium, subsequent encounter for fracture with delayed healing", short_name: "Other fracture of right ilium, subsequent encounter for fracture with delayed healing", category_name: "Other fracture of right ilium, subsequent encounter for fracture with delayed healing" } end def _S32391K do %ICDCode{full_code: "S32391K", category_code: "S32", short_code: "391K", full_name: "Other fracture of right ilium, subsequent encounter for fracture with nonunion", short_name: "Other fracture of right ilium, subsequent encounter for fracture with nonunion", category_name: "Other fracture of right ilium, subsequent encounter for fracture with nonunion" } end def _S32391S do %ICDCode{full_code: "S32391S", category_code: "S32", short_code: "391S", full_name: "Other fracture of right ilium, sequela", short_name: "Other fracture of right ilium, sequela", category_name: "Other fracture of right ilium, sequela" } end def _S32392A do %ICDCode{full_code: "S32392A", category_code: "S32", short_code: "392A", full_name: "Other fracture of left ilium, initial encounter for closed fracture", short_name: "Other fracture of left ilium, initial encounter for closed fracture", category_name: "Other fracture of left ilium, initial encounter for closed fracture" } end def _S32392B do %ICDCode{full_code: "S32392B", category_code: "S32", short_code: "392B", full_name: "Other fracture of left ilium, initial encounter for open fracture", short_name: "Other fracture of left ilium, initial encounter for open fracture", category_name: "Other fracture of left ilium, initial encounter for open fracture" } end def _S32392D do %ICDCode{full_code: "S32392D", category_code: "S32", short_code: "392D", full_name: "Other fracture of left ilium, subsequent encounter for fracture with routine healing", short_name: "Other fracture of left ilium, subsequent encounter for fracture with routine healing", category_name: "Other fracture of left ilium, subsequent encounter for fracture with routine healing" } end def _S32392G do %ICDCode{full_code: "S32392G", category_code: "S32", short_code: "392G", full_name: "Other fracture of left ilium, subsequent encounter for fracture with delayed healing", short_name: "Other fracture of left ilium, subsequent encounter for fracture with delayed healing", category_name: "Other fracture of left ilium, subsequent encounter for fracture with delayed healing" } end def _S32392K do %ICDCode{full_code: "S32392K", category_code: "S32", short_code: "392K", full_name: "Other fracture of left ilium, subsequent encounter for fracture with nonunion", short_name: "Other fracture of left ilium, subsequent encounter for fracture with nonunion", category_name: "Other fracture of left ilium, subsequent encounter for fracture with nonunion" } end def _S32392S do %ICDCode{full_code: "S32392S", category_code: "S32", short_code: "392S", full_name: "Other fracture of left ilium, sequela", short_name: "Other fracture of left ilium, sequela", category_name: "Other fracture of left ilium, sequela" } end def _S32399A do %ICDCode{full_code: "S32399A", category_code: "S32", short_code: "399A", full_name: "Other fracture of unspecified ilium, initial encounter for closed fracture", short_name: "Other fracture of unspecified ilium, initial encounter for closed fracture", category_name: "Other fracture of unspecified ilium, initial encounter for closed fracture" } end def _S32399B do %ICDCode{full_code: "S32399B", category_code: "S32", short_code: "399B", full_name: "Other fracture of unspecified ilium, initial encounter for open fracture", short_name: "Other fracture of unspecified ilium, initial encounter for open fracture", category_name: "Other fracture of unspecified ilium, initial encounter for open fracture" } end def _S32399D do %ICDCode{full_code: "S32399D", category_code: "S32", short_code: "399D", full_name: "Other fracture of unspecified ilium, subsequent encounter for fracture with routine healing", short_name: "Other fracture of unspecified ilium, subsequent encounter for fracture with routine healing", category_name: "Other fracture of unspecified ilium, subsequent encounter for fracture with routine healing" } end def _S32399G do %ICDCode{full_code: "S32399G", category_code: "S32", short_code: "399G", full_name: "Other fracture of unspecified ilium, subsequent encounter for fracture with delayed healing", short_name: "Other fracture of unspecified ilium, subsequent encounter for fracture with delayed healing", category_name: "Other fracture of unspecified ilium, subsequent encounter for fracture with delayed healing" } end def _S32399K do %ICDCode{full_code: "S32399K", category_code: "S32", short_code: "399K", full_name: "Other fracture of unspecified ilium, subsequent encounter for fracture with nonunion", short_name: "Other fracture of unspecified ilium, subsequent encounter for fracture with nonunion", category_name: "Other fracture of unspecified ilium, subsequent encounter for fracture with nonunion" } end def _S32399S do %ICDCode{full_code: "S32399S", category_code: "S32", short_code: "399S", full_name: "Other fracture of unspecified ilium, sequela", short_name: "Other fracture of unspecified ilium, sequela", category_name: "Other fracture of unspecified ilium, sequela" } end def _S32401A do %ICDCode{full_code: "S32401A", category_code: "S32", short_code: "401A", full_name: "Unspecified fracture of right acetabulum, initial encounter for closed fracture", short_name: "Unspecified fracture of right acetabulum, initial encounter for closed fracture", category_name: "Unspecified fracture of right acetabulum, initial encounter for closed fracture" } end def _S32401B do %ICDCode{full_code: "S32401B", category_code: "S32", short_code: "401B", full_name: "Unspecified fracture of right acetabulum, initial encounter for open fracture", short_name: "Unspecified fracture of right acetabulum, initial encounter for open fracture", category_name: "Unspecified fracture of right acetabulum, initial encounter for open fracture" } end def _S32401D do %ICDCode{full_code: "S32401D", category_code: "S32", short_code: "401D", full_name: "Unspecified fracture of right acetabulum, subsequent encounter for fracture with routine healing", short_name: "Unspecified fracture of right acetabulum, subsequent encounter for fracture with routine healing", category_name: "Unspecified fracture of right acetabulum, subsequent encounter for fracture with routine healing" } end def _S32401G do %ICDCode{full_code: "S32401G", category_code: "S32", short_code: "401G", full_name: "Unspecified fracture of right acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Unspecified fracture of right acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Unspecified fracture of right acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32401K do %ICDCode{full_code: "S32401K", category_code: "S32", short_code: "401K", full_name: "Unspecified fracture of right acetabulum, subsequent encounter for fracture with nonunion", short_name: "Unspecified fracture of right acetabulum, subsequent encounter for fracture with nonunion", category_name: "Unspecified fracture of right acetabulum, subsequent encounter for fracture with nonunion" } end def _S32401S do %ICDCode{full_code: "S32401S", category_code: "S32", short_code: "401S", full_name: "Unspecified fracture of right acetabulum, sequela", short_name: "Unspecified fracture of right acetabulum, sequela", category_name: "Unspecified fracture of right acetabulum, sequela" } end def _S32402A do %ICDCode{full_code: "S32402A", category_code: "S32", short_code: "402A", full_name: "Unspecified fracture of left acetabulum, initial encounter for closed fracture", short_name: "Unspecified fracture of left acetabulum, initial encounter for closed fracture", category_name: "Unspecified fracture of left acetabulum, initial encounter for closed fracture" } end def _S32402B do %ICDCode{full_code: "S32402B", category_code: "S32", short_code: "402B", full_name: "Unspecified fracture of left acetabulum, initial encounter for open fracture", short_name: "Unspecified fracture of left acetabulum, initial encounter for open fracture", category_name: "Unspecified fracture of left acetabulum, initial encounter for open fracture" } end def _S32402D do %ICDCode{full_code: "S32402D", category_code: "S32", short_code: "402D", full_name: "Unspecified fracture of left acetabulum, subsequent encounter for fracture with routine healing", short_name: "Unspecified fracture of left acetabulum, subsequent encounter for fracture with routine healing", category_name: "Unspecified fracture of left acetabulum, subsequent encounter for fracture with routine healing" } end def _S32402G do %ICDCode{full_code: "S32402G", category_code: "S32", short_code: "402G", full_name: "Unspecified fracture of left acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Unspecified fracture of left acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Unspecified fracture of left acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32402K do %ICDCode{full_code: "S32402K", category_code: "S32", short_code: "402K", full_name: "Unspecified fracture of left acetabulum, subsequent encounter for fracture with nonunion", short_name: "Unspecified fracture of left acetabulum, subsequent encounter for fracture with nonunion", category_name: "Unspecified fracture of left acetabulum, subsequent encounter for fracture with nonunion" } end def _S32402S do %ICDCode{full_code: "S32402S", category_code: "S32", short_code: "402S", full_name: "Unspecified fracture of left acetabulum, sequela", short_name: "Unspecified fracture of left acetabulum, sequela", category_name: "Unspecified fracture of left acetabulum, sequela" } end def _S32409A do %ICDCode{full_code: "S32409A", category_code: "S32", short_code: "409A", full_name: "Unspecified fracture of unspecified acetabulum, initial encounter for closed fracture", short_name: "Unspecified fracture of unspecified acetabulum, initial encounter for closed fracture", category_name: "Unspecified fracture of unspecified acetabulum, initial encounter for closed fracture" } end def _S32409B do %ICDCode{full_code: "S32409B", category_code: "S32", short_code: "409B", full_name: "Unspecified fracture of unspecified acetabulum, initial encounter for open fracture", short_name: "Unspecified fracture of unspecified acetabulum, initial encounter for open fracture", category_name: "Unspecified fracture of unspecified acetabulum, initial encounter for open fracture" } end def _S32409D do %ICDCode{full_code: "S32409D", category_code: "S32", short_code: "409D", full_name: "Unspecified fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing", short_name: "Unspecified fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing", category_name: "Unspecified fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing" } end def _S32409G do %ICDCode{full_code: "S32409G", category_code: "S32", short_code: "409G", full_name: "Unspecified fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Unspecified fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Unspecified fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32409K do %ICDCode{full_code: "S32409K", category_code: "S32", short_code: "409K", full_name: "Unspecified fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion", short_name: "Unspecified fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion", category_name: "Unspecified fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion" } end def _S32409S do %ICDCode{full_code: "S32409S", category_code: "S32", short_code: "409S", full_name: "Unspecified fracture of unspecified acetabulum, sequela", short_name: "Unspecified fracture of unspecified acetabulum, sequela", category_name: "Unspecified fracture of unspecified acetabulum, sequela" } end def _S32411A do %ICDCode{full_code: "S32411A", category_code: "S32", short_code: "411A", full_name: "Displaced fracture of anterior wall of right acetabulum, initial encounter for closed fracture", short_name: "Displaced fracture of anterior wall of right acetabulum, initial encounter for closed fracture", category_name: "Displaced fracture of anterior wall of right acetabulum, initial encounter for closed fracture" } end def _S32411B do %ICDCode{full_code: "S32411B", category_code: "S32", short_code: "411B", full_name: "Displaced fracture of anterior wall of right acetabulum, initial encounter for open fracture", short_name: "Displaced fracture of anterior wall of right acetabulum, initial encounter for open fracture", category_name: "Displaced fracture of anterior wall of right acetabulum, initial encounter for open fracture" } end def _S32411D do %ICDCode{full_code: "S32411D", category_code: "S32", short_code: "411D", full_name: "Displaced fracture of anterior wall of right acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced fracture of anterior wall of right acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced fracture of anterior wall of right acetabulum, subsequent encounter for fracture with routine healing" } end def _S32411G do %ICDCode{full_code: "S32411G", category_code: "S32", short_code: "411G", full_name: "Displaced fracture of anterior wall of right acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced fracture of anterior wall of right acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced fracture of anterior wall of right acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32411K do %ICDCode{full_code: "S32411K", category_code: "S32", short_code: "411K", full_name: "Displaced fracture of anterior wall of right acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced fracture of anterior wall of right acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced fracture of anterior wall of right acetabulum, subsequent encounter for fracture with nonunion" } end def _S32411S do %ICDCode{full_code: "S32411S", category_code: "S32", short_code: "411S", full_name: "Displaced fracture of anterior wall of right acetabulum, sequela", short_name: "Displaced fracture of anterior wall of right acetabulum, sequela", category_name: "Displaced fracture of anterior wall of right acetabulum, sequela" } end def _S32412A do %ICDCode{full_code: "S32412A", category_code: "S32", short_code: "412A", full_name: "Displaced fracture of anterior wall of left acetabulum, initial encounter for closed fracture", short_name: "Displaced fracture of anterior wall of left acetabulum, initial encounter for closed fracture", category_name: "Displaced fracture of anterior wall of left acetabulum, initial encounter for closed fracture" } end def _S32412B do %ICDCode{full_code: "S32412B", category_code: "S32", short_code: "412B", full_name: "Displaced fracture of anterior wall of left acetabulum, initial encounter for open fracture", short_name: "Displaced fracture of anterior wall of left acetabulum, initial encounter for open fracture", category_name: "Displaced fracture of anterior wall of left acetabulum, initial encounter for open fracture" } end def _S32412D do %ICDCode{full_code: "S32412D", category_code: "S32", short_code: "412D", full_name: "Displaced fracture of anterior wall of left acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced fracture of anterior wall of left acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced fracture of anterior wall of left acetabulum, subsequent encounter for fracture with routine healing" } end def _S32412G do %ICDCode{full_code: "S32412G", category_code: "S32", short_code: "412G", full_name: "Displaced fracture of anterior wall of left acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced fracture of anterior wall of left acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced fracture of anterior wall of left acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32412K do %ICDCode{full_code: "S32412K", category_code: "S32", short_code: "412K", full_name: "Displaced fracture of anterior wall of left acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced fracture of anterior wall of left acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced fracture of anterior wall of left acetabulum, subsequent encounter for fracture with nonunion" } end def _S32412S do %ICDCode{full_code: "S32412S", category_code: "S32", short_code: "412S", full_name: "Displaced fracture of anterior wall of left acetabulum, sequela", short_name: "Displaced fracture of anterior wall of left acetabulum, sequela", category_name: "Displaced fracture of anterior wall of left acetabulum, sequela" } end def _S32413A do %ICDCode{full_code: "S32413A", category_code: "S32", short_code: "413A", full_name: "Displaced fracture of anterior wall of unspecified acetabulum, initial encounter for closed fracture", short_name: "Displaced fracture of anterior wall of unspecified acetabulum, initial encounter for closed fracture", category_name: "Displaced fracture of anterior wall of unspecified acetabulum, initial encounter for closed fracture" } end def _S32413B do %ICDCode{full_code: "S32413B", category_code: "S32", short_code: "413B", full_name: "Displaced fracture of anterior wall of unspecified acetabulum, initial encounter for open fracture", short_name: "Displaced fracture of anterior wall of unspecified acetabulum, initial encounter for open fracture", category_name: "Displaced fracture of anterior wall of unspecified acetabulum, initial encounter for open fracture" } end def _S32413D do %ICDCode{full_code: "S32413D", category_code: "S32", short_code: "413D", full_name: "Displaced fracture of anterior wall of unspecified acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced fracture of anterior wall of unspecified acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced fracture of anterior wall of unspecified acetabulum, subsequent encounter for fracture with routine healing" } end def _S32413G do %ICDCode{full_code: "S32413G", category_code: "S32", short_code: "413G", full_name: "Displaced fracture of anterior wall of unspecified acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced fracture of anterior wall of unspecified acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced fracture of anterior wall of unspecified acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32413K do %ICDCode{full_code: "S32413K", category_code: "S32", short_code: "413K", full_name: "Displaced fracture of anterior wall of unspecified acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced fracture of anterior wall of unspecified acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced fracture of anterior wall of unspecified acetabulum, subsequent encounter for fracture with nonunion" } end def _S32413S do %ICDCode{full_code: "S32413S", category_code: "S32", short_code: "413S", full_name: "Displaced fracture of anterior wall of unspecified acetabulum, sequela", short_name: "Displaced fracture of anterior wall of unspecified acetabulum, sequela", category_name: "Displaced fracture of anterior wall of unspecified acetabulum, sequela" } end def _S32414A do %ICDCode{full_code: "S32414A", category_code: "S32", short_code: "414A", full_name: "Nondisplaced fracture of anterior wall of right acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced fracture of anterior wall of right acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced fracture of anterior wall of right acetabulum, initial encounter for closed fracture" } end def _S32414B do %ICDCode{full_code: "S32414B", category_code: "S32", short_code: "414B", full_name: "Nondisplaced fracture of anterior wall of right acetabulum, initial encounter for open fracture", short_name: "Nondisplaced fracture of anterior wall of right acetabulum, initial encounter for open fracture", category_name: "Nondisplaced fracture of anterior wall of right acetabulum, initial encounter for open fracture" } end def _S32414D do %ICDCode{full_code: "S32414D", category_code: "S32", short_code: "414D", full_name: "Nondisplaced fracture of anterior wall of right acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced fracture of anterior wall of right acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced fracture of anterior wall of right acetabulum, subsequent encounter for fracture with routine healing" } end def _S32414G do %ICDCode{full_code: "S32414G", category_code: "S32", short_code: "414G", full_name: "Nondisplaced fracture of anterior wall of right acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced fracture of anterior wall of right acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced fracture of anterior wall of right acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32414K do %ICDCode{full_code: "S32414K", category_code: "S32", short_code: "414K", full_name: "Nondisplaced fracture of anterior wall of right acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced fracture of anterior wall of right acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced fracture of anterior wall of right acetabulum, subsequent encounter for fracture with nonunion" } end def _S32414S do %ICDCode{full_code: "S32414S", category_code: "S32", short_code: "414S", full_name: "Nondisplaced fracture of anterior wall of right acetabulum, sequela", short_name: "Nondisplaced fracture of anterior wall of right acetabulum, sequela", category_name: "Nondisplaced fracture of anterior wall of right acetabulum, sequela" } end def _S32415A do %ICDCode{full_code: "S32415A", category_code: "S32", short_code: "415A", full_name: "Nondisplaced fracture of anterior wall of left acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced fracture of anterior wall of left acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced fracture of anterior wall of left acetabulum, initial encounter for closed fracture" } end def _S32415B do %ICDCode{full_code: "S32415B", category_code: "S32", short_code: "415B", full_name: "Nondisplaced fracture of anterior wall of left acetabulum, initial encounter for open fracture", short_name: "Nondisplaced fracture of anterior wall of left acetabulum, initial encounter for open fracture", category_name: "Nondisplaced fracture of anterior wall of left acetabulum, initial encounter for open fracture" } end def _S32415D do %ICDCode{full_code: "S32415D", category_code: "S32", short_code: "415D", full_name: "Nondisplaced fracture of anterior wall of left acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced fracture of anterior wall of left acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced fracture of anterior wall of left acetabulum, subsequent encounter for fracture with routine healing" } end def _S32415G do %ICDCode{full_code: "S32415G", category_code: "S32", short_code: "415G", full_name: "Nondisplaced fracture of anterior wall of left acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced fracture of anterior wall of left acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced fracture of anterior wall of left acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32415K do %ICDCode{full_code: "S32415K", category_code: "S32", short_code: "415K", full_name: "Nondisplaced fracture of anterior wall of left acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced fracture of anterior wall of left acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced fracture of anterior wall of left acetabulum, subsequent encounter for fracture with nonunion" } end def _S32415S do %ICDCode{full_code: "S32415S", category_code: "S32", short_code: "415S", full_name: "Nondisplaced fracture of anterior wall of left acetabulum, sequela", short_name: "Nondisplaced fracture of anterior wall of left acetabulum, sequela", category_name: "Nondisplaced fracture of anterior wall of left acetabulum, sequela" } end def _S32416A do %ICDCode{full_code: "S32416A", category_code: "S32", short_code: "416A", full_name: "Nondisplaced fracture of anterior wall of unspecified acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced fracture of anterior wall of unspecified acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced fracture of anterior wall of unspecified acetabulum, initial encounter for closed fracture" } end def _S32416B do %ICDCode{full_code: "S32416B", category_code: "S32", short_code: "416B", full_name: "Nondisplaced fracture of anterior wall of unspecified acetabulum, initial encounter for open fracture", short_name: "Nondisplaced fracture of anterior wall of unspecified acetabulum, initial encounter for open fracture", category_name: "Nondisplaced fracture of anterior wall of unspecified acetabulum, initial encounter for open fracture" } end def _S32416D do %ICDCode{full_code: "S32416D", category_code: "S32", short_code: "416D", full_name: "Nondisplaced fracture of anterior wall of unspecified acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced fracture of anterior wall of unspecified acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced fracture of anterior wall of unspecified acetabulum, subsequent encounter for fracture with routine healing" } end def _S32416G do %ICDCode{full_code: "S32416G", category_code: "S32", short_code: "416G", full_name: "Nondisplaced fracture of anterior wall of unspecified acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced fracture of anterior wall of unspecified acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced fracture of anterior wall of unspecified acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32416K do %ICDCode{full_code: "S32416K", category_code: "S32", short_code: "416K", full_name: "Nondisplaced fracture of anterior wall of unspecified acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced fracture of anterior wall of unspecified acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced fracture of anterior wall of unspecified acetabulum, subsequent encounter for fracture with nonunion" } end def _S32416S do %ICDCode{full_code: "S32416S", category_code: "S32", short_code: "416S", full_name: "Nondisplaced fracture of anterior wall of unspecified acetabulum, sequela", short_name: "Nondisplaced fracture of anterior wall of unspecified acetabulum, sequela", category_name: "Nondisplaced fracture of anterior wall of unspecified acetabulum, sequela" } end def _S32421A do %ICDCode{full_code: "S32421A", category_code: "S32", short_code: "421A", full_name: "Displaced fracture of posterior wall of right acetabulum, initial encounter for closed fracture", short_name: "Displaced fracture of posterior wall of right acetabulum, initial encounter for closed fracture", category_name: "Displaced fracture of posterior wall of right acetabulum, initial encounter for closed fracture" } end def _S32421B do %ICDCode{full_code: "S32421B", category_code: "S32", short_code: "421B", full_name: "Displaced fracture of posterior wall of right acetabulum, initial encounter for open fracture", short_name: "Displaced fracture of posterior wall of right acetabulum, initial encounter for open fracture", category_name: "Displaced fracture of posterior wall of right acetabulum, initial encounter for open fracture" } end def _S32421D do %ICDCode{full_code: "S32421D", category_code: "S32", short_code: "421D", full_name: "Displaced fracture of posterior wall of right acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced fracture of posterior wall of right acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced fracture of posterior wall of right acetabulum, subsequent encounter for fracture with routine healing" } end def _S32421G do %ICDCode{full_code: "S32421G", category_code: "S32", short_code: "421G", full_name: "Displaced fracture of posterior wall of right acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced fracture of posterior wall of right acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced fracture of posterior wall of right acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32421K do %ICDCode{full_code: "S32421K", category_code: "S32", short_code: "421K", full_name: "Displaced fracture of posterior wall of right acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced fracture of posterior wall of right acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced fracture of posterior wall of right acetabulum, subsequent encounter for fracture with nonunion" } end def _S32421S do %ICDCode{full_code: "S32421S", category_code: "S32", short_code: "421S", full_name: "Displaced fracture of posterior wall of right acetabulum, sequela", short_name: "Displaced fracture of posterior wall of right acetabulum, sequela", category_name: "Displaced fracture of posterior wall of right acetabulum, sequela" } end def _S32422A do %ICDCode{full_code: "S32422A", category_code: "S32", short_code: "422A", full_name: "Displaced fracture of posterior wall of left acetabulum, initial encounter for closed fracture", short_name: "Displaced fracture of posterior wall of left acetabulum, initial encounter for closed fracture", category_name: "Displaced fracture of posterior wall of left acetabulum, initial encounter for closed fracture" } end def _S32422B do %ICDCode{full_code: "S32422B", category_code: "S32", short_code: "422B", full_name: "Displaced fracture of posterior wall of left acetabulum, initial encounter for open fracture", short_name: "Displaced fracture of posterior wall of left acetabulum, initial encounter for open fracture", category_name: "Displaced fracture of posterior wall of left acetabulum, initial encounter for open fracture" } end def _S32422D do %ICDCode{full_code: "S32422D", category_code: "S32", short_code: "422D", full_name: "Displaced fracture of posterior wall of left acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced fracture of posterior wall of left acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced fracture of posterior wall of left acetabulum, subsequent encounter for fracture with routine healing" } end def _S32422G do %ICDCode{full_code: "S32422G", category_code: "S32", short_code: "422G", full_name: "Displaced fracture of posterior wall of left acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced fracture of posterior wall of left acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced fracture of posterior wall of left acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32422K do %ICDCode{full_code: "S32422K", category_code: "S32", short_code: "422K", full_name: "Displaced fracture of posterior wall of left acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced fracture of posterior wall of left acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced fracture of posterior wall of left acetabulum, subsequent encounter for fracture with nonunion" } end def _S32422S do %ICDCode{full_code: "S32422S", category_code: "S32", short_code: "422S", full_name: "Displaced fracture of posterior wall of left acetabulum, sequela", short_name: "Displaced fracture of posterior wall of left acetabulum, sequela", category_name: "Displaced fracture of posterior wall of left acetabulum, sequela" } end def _S32423A do %ICDCode{full_code: "S32423A", category_code: "S32", short_code: "423A", full_name: "Displaced fracture of posterior wall of unspecified acetabulum, initial encounter for closed fracture", short_name: "Displaced fracture of posterior wall of unspecified acetabulum, initial encounter for closed fracture", category_name: "Displaced fracture of posterior wall of unspecified acetabulum, initial encounter for closed fracture" } end def _S32423B do %ICDCode{full_code: "S32423B", category_code: "S32", short_code: "423B", full_name: "Displaced fracture of posterior wall of unspecified acetabulum, initial encounter for open fracture", short_name: "Displaced fracture of posterior wall of unspecified acetabulum, initial encounter for open fracture", category_name: "Displaced fracture of posterior wall of unspecified acetabulum, initial encounter for open fracture" } end def _S32423D do %ICDCode{full_code: "S32423D", category_code: "S32", short_code: "423D", full_name: "Displaced fracture of posterior wall of unspecified acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced fracture of posterior wall of unspecified acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced fracture of posterior wall of unspecified acetabulum, subsequent encounter for fracture with routine healing" } end def _S32423G do %ICDCode{full_code: "S32423G", category_code: "S32", short_code: "423G", full_name: "Displaced fracture of posterior wall of unspecified acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced fracture of posterior wall of unspecified acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced fracture of posterior wall of unspecified acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32423K do %ICDCode{full_code: "S32423K", category_code: "S32", short_code: "423K", full_name: "Displaced fracture of posterior wall of unspecified acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced fracture of posterior wall of unspecified acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced fracture of posterior wall of unspecified acetabulum, subsequent encounter for fracture with nonunion" } end def _S32423S do %ICDCode{full_code: "S32423S", category_code: "S32", short_code: "423S", full_name: "Displaced fracture of posterior wall of unspecified acetabulum, sequela", short_name: "Displaced fracture of posterior wall of unspecified acetabulum, sequela", category_name: "Displaced fracture of posterior wall of unspecified acetabulum, sequela" } end def _S32424A do %ICDCode{full_code: "S32424A", category_code: "S32", short_code: "424A", full_name: "Nondisplaced fracture of posterior wall of right acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced fracture of posterior wall of right acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced fracture of posterior wall of right acetabulum, initial encounter for closed fracture" } end def _S32424B do %ICDCode{full_code: "S32424B", category_code: "S32", short_code: "424B", full_name: "Nondisplaced fracture of posterior wall of right acetabulum, initial encounter for open fracture", short_name: "Nondisplaced fracture of posterior wall of right acetabulum, initial encounter for open fracture", category_name: "Nondisplaced fracture of posterior wall of right acetabulum, initial encounter for open fracture" } end def _S32424D do %ICDCode{full_code: "S32424D", category_code: "S32", short_code: "424D", full_name: "Nondisplaced fracture of posterior wall of right acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced fracture of posterior wall of right acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced fracture of posterior wall of right acetabulum, subsequent encounter for fracture with routine healing" } end def _S32424G do %ICDCode{full_code: "S32424G", category_code: "S32", short_code: "424G", full_name: "Nondisplaced fracture of posterior wall of right acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced fracture of posterior wall of right acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced fracture of posterior wall of right acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32424K do %ICDCode{full_code: "S32424K", category_code: "S32", short_code: "424K", full_name: "Nondisplaced fracture of posterior wall of right acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced fracture of posterior wall of right acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced fracture of posterior wall of right acetabulum, subsequent encounter for fracture with nonunion" } end def _S32424S do %ICDCode{full_code: "S32424S", category_code: "S32", short_code: "424S", full_name: "Nondisplaced fracture of posterior wall of right acetabulum, sequela", short_name: "Nondisplaced fracture of posterior wall of right acetabulum, sequela", category_name: "Nondisplaced fracture of posterior wall of right acetabulum, sequela" } end def _S32425A do %ICDCode{full_code: "S32425A", category_code: "S32", short_code: "425A", full_name: "Nondisplaced fracture of posterior wall of left acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced fracture of posterior wall of left acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced fracture of posterior wall of left acetabulum, initial encounter for closed fracture" } end def _S32425B do %ICDCode{full_code: "S32425B", category_code: "S32", short_code: "425B", full_name: "Nondisplaced fracture of posterior wall of left acetabulum, initial encounter for open fracture", short_name: "Nondisplaced fracture of posterior wall of left acetabulum, initial encounter for open fracture", category_name: "Nondisplaced fracture of posterior wall of left acetabulum, initial encounter for open fracture" } end def _S32425D do %ICDCode{full_code: "S32425D", category_code: "S32", short_code: "425D", full_name: "Nondisplaced fracture of posterior wall of left acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced fracture of posterior wall of left acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced fracture of posterior wall of left acetabulum, subsequent encounter for fracture with routine healing" } end def _S32425G do %ICDCode{full_code: "S32425G", category_code: "S32", short_code: "425G", full_name: "Nondisplaced fracture of posterior wall of left acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced fracture of posterior wall of left acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced fracture of posterior wall of left acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32425K do %ICDCode{full_code: "S32425K", category_code: "S32", short_code: "425K", full_name: "Nondisplaced fracture of posterior wall of left acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced fracture of posterior wall of left acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced fracture of posterior wall of left acetabulum, subsequent encounter for fracture with nonunion" } end def _S32425S do %ICDCode{full_code: "S32425S", category_code: "S32", short_code: "425S", full_name: "Nondisplaced fracture of posterior wall of left acetabulum, sequela", short_name: "Nondisplaced fracture of posterior wall of left acetabulum, sequela", category_name: "Nondisplaced fracture of posterior wall of left acetabulum, sequela" } end def _S32426A do %ICDCode{full_code: "S32426A", category_code: "S32", short_code: "426A", full_name: "Nondisplaced fracture of posterior wall of unspecified acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced fracture of posterior wall of unspecified acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced fracture of posterior wall of unspecified acetabulum, initial encounter for closed fracture" } end def _S32426B do %ICDCode{full_code: "S32426B", category_code: "S32", short_code: "426B", full_name: "Nondisplaced fracture of posterior wall of unspecified acetabulum, initial encounter for open fracture", short_name: "Nondisplaced fracture of posterior wall of unspecified acetabulum, initial encounter for open fracture", category_name: "Nondisplaced fracture of posterior wall of unspecified acetabulum, initial encounter for open fracture" } end def _S32426D do %ICDCode{full_code: "S32426D", category_code: "S32", short_code: "426D", full_name: "Nondisplaced fracture of posterior wall of unspecified acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced fracture of posterior wall of unspecified acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced fracture of posterior wall of unspecified acetabulum, subsequent encounter for fracture with routine healing" } end def _S32426G do %ICDCode{full_code: "S32426G", category_code: "S32", short_code: "426G", full_name: "Nondisplaced fracture of posterior wall of unspecified acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced fracture of posterior wall of unspecified acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced fracture of posterior wall of unspecified acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32426K do %ICDCode{full_code: "S32426K", category_code: "S32", short_code: "426K", full_name: "Nondisplaced fracture of posterior wall of unspecified acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced fracture of posterior wall of unspecified acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced fracture of posterior wall of unspecified acetabulum, subsequent encounter for fracture with nonunion" } end def _S32426S do %ICDCode{full_code: "S32426S", category_code: "S32", short_code: "426S", full_name: "Nondisplaced fracture of posterior wall of unspecified acetabulum, sequela", short_name: "Nondisplaced fracture of posterior wall of unspecified acetabulum, sequela", category_name: "Nondisplaced fracture of posterior wall of unspecified acetabulum, sequela" } end def _S32431A do %ICDCode{full_code: "S32431A", category_code: "S32", short_code: "431A", full_name: "Displaced fracture of anterior column [iliopubic] of right acetabulum, initial encounter for closed fracture", short_name: "Displaced fracture of anterior column [iliopubic] of right acetabulum, initial encounter for closed fracture", category_name: "Displaced fracture of anterior column [iliopubic] of right acetabulum, initial encounter for closed fracture" } end def _S32431B do %ICDCode{full_code: "S32431B", category_code: "S32", short_code: "431B", full_name: "Displaced fracture of anterior column [iliopubic] of right acetabulum, initial encounter for open fracture", short_name: "Displaced fracture of anterior column [iliopubic] of right acetabulum, initial encounter for open fracture", category_name: "Displaced fracture of anterior column [iliopubic] of right acetabulum, initial encounter for open fracture" } end def _S32431D do %ICDCode{full_code: "S32431D", category_code: "S32", short_code: "431D", full_name: "Displaced fracture of anterior column [iliopubic] of right acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced fracture of anterior column [iliopubic] of right acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced fracture of anterior column [iliopubic] of right acetabulum, subsequent encounter for fracture with routine healing" } end def _S32431G do %ICDCode{full_code: "S32431G", category_code: "S32", short_code: "431G", full_name: "Displaced fracture of anterior column [iliopubic] of right acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced fracture of anterior column [iliopubic] of right acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced fracture of anterior column [iliopubic] of right acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32431K do %ICDCode{full_code: "S32431K", category_code: "S32", short_code: "431K", full_name: "Displaced fracture of anterior column [iliopubic] of right acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced fracture of anterior column [iliopubic] of right acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced fracture of anterior column [iliopubic] of right acetabulum, subsequent encounter for fracture with nonunion" } end def _S32431S do %ICDCode{full_code: "S32431S", category_code: "S32", short_code: "431S", full_name: "Displaced fracture of anterior column [iliopubic] of right acetabulum, sequela", short_name: "Displaced fracture of anterior column [iliopubic] of right acetabulum, sequela", category_name: "Displaced fracture of anterior column [iliopubic] of right acetabulum, sequela" } end def _S32432A do %ICDCode{full_code: "S32432A", category_code: "S32", short_code: "432A", full_name: "Displaced fracture of anterior column [iliopubic] of left acetabulum, initial encounter for closed fracture", short_name: "Displaced fracture of anterior column [iliopubic] of left acetabulum, initial encounter for closed fracture", category_name: "Displaced fracture of anterior column [iliopubic] of left acetabulum, initial encounter for closed fracture" } end def _S32432B do %ICDCode{full_code: "S32432B", category_code: "S32", short_code: "432B", full_name: "Displaced fracture of anterior column [iliopubic] of left acetabulum, initial encounter for open fracture", short_name: "Displaced fracture of anterior column [iliopubic] of left acetabulum, initial encounter for open fracture", category_name: "Displaced fracture of anterior column [iliopubic] of left acetabulum, initial encounter for open fracture" } end def _S32432D do %ICDCode{full_code: "S32432D", category_code: "S32", short_code: "432D", full_name: "Displaced fracture of anterior column [iliopubic] of left acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced fracture of anterior column [iliopubic] of left acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced fracture of anterior column [iliopubic] of left acetabulum, subsequent encounter for fracture with routine healing" } end def _S32432G do %ICDCode{full_code: "S32432G", category_code: "S32", short_code: "432G", full_name: "Displaced fracture of anterior column [iliopubic] of left acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced fracture of anterior column [iliopubic] of left acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced fracture of anterior column [iliopubic] of left acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32432K do %ICDCode{full_code: "S32432K", category_code: "S32", short_code: "432K", full_name: "Displaced fracture of anterior column [iliopubic] of left acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced fracture of anterior column [iliopubic] of left acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced fracture of anterior column [iliopubic] of left acetabulum, subsequent encounter for fracture with nonunion" } end def _S32432S do %ICDCode{full_code: "S32432S", category_code: "S32", short_code: "432S", full_name: "Displaced fracture of anterior column [iliopubic] of left acetabulum, sequela", short_name: "Displaced fracture of anterior column [iliopubic] of left acetabulum, sequela", category_name: "Displaced fracture of anterior column [iliopubic] of left acetabulum, sequela" } end def _S32433A do %ICDCode{full_code: "S32433A", category_code: "S32", short_code: "433A", full_name: "Displaced fracture of anterior column [iliopubic] of unspecified acetabulum, initial encounter for closed fracture", short_name: "Displaced fracture of anterior column [iliopubic] of unspecified acetabulum, initial encounter for closed fracture", category_name: "Displaced fracture of anterior column [iliopubic] of unspecified acetabulum, initial encounter for closed fracture" } end def _S32433B do %ICDCode{full_code: "S32433B", category_code: "S32", short_code: "433B", full_name: "Displaced fracture of anterior column [iliopubic] of unspecified acetabulum, initial encounter for open fracture", short_name: "Displaced fracture of anterior column [iliopubic] of unspecified acetabulum, initial encounter for open fracture", category_name: "Displaced fracture of anterior column [iliopubic] of unspecified acetabulum, initial encounter for open fracture" } end def _S32433D do %ICDCode{full_code: "S32433D", category_code: "S32", short_code: "433D", full_name: "Displaced fracture of anterior column [iliopubic] of unspecified acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced fracture of anterior column [iliopubic] of unspecified acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced fracture of anterior column [iliopubic] of unspecified acetabulum, subsequent encounter for fracture with routine healing" } end def _S32433G do %ICDCode{full_code: "S32433G", category_code: "S32", short_code: "433G", full_name: "Displaced fracture of anterior column [iliopubic] of unspecified acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced fracture of anterior column [iliopubic] of unspecified acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced fracture of anterior column [iliopubic] of unspecified acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32433K do %ICDCode{full_code: "S32433K", category_code: "S32", short_code: "433K", full_name: "Displaced fracture of anterior column [iliopubic] of unspecified acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced fracture of anterior column [iliopubic] of unspecified acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced fracture of anterior column [iliopubic] of unspecified acetabulum, subsequent encounter for fracture with nonunion" } end def _S32433S do %ICDCode{full_code: "S32433S", category_code: "S32", short_code: "433S", full_name: "Displaced fracture of anterior column [iliopubic] of unspecified acetabulum, sequela", short_name: "Displaced fracture of anterior column [iliopubic] of unspecified acetabulum, sequela", category_name: "Displaced fracture of anterior column [iliopubic] of unspecified acetabulum, sequela" } end def _S32434A do %ICDCode{full_code: "S32434A", category_code: "S32", short_code: "434A", full_name: "Nondisplaced fracture of anterior column [iliopubic] of right acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced fracture of anterior column [iliopubic] of right acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced fracture of anterior column [iliopubic] of right acetabulum, initial encounter for closed fracture" } end def _S32434B do %ICDCode{full_code: "S32434B", category_code: "S32", short_code: "434B", full_name: "Nondisplaced fracture of anterior column [iliopubic] of right acetabulum, initial encounter for open fracture", short_name: "Nondisplaced fracture of anterior column [iliopubic] of right acetabulum, initial encounter for open fracture", category_name: "Nondisplaced fracture of anterior column [iliopubic] of right acetabulum, initial encounter for open fracture" } end def _S32434D do %ICDCode{full_code: "S32434D", category_code: "S32", short_code: "434D", full_name: "Nondisplaced fracture of anterior column [iliopubic] of right acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced fracture of anterior column [iliopubic] of right acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced fracture of anterior column [iliopubic] of right acetabulum, subsequent encounter for fracture with routine healing" } end def _S32434G do %ICDCode{full_code: "S32434G", category_code: "S32", short_code: "434G", full_name: "Nondisplaced fracture of anterior column [iliopubic] of right acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced fracture of anterior column [iliopubic] of right acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced fracture of anterior column [iliopubic] of right acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32434K do %ICDCode{full_code: "S32434K", category_code: "S32", short_code: "434K", full_name: "Nondisplaced fracture of anterior column [iliopubic] of right acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced fracture of anterior column [iliopubic] of right acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced fracture of anterior column [iliopubic] of right acetabulum, subsequent encounter for fracture with nonunion" } end def _S32434S do %ICDCode{full_code: "S32434S", category_code: "S32", short_code: "434S", full_name: "Nondisplaced fracture of anterior column [iliopubic] of right acetabulum, sequela", short_name: "Nondisplaced fracture of anterior column [iliopubic] of right acetabulum, sequela", category_name: "Nondisplaced fracture of anterior column [iliopubic] of right acetabulum, sequela" } end def _S32435A do %ICDCode{full_code: "S32435A", category_code: "S32", short_code: "435A", full_name: "Nondisplaced fracture of anterior column [iliopubic] of left acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced fracture of anterior column [iliopubic] of left acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced fracture of anterior column [iliopubic] of left acetabulum, initial encounter for closed fracture" } end def _S32435B do %ICDCode{full_code: "S32435B", category_code: "S32", short_code: "435B", full_name: "Nondisplaced fracture of anterior column [iliopubic] of left acetabulum, initial encounter for open fracture", short_name: "Nondisplaced fracture of anterior column [iliopubic] of left acetabulum, initial encounter for open fracture", category_name: "Nondisplaced fracture of anterior column [iliopubic] of left acetabulum, initial encounter for open fracture" } end def _S32435D do %ICDCode{full_code: "S32435D", category_code: "S32", short_code: "435D", full_name: "Nondisplaced fracture of anterior column [iliopubic] of left acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced fracture of anterior column [iliopubic] of left acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced fracture of anterior column [iliopubic] of left acetabulum, subsequent encounter for fracture with routine healing" } end def _S32435G do %ICDCode{full_code: "S32435G", category_code: "S32", short_code: "435G", full_name: "Nondisplaced fracture of anterior column [iliopubic] of left acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced fracture of anterior column [iliopubic] of left acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced fracture of anterior column [iliopubic] of left acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32435K do %ICDCode{full_code: "S32435K", category_code: "S32", short_code: "435K", full_name: "Nondisplaced fracture of anterior column [iliopubic] of left acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced fracture of anterior column [iliopubic] of left acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced fracture of anterior column [iliopubic] of left acetabulum, subsequent encounter for fracture with nonunion" } end def _S32435S do %ICDCode{full_code: "S32435S", category_code: "S32", short_code: "435S", full_name: "Nondisplaced fracture of anterior column [iliopubic] of left acetabulum, sequela", short_name: "Nondisplaced fracture of anterior column [iliopubic] of left acetabulum, sequela", category_name: "Nondisplaced fracture of anterior column [iliopubic] of left acetabulum, sequela" } end def _S32436A do %ICDCode{full_code: "S32436A", category_code: "S32", short_code: "436A", full_name: "Nondisplaced fracture of anterior column [iliopubic] of unspecified acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced fracture of anterior column [iliopubic] of unspecified acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced fracture of anterior column [iliopubic] of unspecified acetabulum, initial encounter for closed fracture" } end def _S32436B do %ICDCode{full_code: "S32436B", category_code: "S32", short_code: "436B", full_name: "Nondisplaced fracture of anterior column [iliopubic] of unspecified acetabulum, initial encounter for open fracture", short_name: "Nondisplaced fracture of anterior column [iliopubic] of unspecified acetabulum, initial encounter for open fracture", category_name: "Nondisplaced fracture of anterior column [iliopubic] of unspecified acetabulum, initial encounter for open fracture" } end def _S32436D do %ICDCode{full_code: "S32436D", category_code: "S32", short_code: "436D", full_name: "Nondisplaced fracture of anterior column [iliopubic] of unspecified acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced fracture of anterior column [iliopubic] of unspecified acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced fracture of anterior column [iliopubic] of unspecified acetabulum, subsequent encounter for fracture with routine healing" } end def _S32436G do %ICDCode{full_code: "S32436G", category_code: "S32", short_code: "436G", full_name: "Nondisplaced fracture of anterior column [iliopubic] of unspecified acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced fracture of anterior column [iliopubic] of unspecified acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced fracture of anterior column [iliopubic] of unspecified acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32436K do %ICDCode{full_code: "S32436K", category_code: "S32", short_code: "436K", full_name: "Nondisplaced fracture of anterior column [iliopubic] of unspecified acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced fracture of anterior column [iliopubic] of unspecified acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced fracture of anterior column [iliopubic] of unspecified acetabulum, subsequent encounter for fracture with nonunion" } end def _S32436S do %ICDCode{full_code: "S32436S", category_code: "S32", short_code: "436S", full_name: "Nondisplaced fracture of anterior column [iliopubic] of unspecified acetabulum, sequela", short_name: "Nondisplaced fracture of anterior column [iliopubic] of unspecified acetabulum, sequela", category_name: "Nondisplaced fracture of anterior column [iliopubic] of unspecified acetabulum, sequela" } end def _S32441A do %ICDCode{full_code: "S32441A", category_code: "S32", short_code: "441A", full_name: "Displaced fracture of posterior column [ilioischial] of right acetabulum, initial encounter for closed fracture", short_name: "Displaced fracture of posterior column [ilioischial] of right acetabulum, initial encounter for closed fracture", category_name: "Displaced fracture of posterior column [ilioischial] of right acetabulum, initial encounter for closed fracture" } end def _S32441B do %ICDCode{full_code: "S32441B", category_code: "S32", short_code: "441B", full_name: "Displaced fracture of posterior column [ilioischial] of right acetabulum, initial encounter for open fracture", short_name: "Displaced fracture of posterior column [ilioischial] of right acetabulum, initial encounter for open fracture", category_name: "Displaced fracture of posterior column [ilioischial] of right acetabulum, initial encounter for open fracture" } end def _S32441D do %ICDCode{full_code: "S32441D", category_code: "S32", short_code: "441D", full_name: "Displaced fracture of posterior column [ilioischial] of right acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced fracture of posterior column [ilioischial] of right acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced fracture of posterior column [ilioischial] of right acetabulum, subsequent encounter for fracture with routine healing" } end def _S32441G do %ICDCode{full_code: "S32441G", category_code: "S32", short_code: "441G", full_name: "Displaced fracture of posterior column [ilioischial] of right acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced fracture of posterior column [ilioischial] of right acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced fracture of posterior column [ilioischial] of right acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32441K do %ICDCode{full_code: "S32441K", category_code: "S32", short_code: "441K", full_name: "Displaced fracture of posterior column [ilioischial] of right acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced fracture of posterior column [ilioischial] of right acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced fracture of posterior column [ilioischial] of right acetabulum, subsequent encounter for fracture with nonunion" } end def _S32441S do %ICDCode{full_code: "S32441S", category_code: "S32", short_code: "441S", full_name: "Displaced fracture of posterior column [ilioischial] of right acetabulum, sequela", short_name: "Displaced fracture of posterior column [ilioischial] of right acetabulum, sequela", category_name: "Displaced fracture of posterior column [ilioischial] of right acetabulum, sequela" } end def _S32442A do %ICDCode{full_code: "S32442A", category_code: "S32", short_code: "442A", full_name: "Displaced fracture of posterior column [ilioischial] of left acetabulum, initial encounter for closed fracture", short_name: "Displaced fracture of posterior column [ilioischial] of left acetabulum, initial encounter for closed fracture", category_name: "Displaced fracture of posterior column [ilioischial] of left acetabulum, initial encounter for closed fracture" } end def _S32442B do %ICDCode{full_code: "S32442B", category_code: "S32", short_code: "442B", full_name: "Displaced fracture of posterior column [ilioischial] of left acetabulum, initial encounter for open fracture", short_name: "Displaced fracture of posterior column [ilioischial] of left acetabulum, initial encounter for open fracture", category_name: "Displaced fracture of posterior column [ilioischial] of left acetabulum, initial encounter for open fracture" } end def _S32442D do %ICDCode{full_code: "S32442D", category_code: "S32", short_code: "442D", full_name: "Displaced fracture of posterior column [ilioischial] of left acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced fracture of posterior column [ilioischial] of left acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced fracture of posterior column [ilioischial] of left acetabulum, subsequent encounter for fracture with routine healing" } end def _S32442G do %ICDCode{full_code: "S32442G", category_code: "S32", short_code: "442G", full_name: "Displaced fracture of posterior column [ilioischial] of left acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced fracture of posterior column [ilioischial] of left acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced fracture of posterior column [ilioischial] of left acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32442K do %ICDCode{full_code: "S32442K", category_code: "S32", short_code: "442K", full_name: "Displaced fracture of posterior column [ilioischial] of left acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced fracture of posterior column [ilioischial] of left acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced fracture of posterior column [ilioischial] of left acetabulum, subsequent encounter for fracture with nonunion" } end def _S32442S do %ICDCode{full_code: "S32442S", category_code: "S32", short_code: "442S", full_name: "Displaced fracture of posterior column [ilioischial] of left acetabulum, sequela", short_name: "Displaced fracture of posterior column [ilioischial] of left acetabulum, sequela", category_name: "Displaced fracture of posterior column [ilioischial] of left acetabulum, sequela" } end def _S32443A do %ICDCode{full_code: "S32443A", category_code: "S32", short_code: "443A", full_name: "Displaced fracture of posterior column [ilioischial] of unspecified acetabulum, initial encounter for closed fracture", short_name: "Displaced fracture of posterior column [ilioischial] of unspecified acetabulum, initial encounter for closed fracture", category_name: "Displaced fracture of posterior column [ilioischial] of unspecified acetabulum, initial encounter for closed fracture" } end def _S32443B do %ICDCode{full_code: "S32443B", category_code: "S32", short_code: "443B", full_name: "Displaced fracture of posterior column [ilioischial] of unspecified acetabulum, initial encounter for open fracture", short_name: "Displaced fracture of posterior column [ilioischial] of unspecified acetabulum, initial encounter for open fracture", category_name: "Displaced fracture of posterior column [ilioischial] of unspecified acetabulum, initial encounter for open fracture" } end def _S32443D do %ICDCode{full_code: "S32443D", category_code: "S32", short_code: "443D", full_name: "Displaced fracture of posterior column [ilioischial] of unspecified acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced fracture of posterior column [ilioischial] of unspecified acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced fracture of posterior column [ilioischial] of unspecified acetabulum, subsequent encounter for fracture with routine healing" } end def _S32443G do %ICDCode{full_code: "S32443G", category_code: "S32", short_code: "443G", full_name: "Displaced fracture of posterior column [ilioischial] of unspecified acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced fracture of posterior column [ilioischial] of unspecified acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced fracture of posterior column [ilioischial] of unspecified acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32443K do %ICDCode{full_code: "S32443K", category_code: "S32", short_code: "443K", full_name: "Displaced fracture of posterior column [ilioischial] of unspecified acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced fracture of posterior column [ilioischial] of unspecified acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced fracture of posterior column [ilioischial] of unspecified acetabulum, subsequent encounter for fracture with nonunion" } end def _S32443S do %ICDCode{full_code: "S32443S", category_code: "S32", short_code: "443S", full_name: "Displaced fracture of posterior column [ilioischial] of unspecified acetabulum, sequela", short_name: "Displaced fracture of posterior column [ilioischial] of unspecified acetabulum, sequela", category_name: "Displaced fracture of posterior column [ilioischial] of unspecified acetabulum, sequela" } end def _S32444A do %ICDCode{full_code: "S32444A", category_code: "S32", short_code: "444A", full_name: "Nondisplaced fracture of posterior column [ilioischial] of right acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced fracture of posterior column [ilioischial] of right acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced fracture of posterior column [ilioischial] of right acetabulum, initial encounter for closed fracture" } end def _S32444B do %ICDCode{full_code: "S32444B", category_code: "S32", short_code: "444B", full_name: "Nondisplaced fracture of posterior column [ilioischial] of right acetabulum, initial encounter for open fracture", short_name: "Nondisplaced fracture of posterior column [ilioischial] of right acetabulum, initial encounter for open fracture", category_name: "Nondisplaced fracture of posterior column [ilioischial] of right acetabulum, initial encounter for open fracture" } end def _S32444D do %ICDCode{full_code: "S32444D", category_code: "S32", short_code: "444D", full_name: "Nondisplaced fracture of posterior column [ilioischial] of right acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced fracture of posterior column [ilioischial] of right acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced fracture of posterior column [ilioischial] of right acetabulum, subsequent encounter for fracture with routine healing" } end def _S32444G do %ICDCode{full_code: "S32444G", category_code: "S32", short_code: "444G", full_name: "Nondisplaced fracture of posterior column [ilioischial] of right acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced fracture of posterior column [ilioischial] of right acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced fracture of posterior column [ilioischial] of right acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32444K do %ICDCode{full_code: "S32444K", category_code: "S32", short_code: "444K", full_name: "Nondisplaced fracture of posterior column [ilioischial] of right acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced fracture of posterior column [ilioischial] of right acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced fracture of posterior column [ilioischial] of right acetabulum, subsequent encounter for fracture with nonunion" } end def _S32444S do %ICDCode{full_code: "S32444S", category_code: "S32", short_code: "444S", full_name: "Nondisplaced fracture of posterior column [ilioischial] of right acetabulum, sequela", short_name: "Nondisplaced fracture of posterior column [ilioischial] of right acetabulum, sequela", category_name: "Nondisplaced fracture of posterior column [ilioischial] of right acetabulum, sequela" } end def _S32445A do %ICDCode{full_code: "S32445A", category_code: "S32", short_code: "445A", full_name: "Nondisplaced fracture of posterior column [ilioischial] of left acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced fracture of posterior column [ilioischial] of left acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced fracture of posterior column [ilioischial] of left acetabulum, initial encounter for closed fracture" } end def _S32445B do %ICDCode{full_code: "S32445B", category_code: "S32", short_code: "445B", full_name: "Nondisplaced fracture of posterior column [ilioischial] of left acetabulum, initial encounter for open fracture", short_name: "Nondisplaced fracture of posterior column [ilioischial] of left acetabulum, initial encounter for open fracture", category_name: "Nondisplaced fracture of posterior column [ilioischial] of left acetabulum, initial encounter for open fracture" } end def _S32445D do %ICDCode{full_code: "S32445D", category_code: "S32", short_code: "445D", full_name: "Nondisplaced fracture of posterior column [ilioischial] of left acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced fracture of posterior column [ilioischial] of left acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced fracture of posterior column [ilioischial] of left acetabulum, subsequent encounter for fracture with routine healing" } end def _S32445G do %ICDCode{full_code: "S32445G", category_code: "S32", short_code: "445G", full_name: "Nondisplaced fracture of posterior column [ilioischial] of left acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced fracture of posterior column [ilioischial] of left acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced fracture of posterior column [ilioischial] of left acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32445K do %ICDCode{full_code: "S32445K", category_code: "S32", short_code: "445K", full_name: "Nondisplaced fracture of posterior column [ilioischial] of left acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced fracture of posterior column [ilioischial] of left acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced fracture of posterior column [ilioischial] of left acetabulum, subsequent encounter for fracture with nonunion" } end def _S32445S do %ICDCode{full_code: "S32445S", category_code: "S32", short_code: "445S", full_name: "Nondisplaced fracture of posterior column [ilioischial] of left acetabulum, sequela", short_name: "Nondisplaced fracture of posterior column [ilioischial] of left acetabulum, sequela", category_name: "Nondisplaced fracture of posterior column [ilioischial] of left acetabulum, sequela" } end def _S32446A do %ICDCode{full_code: "S32446A", category_code: "S32", short_code: "446A", full_name: "Nondisplaced fracture of posterior column [ilioischial] of unspecified acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced fracture of posterior column [ilioischial] of unspecified acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced fracture of posterior column [ilioischial] of unspecified acetabulum, initial encounter for closed fracture" } end def _S32446B do %ICDCode{full_code: "S32446B", category_code: "S32", short_code: "446B", full_name: "Nondisplaced fracture of posterior column [ilioischial] of unspecified acetabulum, initial encounter for open fracture", short_name: "Nondisplaced fracture of posterior column [ilioischial] of unspecified acetabulum, initial encounter for open fracture", category_name: "Nondisplaced fracture of posterior column [ilioischial] of unspecified acetabulum, initial encounter for open fracture" } end def _S32446D do %ICDCode{full_code: "S32446D", category_code: "S32", short_code: "446D", full_name: "Nondisplaced fracture of posterior column [ilioischial] of unspecified acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced fracture of posterior column [ilioischial] of unspecified acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced fracture of posterior column [ilioischial] of unspecified acetabulum, subsequent encounter for fracture with routine healing" } end def _S32446G do %ICDCode{full_code: "S32446G", category_code: "S32", short_code: "446G", full_name: "Nondisplaced fracture of posterior column [ilioischial] of unspecified acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced fracture of posterior column [ilioischial] of unspecified acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced fracture of posterior column [ilioischial] of unspecified acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32446K do %ICDCode{full_code: "S32446K", category_code: "S32", short_code: "446K", full_name: "Nondisplaced fracture of posterior column [ilioischial] of unspecified acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced fracture of posterior column [ilioischial] of unspecified acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced fracture of posterior column [ilioischial] of unspecified acetabulum, subsequent encounter for fracture with nonunion" } end def _S32446S do %ICDCode{full_code: "S32446S", category_code: "S32", short_code: "446S", full_name: "Nondisplaced fracture of posterior column [ilioischial] of unspecified acetabulum, sequela", short_name: "Nondisplaced fracture of posterior column [ilioischial] of unspecified acetabulum, sequela", category_name: "Nondisplaced fracture of posterior column [ilioischial] of unspecified acetabulum, sequela" } end def _S32451A do %ICDCode{full_code: "S32451A", category_code: "S32", short_code: "451A", full_name: "Displaced transverse fracture of right acetabulum, initial encounter for closed fracture", short_name: "Displaced transverse fracture of right acetabulum, initial encounter for closed fracture", category_name: "Displaced transverse fracture of right acetabulum, initial encounter for closed fracture" } end def _S32451B do %ICDCode{full_code: "S32451B", category_code: "S32", short_code: "451B", full_name: "Displaced transverse fracture of right acetabulum, initial encounter for open fracture", short_name: "Displaced transverse fracture of right acetabulum, initial encounter for open fracture", category_name: "Displaced transverse fracture of right acetabulum, initial encounter for open fracture" } end def _S32451D do %ICDCode{full_code: "S32451D", category_code: "S32", short_code: "451D", full_name: "Displaced transverse fracture of right acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced transverse fracture of right acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced transverse fracture of right acetabulum, subsequent encounter for fracture with routine healing" } end def _S32451G do %ICDCode{full_code: "S32451G", category_code: "S32", short_code: "451G", full_name: "Displaced transverse fracture of right acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced transverse fracture of right acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced transverse fracture of right acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32451K do %ICDCode{full_code: "S32451K", category_code: "S32", short_code: "451K", full_name: "Displaced transverse fracture of right acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced transverse fracture of right acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced transverse fracture of right acetabulum, subsequent encounter for fracture with nonunion" } end def _S32451S do %ICDCode{full_code: "S32451S", category_code: "S32", short_code: "451S", full_name: "Displaced transverse fracture of right acetabulum, sequela", short_name: "Displaced transverse fracture of right acetabulum, sequela", category_name: "Displaced transverse fracture of right acetabulum, sequela" } end def _S32452A do %ICDCode{full_code: "S32452A", category_code: "S32", short_code: "452A", full_name: "Displaced transverse fracture of left acetabulum, initial encounter for closed fracture", short_name: "Displaced transverse fracture of left acetabulum, initial encounter for closed fracture", category_name: "Displaced transverse fracture of left acetabulum, initial encounter for closed fracture" } end def _S32452B do %ICDCode{full_code: "S32452B", category_code: "S32", short_code: "452B", full_name: "Displaced transverse fracture of left acetabulum, initial encounter for open fracture", short_name: "Displaced transverse fracture of left acetabulum, initial encounter for open fracture", category_name: "Displaced transverse fracture of left acetabulum, initial encounter for open fracture" } end def _S32452D do %ICDCode{full_code: "S32452D", category_code: "S32", short_code: "452D", full_name: "Displaced transverse fracture of left acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced transverse fracture of left acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced transverse fracture of left acetabulum, subsequent encounter for fracture with routine healing" } end def _S32452G do %ICDCode{full_code: "S32452G", category_code: "S32", short_code: "452G", full_name: "Displaced transverse fracture of left acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced transverse fracture of left acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced transverse fracture of left acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32452K do %ICDCode{full_code: "S32452K", category_code: "S32", short_code: "452K", full_name: "Displaced transverse fracture of left acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced transverse fracture of left acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced transverse fracture of left acetabulum, subsequent encounter for fracture with nonunion" } end def _S32452S do %ICDCode{full_code: "S32452S", category_code: "S32", short_code: "452S", full_name: "Displaced transverse fracture of left acetabulum, sequela", short_name: "Displaced transverse fracture of left acetabulum, sequela", category_name: "Displaced transverse fracture of left acetabulum, sequela" } end def _S32453A do %ICDCode{full_code: "S32453A", category_code: "S32", short_code: "453A", full_name: "Displaced transverse fracture of unspecified acetabulum, initial encounter for closed fracture", short_name: "Displaced transverse fracture of unspecified acetabulum, initial encounter for closed fracture", category_name: "Displaced transverse fracture of unspecified acetabulum, initial encounter for closed fracture" } end def _S32453B do %ICDCode{full_code: "S32453B", category_code: "S32", short_code: "453B", full_name: "Displaced transverse fracture of unspecified acetabulum, initial encounter for open fracture", short_name: "Displaced transverse fracture of unspecified acetabulum, initial encounter for open fracture", category_name: "Displaced transverse fracture of unspecified acetabulum, initial encounter for open fracture" } end def _S32453D do %ICDCode{full_code: "S32453D", category_code: "S32", short_code: "453D", full_name: "Displaced transverse fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced transverse fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced transverse fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing" } end def _S32453G do %ICDCode{full_code: "S32453G", category_code: "S32", short_code: "453G", full_name: "Displaced transverse fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced transverse fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced transverse fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32453K do %ICDCode{full_code: "S32453K", category_code: "S32", short_code: "453K", full_name: "Displaced transverse fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced transverse fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced transverse fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion" } end def _S32453S do %ICDCode{full_code: "S32453S", category_code: "S32", short_code: "453S", full_name: "Displaced transverse fracture of unspecified acetabulum, sequela", short_name: "Displaced transverse fracture of unspecified acetabulum, sequela", category_name: "Displaced transverse fracture of unspecified acetabulum, sequela" } end def _S32454A do %ICDCode{full_code: "S32454A", category_code: "S32", short_code: "454A", full_name: "Nondisplaced transverse fracture of right acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced transverse fracture of right acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced transverse fracture of right acetabulum, initial encounter for closed fracture" } end def _S32454B do %ICDCode{full_code: "S32454B", category_code: "S32", short_code: "454B", full_name: "Nondisplaced transverse fracture of right acetabulum, initial encounter for open fracture", short_name: "Nondisplaced transverse fracture of right acetabulum, initial encounter for open fracture", category_name: "Nondisplaced transverse fracture of right acetabulum, initial encounter for open fracture" } end def _S32454D do %ICDCode{full_code: "S32454D", category_code: "S32", short_code: "454D", full_name: "Nondisplaced transverse fracture of right acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced transverse fracture of right acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced transverse fracture of right acetabulum, subsequent encounter for fracture with routine healing" } end def _S32454G do %ICDCode{full_code: "S32454G", category_code: "S32", short_code: "454G", full_name: "Nondisplaced transverse fracture of right acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced transverse fracture of right acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced transverse fracture of right acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32454K do %ICDCode{full_code: "S32454K", category_code: "S32", short_code: "454K", full_name: "Nondisplaced transverse fracture of right acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced transverse fracture of right acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced transverse fracture of right acetabulum, subsequent encounter for fracture with nonunion" } end def _S32454S do %ICDCode{full_code: "S32454S", category_code: "S32", short_code: "454S", full_name: "Nondisplaced transverse fracture of right acetabulum, sequela", short_name: "Nondisplaced transverse fracture of right acetabulum, sequela", category_name: "Nondisplaced transverse fracture of right acetabulum, sequela" } end def _S32455A do %ICDCode{full_code: "S32455A", category_code: "S32", short_code: "455A", full_name: "Nondisplaced transverse fracture of left acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced transverse fracture of left acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced transverse fracture of left acetabulum, initial encounter for closed fracture" } end def _S32455B do %ICDCode{full_code: "S32455B", category_code: "S32", short_code: "455B", full_name: "Nondisplaced transverse fracture of left acetabulum, initial encounter for open fracture", short_name: "Nondisplaced transverse fracture of left acetabulum, initial encounter for open fracture", category_name: "Nondisplaced transverse fracture of left acetabulum, initial encounter for open fracture" } end def _S32455D do %ICDCode{full_code: "S32455D", category_code: "S32", short_code: "455D", full_name: "Nondisplaced transverse fracture of left acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced transverse fracture of left acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced transverse fracture of left acetabulum, subsequent encounter for fracture with routine healing" } end def _S32455G do %ICDCode{full_code: "S32455G", category_code: "S32", short_code: "455G", full_name: "Nondisplaced transverse fracture of left acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced transverse fracture of left acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced transverse fracture of left acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32455K do %ICDCode{full_code: "S32455K", category_code: "S32", short_code: "455K", full_name: "Nondisplaced transverse fracture of left acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced transverse fracture of left acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced transverse fracture of left acetabulum, subsequent encounter for fracture with nonunion" } end def _S32455S do %ICDCode{full_code: "S32455S", category_code: "S32", short_code: "455S", full_name: "Nondisplaced transverse fracture of left acetabulum, sequela", short_name: "Nondisplaced transverse fracture of left acetabulum, sequela", category_name: "Nondisplaced transverse fracture of left acetabulum, sequela" } end def _S32456A do %ICDCode{full_code: "S32456A", category_code: "S32", short_code: "456A", full_name: "Nondisplaced transverse fracture of unspecified acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced transverse fracture of unspecified acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced transverse fracture of unspecified acetabulum, initial encounter for closed fracture" } end def _S32456B do %ICDCode{full_code: "S32456B", category_code: "S32", short_code: "456B", full_name: "Nondisplaced transverse fracture of unspecified acetabulum, initial encounter for open fracture", short_name: "Nondisplaced transverse fracture of unspecified acetabulum, initial encounter for open fracture", category_name: "Nondisplaced transverse fracture of unspecified acetabulum, initial encounter for open fracture" } end def _S32456D do %ICDCode{full_code: "S32456D", category_code: "S32", short_code: "456D", full_name: "Nondisplaced transverse fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced transverse fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced transverse fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing" } end def _S32456G do %ICDCode{full_code: "S32456G", category_code: "S32", short_code: "456G", full_name: "Nondisplaced transverse fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced transverse fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced transverse fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32456K do %ICDCode{full_code: "S32456K", category_code: "S32", short_code: "456K", full_name: "Nondisplaced transverse fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced transverse fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced transverse fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion" } end def _S32456S do %ICDCode{full_code: "S32456S", category_code: "S32", short_code: "456S", full_name: "Nondisplaced transverse fracture of unspecified acetabulum, sequela", short_name: "Nondisplaced transverse fracture of unspecified acetabulum, sequela", category_name: "Nondisplaced transverse fracture of unspecified acetabulum, sequela" } end def _S32461A do %ICDCode{full_code: "S32461A", category_code: "S32", short_code: "461A", full_name: "Displaced associated transverse-posterior fracture of right acetabulum, initial encounter for closed fracture", short_name: "Displaced associated transverse-posterior fracture of right acetabulum, initial encounter for closed fracture", category_name: "Displaced associated transverse-posterior fracture of right acetabulum, initial encounter for closed fracture" } end def _S32461B do %ICDCode{full_code: "S32461B", category_code: "S32", short_code: "461B", full_name: "Displaced associated transverse-posterior fracture of right acetabulum, initial encounter for open fracture", short_name: "Displaced associated transverse-posterior fracture of right acetabulum, initial encounter for open fracture", category_name: "Displaced associated transverse-posterior fracture of right acetabulum, initial encounter for open fracture" } end def _S32461D do %ICDCode{full_code: "S32461D", category_code: "S32", short_code: "461D", full_name: "Displaced associated transverse-posterior fracture of right acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced associated transverse-posterior fracture of right acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced associated transverse-posterior fracture of right acetabulum, subsequent encounter for fracture with routine healing" } end def _S32461G do %ICDCode{full_code: "S32461G", category_code: "S32", short_code: "461G", full_name: "Displaced associated transverse-posterior fracture of right acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced associated transverse-posterior fracture of right acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced associated transverse-posterior fracture of right acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32461K do %ICDCode{full_code: "S32461K", category_code: "S32", short_code: "461K", full_name: "Displaced associated transverse-posterior fracture of right acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced associated transverse-posterior fracture of right acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced associated transverse-posterior fracture of right acetabulum, subsequent encounter for fracture with nonunion" } end def _S32461S do %ICDCode{full_code: "S32461S", category_code: "S32", short_code: "461S", full_name: "Displaced associated transverse-posterior fracture of right acetabulum, sequela", short_name: "Displaced associated transverse-posterior fracture of right acetabulum, sequela", category_name: "Displaced associated transverse-posterior fracture of right acetabulum, sequela" } end def _S32462A do %ICDCode{full_code: "S32462A", category_code: "S32", short_code: "462A", full_name: "Displaced associated transverse-posterior fracture of left acetabulum, initial encounter for closed fracture", short_name: "Displaced associated transverse-posterior fracture of left acetabulum, initial encounter for closed fracture", category_name: "Displaced associated transverse-posterior fracture of left acetabulum, initial encounter for closed fracture" } end def _S32462B do %ICDCode{full_code: "S32462B", category_code: "S32", short_code: "462B", full_name: "Displaced associated transverse-posterior fracture of left acetabulum, initial encounter for open fracture", short_name: "Displaced associated transverse-posterior fracture of left acetabulum, initial encounter for open fracture", category_name: "Displaced associated transverse-posterior fracture of left acetabulum, initial encounter for open fracture" } end def _S32462D do %ICDCode{full_code: "S32462D", category_code: "S32", short_code: "462D", full_name: "Displaced associated transverse-posterior fracture of left acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced associated transverse-posterior fracture of left acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced associated transverse-posterior fracture of left acetabulum, subsequent encounter for fracture with routine healing" } end def _S32462G do %ICDCode{full_code: "S32462G", category_code: "S32", short_code: "462G", full_name: "Displaced associated transverse-posterior fracture of left acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced associated transverse-posterior fracture of left acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced associated transverse-posterior fracture of left acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32462K do %ICDCode{full_code: "S32462K", category_code: "S32", short_code: "462K", full_name: "Displaced associated transverse-posterior fracture of left acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced associated transverse-posterior fracture of left acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced associated transverse-posterior fracture of left acetabulum, subsequent encounter for fracture with nonunion" } end def _S32462S do %ICDCode{full_code: "S32462S", category_code: "S32", short_code: "462S", full_name: "Displaced associated transverse-posterior fracture of left acetabulum, sequela", short_name: "Displaced associated transverse-posterior fracture of left acetabulum, sequela", category_name: "Displaced associated transverse-posterior fracture of left acetabulum, sequela" } end def _S32463A do %ICDCode{full_code: "S32463A", category_code: "S32", short_code: "463A", full_name: "Displaced associated transverse-posterior fracture of unspecified acetabulum, initial encounter for closed fracture", short_name: "Displaced associated transverse-posterior fracture of unspecified acetabulum, initial encounter for closed fracture", category_name: "Displaced associated transverse-posterior fracture of unspecified acetabulum, initial encounter for closed fracture" } end def _S32463B do %ICDCode{full_code: "S32463B", category_code: "S32", short_code: "463B", full_name: "Displaced associated transverse-posterior fracture of unspecified acetabulum, initial encounter for open fracture", short_name: "Displaced associated transverse-posterior fracture of unspecified acetabulum, initial encounter for open fracture", category_name: "Displaced associated transverse-posterior fracture of unspecified acetabulum, initial encounter for open fracture" } end def _S32463D do %ICDCode{full_code: "S32463D", category_code: "S32", short_code: "463D", full_name: "Displaced associated transverse-posterior fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced associated transverse-posterior fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced associated transverse-posterior fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing" } end def _S32463G do %ICDCode{full_code: "S32463G", category_code: "S32", short_code: "463G", full_name: "Displaced associated transverse-posterior fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced associated transverse-posterior fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced associated transverse-posterior fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32463K do %ICDCode{full_code: "S32463K", category_code: "S32", short_code: "463K", full_name: "Displaced associated transverse-posterior fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced associated transverse-posterior fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced associated transverse-posterior fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion" } end def _S32463S do %ICDCode{full_code: "S32463S", category_code: "S32", short_code: "463S", full_name: "Displaced associated transverse-posterior fracture of unspecified acetabulum, sequela", short_name: "Displaced associated transverse-posterior fracture of unspecified acetabulum, sequela", category_name: "Displaced associated transverse-posterior fracture of unspecified acetabulum, sequela" } end def _S32464A do %ICDCode{full_code: "S32464A", category_code: "S32", short_code: "464A", full_name: "Nondisplaced associated transverse-posterior fracture of right acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced associated transverse-posterior fracture of right acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced associated transverse-posterior fracture of right acetabulum, initial encounter for closed fracture" } end def _S32464B do %ICDCode{full_code: "S32464B", category_code: "S32", short_code: "464B", full_name: "Nondisplaced associated transverse-posterior fracture of right acetabulum, initial encounter for open fracture", short_name: "Nondisplaced associated transverse-posterior fracture of right acetabulum, initial encounter for open fracture", category_name: "Nondisplaced associated transverse-posterior fracture of right acetabulum, initial encounter for open fracture" } end def _S32464D do %ICDCode{full_code: "S32464D", category_code: "S32", short_code: "464D", full_name: "Nondisplaced associated transverse-posterior fracture of right acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced associated transverse-posterior fracture of right acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced associated transverse-posterior fracture of right acetabulum, subsequent encounter for fracture with routine healing" } end def _S32464G do %ICDCode{full_code: "S32464G", category_code: "S32", short_code: "464G", full_name: "Nondisplaced associated transverse-posterior fracture of right acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced associated transverse-posterior fracture of right acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced associated transverse-posterior fracture of right acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32464K do %ICDCode{full_code: "S32464K", category_code: "S32", short_code: "464K", full_name: "Nondisplaced associated transverse-posterior fracture of right acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced associated transverse-posterior fracture of right acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced associated transverse-posterior fracture of right acetabulum, subsequent encounter for fracture with nonunion" } end def _S32464S do %ICDCode{full_code: "S32464S", category_code: "S32", short_code: "464S", full_name: "Nondisplaced associated transverse-posterior fracture of right acetabulum, sequela", short_name: "Nondisplaced associated transverse-posterior fracture of right acetabulum, sequela", category_name: "Nondisplaced associated transverse-posterior fracture of right acetabulum, sequela" } end def _S32465A do %ICDCode{full_code: "S32465A", category_code: "S32", short_code: "465A", full_name: "Nondisplaced associated transverse-posterior fracture of left acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced associated transverse-posterior fracture of left acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced associated transverse-posterior fracture of left acetabulum, initial encounter for closed fracture" } end def _S32465B do %ICDCode{full_code: "S32465B", category_code: "S32", short_code: "465B", full_name: "Nondisplaced associated transverse-posterior fracture of left acetabulum, initial encounter for open fracture", short_name: "Nondisplaced associated transverse-posterior fracture of left acetabulum, initial encounter for open fracture", category_name: "Nondisplaced associated transverse-posterior fracture of left acetabulum, initial encounter for open fracture" } end def _S32465D do %ICDCode{full_code: "S32465D", category_code: "S32", short_code: "465D", full_name: "Nondisplaced associated transverse-posterior fracture of left acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced associated transverse-posterior fracture of left acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced associated transverse-posterior fracture of left acetabulum, subsequent encounter for fracture with routine healing" } end def _S32465G do %ICDCode{full_code: "S32465G", category_code: "S32", short_code: "465G", full_name: "Nondisplaced associated transverse-posterior fracture of left acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced associated transverse-posterior fracture of left acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced associated transverse-posterior fracture of left acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32465K do %ICDCode{full_code: "S32465K", category_code: "S32", short_code: "465K", full_name: "Nondisplaced associated transverse-posterior fracture of left acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced associated transverse-posterior fracture of left acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced associated transverse-posterior fracture of left acetabulum, subsequent encounter for fracture with nonunion" } end def _S32465S do %ICDCode{full_code: "S32465S", category_code: "S32", short_code: "465S", full_name: "Nondisplaced associated transverse-posterior fracture of left acetabulum, sequela", short_name: "Nondisplaced associated transverse-posterior fracture of left acetabulum, sequela", category_name: "Nondisplaced associated transverse-posterior fracture of left acetabulum, sequela" } end def _S32466A do %ICDCode{full_code: "S32466A", category_code: "S32", short_code: "466A", full_name: "Nondisplaced associated transverse-posterior fracture of unspecified acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced associated transverse-posterior fracture of unspecified acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced associated transverse-posterior fracture of unspecified acetabulum, initial encounter for closed fracture" } end def _S32466B do %ICDCode{full_code: "S32466B", category_code: "S32", short_code: "466B", full_name: "Nondisplaced associated transverse-posterior fracture of unspecified acetabulum, initial encounter for open fracture", short_name: "Nondisplaced associated transverse-posterior fracture of unspecified acetabulum, initial encounter for open fracture", category_name: "Nondisplaced associated transverse-posterior fracture of unspecified acetabulum, initial encounter for open fracture" } end def _S32466D do %ICDCode{full_code: "S32466D", category_code: "S32", short_code: "466D", full_name: "Nondisplaced associated transverse-posterior fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced associated transverse-posterior fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced associated transverse-posterior fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing" } end def _S32466G do %ICDCode{full_code: "S32466G", category_code: "S32", short_code: "466G", full_name: "Nondisplaced associated transverse-posterior fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced associated transverse-posterior fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced associated transverse-posterior fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32466K do %ICDCode{full_code: "S32466K", category_code: "S32", short_code: "466K", full_name: "Nondisplaced associated transverse-posterior fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced associated transverse-posterior fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced associated transverse-posterior fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion" } end def _S32466S do %ICDCode{full_code: "S32466S", category_code: "S32", short_code: "466S", full_name: "Nondisplaced associated transverse-posterior fracture of unspecified acetabulum, sequela", short_name: "Nondisplaced associated transverse-posterior fracture of unspecified acetabulum, sequela", category_name: "Nondisplaced associated transverse-posterior fracture of unspecified acetabulum, sequela" } end def _S32471A do %ICDCode{full_code: "S32471A", category_code: "S32", short_code: "471A", full_name: "Displaced fracture of medial wall of right acetabulum, initial encounter for closed fracture", short_name: "Displaced fracture of medial wall of right acetabulum, initial encounter for closed fracture", category_name: "Displaced fracture of medial wall of right acetabulum, initial encounter for closed fracture" } end def _S32471B do %ICDCode{full_code: "S32471B", category_code: "S32", short_code: "471B", full_name: "Displaced fracture of medial wall of right acetabulum, initial encounter for open fracture", short_name: "Displaced fracture of medial wall of right acetabulum, initial encounter for open fracture", category_name: "Displaced fracture of medial wall of right acetabulum, initial encounter for open fracture" } end def _S32471D do %ICDCode{full_code: "S32471D", category_code: "S32", short_code: "471D", full_name: "Displaced fracture of medial wall of right acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced fracture of medial wall of right acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced fracture of medial wall of right acetabulum, subsequent encounter for fracture with routine healing" } end def _S32471G do %ICDCode{full_code: "S32471G", category_code: "S32", short_code: "471G", full_name: "Displaced fracture of medial wall of right acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced fracture of medial wall of right acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced fracture of medial wall of right acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32471K do %ICDCode{full_code: "S32471K", category_code: "S32", short_code: "471K", full_name: "Displaced fracture of medial wall of right acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced fracture of medial wall of right acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced fracture of medial wall of right acetabulum, subsequent encounter for fracture with nonunion" } end def _S32471S do %ICDCode{full_code: "S32471S", category_code: "S32", short_code: "471S", full_name: "Displaced fracture of medial wall of right acetabulum, sequela", short_name: "Displaced fracture of medial wall of right acetabulum, sequela", category_name: "Displaced fracture of medial wall of right acetabulum, sequela" } end def _S32472A do %ICDCode{full_code: "S32472A", category_code: "S32", short_code: "472A", full_name: "Displaced fracture of medial wall of left acetabulum, initial encounter for closed fracture", short_name: "Displaced fracture of medial wall of left acetabulum, initial encounter for closed fracture", category_name: "Displaced fracture of medial wall of left acetabulum, initial encounter for closed fracture" } end def _S32472B do %ICDCode{full_code: "S32472B", category_code: "S32", short_code: "472B", full_name: "Displaced fracture of medial wall of left acetabulum, initial encounter for open fracture", short_name: "Displaced fracture of medial wall of left acetabulum, initial encounter for open fracture", category_name: "Displaced fracture of medial wall of left acetabulum, initial encounter for open fracture" } end def _S32472D do %ICDCode{full_code: "S32472D", category_code: "S32", short_code: "472D", full_name: "Displaced fracture of medial wall of left acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced fracture of medial wall of left acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced fracture of medial wall of left acetabulum, subsequent encounter for fracture with routine healing" } end def _S32472G do %ICDCode{full_code: "S32472G", category_code: "S32", short_code: "472G", full_name: "Displaced fracture of medial wall of left acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced fracture of medial wall of left acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced fracture of medial wall of left acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32472K do %ICDCode{full_code: "S32472K", category_code: "S32", short_code: "472K", full_name: "Displaced fracture of medial wall of left acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced fracture of medial wall of left acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced fracture of medial wall of left acetabulum, subsequent encounter for fracture with nonunion" } end def _S32472S do %ICDCode{full_code: "S32472S", category_code: "S32", short_code: "472S", full_name: "Displaced fracture of medial wall of left acetabulum, sequela", short_name: "Displaced fracture of medial wall of left acetabulum, sequela", category_name: "Displaced fracture of medial wall of left acetabulum, sequela" } end def _S32473A do %ICDCode{full_code: "S32473A", category_code: "S32", short_code: "473A", full_name: "Displaced fracture of medial wall of unspecified acetabulum, initial encounter for closed fracture", short_name: "Displaced fracture of medial wall of unspecified acetabulum, initial encounter for closed fracture", category_name: "Displaced fracture of medial wall of unspecified acetabulum, initial encounter for closed fracture" } end def _S32473B do %ICDCode{full_code: "S32473B", category_code: "S32", short_code: "473B", full_name: "Displaced fracture of medial wall of unspecified acetabulum, initial encounter for open fracture", short_name: "Displaced fracture of medial wall of unspecified acetabulum, initial encounter for open fracture", category_name: "Displaced fracture of medial wall of unspecified acetabulum, initial encounter for open fracture" } end def _S32473D do %ICDCode{full_code: "S32473D", category_code: "S32", short_code: "473D", full_name: "Displaced fracture of medial wall of unspecified acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced fracture of medial wall of unspecified acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced fracture of medial wall of unspecified acetabulum, subsequent encounter for fracture with routine healing" } end def _S32473G do %ICDCode{full_code: "S32473G", category_code: "S32", short_code: "473G", full_name: "Displaced fracture of medial wall of unspecified acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced fracture of medial wall of unspecified acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced fracture of medial wall of unspecified acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32473K do %ICDCode{full_code: "S32473K", category_code: "S32", short_code: "473K", full_name: "Displaced fracture of medial wall of unspecified acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced fracture of medial wall of unspecified acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced fracture of medial wall of unspecified acetabulum, subsequent encounter for fracture with nonunion" } end def _S32473S do %ICDCode{full_code: "S32473S", category_code: "S32", short_code: "473S", full_name: "Displaced fracture of medial wall of unspecified acetabulum, sequela", short_name: "Displaced fracture of medial wall of unspecified acetabulum, sequela", category_name: "Displaced fracture of medial wall of unspecified acetabulum, sequela" } end def _S32474A do %ICDCode{full_code: "S32474A", category_code: "S32", short_code: "474A", full_name: "Nondisplaced fracture of medial wall of right acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced fracture of medial wall of right acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced fracture of medial wall of right acetabulum, initial encounter for closed fracture" } end def _S32474B do %ICDCode{full_code: "S32474B", category_code: "S32", short_code: "474B", full_name: "Nondisplaced fracture of medial wall of right acetabulum, initial encounter for open fracture", short_name: "Nondisplaced fracture of medial wall of right acetabulum, initial encounter for open fracture", category_name: "Nondisplaced fracture of medial wall of right acetabulum, initial encounter for open fracture" } end def _S32474D do %ICDCode{full_code: "S32474D", category_code: "S32", short_code: "474D", full_name: "Nondisplaced fracture of medial wall of right acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced fracture of medial wall of right acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced fracture of medial wall of right acetabulum, subsequent encounter for fracture with routine healing" } end def _S32474G do %ICDCode{full_code: "S32474G", category_code: "S32", short_code: "474G", full_name: "Nondisplaced fracture of medial wall of right acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced fracture of medial wall of right acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced fracture of medial wall of right acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32474K do %ICDCode{full_code: "S32474K", category_code: "S32", short_code: "474K", full_name: "Nondisplaced fracture of medial wall of right acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced fracture of medial wall of right acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced fracture of medial wall of right acetabulum, subsequent encounter for fracture with nonunion" } end def _S32474S do %ICDCode{full_code: "S32474S", category_code: "S32", short_code: "474S", full_name: "Nondisplaced fracture of medial wall of right acetabulum, sequela", short_name: "Nondisplaced fracture of medial wall of right acetabulum, sequela", category_name: "Nondisplaced fracture of medial wall of right acetabulum, sequela" } end def _S32475A do %ICDCode{full_code: "S32475A", category_code: "S32", short_code: "475A", full_name: "Nondisplaced fracture of medial wall of left acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced fracture of medial wall of left acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced fracture of medial wall of left acetabulum, initial encounter for closed fracture" } end def _S32475B do %ICDCode{full_code: "S32475B", category_code: "S32", short_code: "475B", full_name: "Nondisplaced fracture of medial wall of left acetabulum, initial encounter for open fracture", short_name: "Nondisplaced fracture of medial wall of left acetabulum, initial encounter for open fracture", category_name: "Nondisplaced fracture of medial wall of left acetabulum, initial encounter for open fracture" } end def _S32475D do %ICDCode{full_code: "S32475D", category_code: "S32", short_code: "475D", full_name: "Nondisplaced fracture of medial wall of left acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced fracture of medial wall of left acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced fracture of medial wall of left acetabulum, subsequent encounter for fracture with routine healing" } end def _S32475G do %ICDCode{full_code: "S32475G", category_code: "S32", short_code: "475G", full_name: "Nondisplaced fracture of medial wall of left acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced fracture of medial wall of left acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced fracture of medial wall of left acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32475K do %ICDCode{full_code: "S32475K", category_code: "S32", short_code: "475K", full_name: "Nondisplaced fracture of medial wall of left acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced fracture of medial wall of left acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced fracture of medial wall of left acetabulum, subsequent encounter for fracture with nonunion" } end def _S32475S do %ICDCode{full_code: "S32475S", category_code: "S32", short_code: "475S", full_name: "Nondisplaced fracture of medial wall of left acetabulum, sequela", short_name: "Nondisplaced fracture of medial wall of left acetabulum, sequela", category_name: "Nondisplaced fracture of medial wall of left acetabulum, sequela" } end def _S32476A do %ICDCode{full_code: "S32476A", category_code: "S32", short_code: "476A", full_name: "Nondisplaced fracture of medial wall of unspecified acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced fracture of medial wall of unspecified acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced fracture of medial wall of unspecified acetabulum, initial encounter for closed fracture" } end def _S32476B do %ICDCode{full_code: "S32476B", category_code: "S32", short_code: "476B", full_name: "Nondisplaced fracture of medial wall of unspecified acetabulum, initial encounter for open fracture", short_name: "Nondisplaced fracture of medial wall of unspecified acetabulum, initial encounter for open fracture", category_name: "Nondisplaced fracture of medial wall of unspecified acetabulum, initial encounter for open fracture" } end def _S32476D do %ICDCode{full_code: "S32476D", category_code: "S32", short_code: "476D", full_name: "Nondisplaced fracture of medial wall of unspecified acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced fracture of medial wall of unspecified acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced fracture of medial wall of unspecified acetabulum, subsequent encounter for fracture with routine healing" } end def _S32476G do %ICDCode{full_code: "S32476G", category_code: "S32", short_code: "476G", full_name: "Nondisplaced fracture of medial wall of unspecified acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced fracture of medial wall of unspecified acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced fracture of medial wall of unspecified acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32476K do %ICDCode{full_code: "S32476K", category_code: "S32", short_code: "476K", full_name: "Nondisplaced fracture of medial wall of unspecified acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced fracture of medial wall of unspecified acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced fracture of medial wall of unspecified acetabulum, subsequent encounter for fracture with nonunion" } end def _S32476S do %ICDCode{full_code: "S32476S", category_code: "S32", short_code: "476S", full_name: "Nondisplaced fracture of medial wall of unspecified acetabulum, sequela", short_name: "Nondisplaced fracture of medial wall of unspecified acetabulum, sequela", category_name: "Nondisplaced fracture of medial wall of unspecified acetabulum, sequela" } end def _S32481A do %ICDCode{full_code: "S32481A", category_code: "S32", short_code: "481A", full_name: "Displaced dome fracture of right acetabulum, initial encounter for closed fracture", short_name: "Displaced dome fracture of right acetabulum, initial encounter for closed fracture", category_name: "Displaced dome fracture of right acetabulum, initial encounter for closed fracture" } end def _S32481B do %ICDCode{full_code: "S32481B", category_code: "S32", short_code: "481B", full_name: "Displaced dome fracture of right acetabulum, initial encounter for open fracture", short_name: "Displaced dome fracture of right acetabulum, initial encounter for open fracture", category_name: "Displaced dome fracture of right acetabulum, initial encounter for open fracture" } end def _S32481D do %ICDCode{full_code: "S32481D", category_code: "S32", short_code: "481D", full_name: "Displaced dome fracture of right acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced dome fracture of right acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced dome fracture of right acetabulum, subsequent encounter for fracture with routine healing" } end def _S32481G do %ICDCode{full_code: "S32481G", category_code: "S32", short_code: "481G", full_name: "Displaced dome fracture of right acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced dome fracture of right acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced dome fracture of right acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32481K do %ICDCode{full_code: "S32481K", category_code: "S32", short_code: "481K", full_name: "Displaced dome fracture of right acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced dome fracture of right acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced dome fracture of right acetabulum, subsequent encounter for fracture with nonunion" } end def _S32481S do %ICDCode{full_code: "S32481S", category_code: "S32", short_code: "481S", full_name: "Displaced dome fracture of right acetabulum, sequela", short_name: "Displaced dome fracture of right acetabulum, sequela", category_name: "Displaced dome fracture of right acetabulum, sequela" } end def _S32482A do %ICDCode{full_code: "S32482A", category_code: "S32", short_code: "482A", full_name: "Displaced dome fracture of left acetabulum, initial encounter for closed fracture", short_name: "Displaced dome fracture of left acetabulum, initial encounter for closed fracture", category_name: "Displaced dome fracture of left acetabulum, initial encounter for closed fracture" } end def _S32482B do %ICDCode{full_code: "S32482B", category_code: "S32", short_code: "482B", full_name: "Displaced dome fracture of left acetabulum, initial encounter for open fracture", short_name: "Displaced dome fracture of left acetabulum, initial encounter for open fracture", category_name: "Displaced dome fracture of left acetabulum, initial encounter for open fracture" } end def _S32482D do %ICDCode{full_code: "S32482D", category_code: "S32", short_code: "482D", full_name: "Displaced dome fracture of left acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced dome fracture of left acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced dome fracture of left acetabulum, subsequent encounter for fracture with routine healing" } end def _S32482G do %ICDCode{full_code: "S32482G", category_code: "S32", short_code: "482G", full_name: "Displaced dome fracture of left acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced dome fracture of left acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced dome fracture of left acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32482K do %ICDCode{full_code: "S32482K", category_code: "S32", short_code: "482K", full_name: "Displaced dome fracture of left acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced dome fracture of left acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced dome fracture of left acetabulum, subsequent encounter for fracture with nonunion" } end def _S32482S do %ICDCode{full_code: "S32482S", category_code: "S32", short_code: "482S", full_name: "Displaced dome fracture of left acetabulum, sequela", short_name: "Displaced dome fracture of left acetabulum, sequela", category_name: "Displaced dome fracture of left acetabulum, sequela" } end def _S32483A do %ICDCode{full_code: "S32483A", category_code: "S32", short_code: "483A", full_name: "Displaced dome fracture of unspecified acetabulum, initial encounter for closed fracture", short_name: "Displaced dome fracture of unspecified acetabulum, initial encounter for closed fracture", category_name: "Displaced dome fracture of unspecified acetabulum, initial encounter for closed fracture" } end def _S32483B do %ICDCode{full_code: "S32483B", category_code: "S32", short_code: "483B", full_name: "Displaced dome fracture of unspecified acetabulum, initial encounter for open fracture", short_name: "Displaced dome fracture of unspecified acetabulum, initial encounter for open fracture", category_name: "Displaced dome fracture of unspecified acetabulum, initial encounter for open fracture" } end def _S32483D do %ICDCode{full_code: "S32483D", category_code: "S32", short_code: "483D", full_name: "Displaced dome fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing", short_name: "Displaced dome fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing", category_name: "Displaced dome fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing" } end def _S32483G do %ICDCode{full_code: "S32483G", category_code: "S32", short_code: "483G", full_name: "Displaced dome fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Displaced dome fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Displaced dome fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32483K do %ICDCode{full_code: "S32483K", category_code: "S32", short_code: "483K", full_name: "Displaced dome fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion", short_name: "Displaced dome fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion", category_name: "Displaced dome fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion" } end def _S32483S do %ICDCode{full_code: "S32483S", category_code: "S32", short_code: "483S", full_name: "Displaced dome fracture of unspecified acetabulum, sequela", short_name: "Displaced dome fracture of unspecified acetabulum, sequela", category_name: "Displaced dome fracture of unspecified acetabulum, sequela" } end def _S32484A do %ICDCode{full_code: "S32484A", category_code: "S32", short_code: "484A", full_name: "Nondisplaced dome fracture of right acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced dome fracture of right acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced dome fracture of right acetabulum, initial encounter for closed fracture" } end def _S32484B do %ICDCode{full_code: "S32484B", category_code: "S32", short_code: "484B", full_name: "Nondisplaced dome fracture of right acetabulum, initial encounter for open fracture", short_name: "Nondisplaced dome fracture of right acetabulum, initial encounter for open fracture", category_name: "Nondisplaced dome fracture of right acetabulum, initial encounter for open fracture" } end def _S32484D do %ICDCode{full_code: "S32484D", category_code: "S32", short_code: "484D", full_name: "Nondisplaced dome fracture of right acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced dome fracture of right acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced dome fracture of right acetabulum, subsequent encounter for fracture with routine healing" } end def _S32484G do %ICDCode{full_code: "S32484G", category_code: "S32", short_code: "484G", full_name: "Nondisplaced dome fracture of right acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced dome fracture of right acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced dome fracture of right acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32484K do %ICDCode{full_code: "S32484K", category_code: "S32", short_code: "484K", full_name: "Nondisplaced dome fracture of right acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced dome fracture of right acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced dome fracture of right acetabulum, subsequent encounter for fracture with nonunion" } end def _S32484S do %ICDCode{full_code: "S32484S", category_code: "S32", short_code: "484S", full_name: "Nondisplaced dome fracture of right acetabulum, sequela", short_name: "Nondisplaced dome fracture of right acetabulum, sequela", category_name: "Nondisplaced dome fracture of right acetabulum, sequela" } end def _S32485A do %ICDCode{full_code: "S32485A", category_code: "S32", short_code: "485A", full_name: "Nondisplaced dome fracture of left acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced dome fracture of left acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced dome fracture of left acetabulum, initial encounter for closed fracture" } end def _S32485B do %ICDCode{full_code: "S32485B", category_code: "S32", short_code: "485B", full_name: "Nondisplaced dome fracture of left acetabulum, initial encounter for open fracture", short_name: "Nondisplaced dome fracture of left acetabulum, initial encounter for open fracture", category_name: "Nondisplaced dome fracture of left acetabulum, initial encounter for open fracture" } end def _S32485D do %ICDCode{full_code: "S32485D", category_code: "S32", short_code: "485D", full_name: "Nondisplaced dome fracture of left acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced dome fracture of left acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced dome fracture of left acetabulum, subsequent encounter for fracture with routine healing" } end def _S32485G do %ICDCode{full_code: "S32485G", category_code: "S32", short_code: "485G", full_name: "Nondisplaced dome fracture of left acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced dome fracture of left acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced dome fracture of left acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32485K do %ICDCode{full_code: "S32485K", category_code: "S32", short_code: "485K", full_name: "Nondisplaced dome fracture of left acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced dome fracture of left acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced dome fracture of left acetabulum, subsequent encounter for fracture with nonunion" } end def _S32485S do %ICDCode{full_code: "S32485S", category_code: "S32", short_code: "485S", full_name: "Nondisplaced dome fracture of left acetabulum, sequela", short_name: "Nondisplaced dome fracture of left acetabulum, sequela", category_name: "Nondisplaced dome fracture of left acetabulum, sequela" } end def _S32486A do %ICDCode{full_code: "S32486A", category_code: "S32", short_code: "486A", full_name: "Nondisplaced dome fracture of unspecified acetabulum, initial encounter for closed fracture", short_name: "Nondisplaced dome fracture of unspecified acetabulum, initial encounter for closed fracture", category_name: "Nondisplaced dome fracture of unspecified acetabulum, initial encounter for closed fracture" } end def _S32486B do %ICDCode{full_code: "S32486B", category_code: "S32", short_code: "486B", full_name: "Nondisplaced dome fracture of unspecified acetabulum, initial encounter for open fracture", short_name: "Nondisplaced dome fracture of unspecified acetabulum, initial encounter for open fracture", category_name: "Nondisplaced dome fracture of unspecified acetabulum, initial encounter for open fracture" } end def _S32486D do %ICDCode{full_code: "S32486D", category_code: "S32", short_code: "486D", full_name: "Nondisplaced dome fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced dome fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced dome fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing" } end def _S32486G do %ICDCode{full_code: "S32486G", category_code: "S32", short_code: "486G", full_name: "Nondisplaced dome fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced dome fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced dome fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32486K do %ICDCode{full_code: "S32486K", category_code: "S32", short_code: "486K", full_name: "Nondisplaced dome fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced dome fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced dome fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion" } end def _S32486S do %ICDCode{full_code: "S32486S", category_code: "S32", short_code: "486S", full_name: "Nondisplaced dome fracture of unspecified acetabulum, sequela", short_name: "Nondisplaced dome fracture of unspecified acetabulum, sequela", category_name: "Nondisplaced dome fracture of unspecified acetabulum, sequela" } end def _S32491A do %ICDCode{full_code: "S32491A", category_code: "S32", short_code: "491A", full_name: "Other specified fracture of right acetabulum, initial encounter for closed fracture", short_name: "Other specified fracture of right acetabulum, initial encounter for closed fracture", category_name: "Other specified fracture of right acetabulum, initial encounter for closed fracture" } end def _S32491B do %ICDCode{full_code: "S32491B", category_code: "S32", short_code: "491B", full_name: "Other specified fracture of right acetabulum, initial encounter for open fracture", short_name: "Other specified fracture of right acetabulum, initial encounter for open fracture", category_name: "Other specified fracture of right acetabulum, initial encounter for open fracture" } end def _S32491D do %ICDCode{full_code: "S32491D", category_code: "S32", short_code: "491D", full_name: "Other specified fracture of right acetabulum, subsequent encounter for fracture with routine healing", short_name: "Other specified fracture of right acetabulum, subsequent encounter for fracture with routine healing", category_name: "Other specified fracture of right acetabulum, subsequent encounter for fracture with routine healing" } end def _S32491G do %ICDCode{full_code: "S32491G", category_code: "S32", short_code: "491G", full_name: "Other specified fracture of right acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Other specified fracture of right acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Other specified fracture of right acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32491K do %ICDCode{full_code: "S32491K", category_code: "S32", short_code: "491K", full_name: "Other specified fracture of right acetabulum, subsequent encounter for fracture with nonunion", short_name: "Other specified fracture of right acetabulum, subsequent encounter for fracture with nonunion", category_name: "Other specified fracture of right acetabulum, subsequent encounter for fracture with nonunion" } end def _S32491S do %ICDCode{full_code: "S32491S", category_code: "S32", short_code: "491S", full_name: "Other specified fracture of right acetabulum, sequela", short_name: "Other specified fracture of right acetabulum, sequela", category_name: "Other specified fracture of right acetabulum, sequela" } end def _S32492A do %ICDCode{full_code: "S32492A", category_code: "S32", short_code: "492A", full_name: "Other specified fracture of left acetabulum, initial encounter for closed fracture", short_name: "Other specified fracture of left acetabulum, initial encounter for closed fracture", category_name: "Other specified fracture of left acetabulum, initial encounter for closed fracture" } end def _S32492B do %ICDCode{full_code: "S32492B", category_code: "S32", short_code: "492B", full_name: "Other specified fracture of left acetabulum, initial encounter for open fracture", short_name: "Other specified fracture of left acetabulum, initial encounter for open fracture", category_name: "Other specified fracture of left acetabulum, initial encounter for open fracture" } end def _S32492D do %ICDCode{full_code: "S32492D", category_code: "S32", short_code: "492D", full_name: "Other specified fracture of left acetabulum, subsequent encounter for fracture with routine healing", short_name: "Other specified fracture of left acetabulum, subsequent encounter for fracture with routine healing", category_name: "Other specified fracture of left acetabulum, subsequent encounter for fracture with routine healing" } end def _S32492G do %ICDCode{full_code: "S32492G", category_code: "S32", short_code: "492G", full_name: "Other specified fracture of left acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Other specified fracture of left acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Other specified fracture of left acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32492K do %ICDCode{full_code: "S32492K", category_code: "S32", short_code: "492K", full_name: "Other specified fracture of left acetabulum, subsequent encounter for fracture with nonunion", short_name: "Other specified fracture of left acetabulum, subsequent encounter for fracture with nonunion", category_name: "Other specified fracture of left acetabulum, subsequent encounter for fracture with nonunion" } end def _S32492S do %ICDCode{full_code: "S32492S", category_code: "S32", short_code: "492S", full_name: "Other specified fracture of left acetabulum, sequela", short_name: "Other specified fracture of left acetabulum, sequela", category_name: "Other specified fracture of left acetabulum, sequela" } end def _S32499A do %ICDCode{full_code: "S32499A", category_code: "S32", short_code: "499A", full_name: "Other specified fracture of unspecified acetabulum, initial encounter for closed fracture", short_name: "Other specified fracture of unspecified acetabulum, initial encounter for closed fracture", category_name: "Other specified fracture of unspecified acetabulum, initial encounter for closed fracture" } end def _S32499B do %ICDCode{full_code: "S32499B", category_code: "S32", short_code: "499B", full_name: "Other specified fracture of unspecified acetabulum, initial encounter for open fracture", short_name: "Other specified fracture of unspecified acetabulum, initial encounter for open fracture", category_name: "Other specified fracture of unspecified acetabulum, initial encounter for open fracture" } end def _S32499D do %ICDCode{full_code: "S32499D", category_code: "S32", short_code: "499D", full_name: "Other specified fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing", short_name: "Other specified fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing", category_name: "Other specified fracture of unspecified acetabulum, subsequent encounter for fracture with routine healing" } end def _S32499G do %ICDCode{full_code: "S32499G", category_code: "S32", short_code: "499G", full_name: "Other specified fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing", short_name: "Other specified fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing", category_name: "Other specified fracture of unspecified acetabulum, subsequent encounter for fracture with delayed healing" } end def _S32499K do %ICDCode{full_code: "S32499K", category_code: "S32", short_code: "499K", full_name: "Other specified fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion", short_name: "Other specified fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion", category_name: "Other specified fracture of unspecified acetabulum, subsequent encounter for fracture with nonunion" } end def _S32499S do %ICDCode{full_code: "S32499S", category_code: "S32", short_code: "499S", full_name: "Other specified fracture of unspecified acetabulum, sequela", short_name: "Other specified fracture of unspecified acetabulum, sequela", category_name: "Other specified fracture of unspecified acetabulum, sequela" } end def _S32501A do %ICDCode{full_code: "S32501A", category_code: "S32", short_code: "501A", full_name: "Unspecified fracture of right pubis, initial encounter for closed fracture", short_name: "Unspecified fracture of right pubis, initial encounter for closed fracture", category_name: "Unspecified fracture of right pubis, initial encounter for closed fracture" } end def _S32501B do %ICDCode{full_code: "S32501B", category_code: "S32", short_code: "501B", full_name: "Unspecified fracture of right pubis, initial encounter for open fracture", short_name: "Unspecified fracture of right pubis, initial encounter for open fracture", category_name: "Unspecified fracture of right pubis, initial encounter for open fracture" } end def _S32501D do %ICDCode{full_code: "S32501D", category_code: "S32", short_code: "501D", full_name: "Unspecified fracture of right pubis, subsequent encounter for fracture with routine healing", short_name: "Unspecified fracture of right pubis, subsequent encounter for fracture with routine healing", category_name: "Unspecified fracture of right pubis, subsequent encounter for fracture with routine healing" } end def _S32501G do %ICDCode{full_code: "S32501G", category_code: "S32", short_code: "501G", full_name: "Unspecified fracture of right pubis, subsequent encounter for fracture with delayed healing", short_name: "Unspecified fracture of right pubis, subsequent encounter for fracture with delayed healing", category_name: "Unspecified fracture of right pubis, subsequent encounter for fracture with delayed healing" } end def _S32501K do %ICDCode{full_code: "S32501K", category_code: "S32", short_code: "501K", full_name: "Unspecified fracture of right pubis, subsequent encounter for fracture with nonunion", short_name: "Unspecified fracture of right pubis, subsequent encounter for fracture with nonunion", category_name: "Unspecified fracture of right pubis, subsequent encounter for fracture with nonunion" } end def _S32501S do %ICDCode{full_code: "S32501S", category_code: "S32", short_code: "501S", full_name: "Unspecified fracture of right pubis, sequela", short_name: "Unspecified fracture of right pubis, sequela", category_name: "Unspecified fracture of right pubis, sequela" } end def _S32502A do %ICDCode{full_code: "S32502A", category_code: "S32", short_code: "502A", full_name: "Unspecified fracture of left pubis, initial encounter for closed fracture", short_name: "Unspecified fracture of left pubis, initial encounter for closed fracture", category_name: "Unspecified fracture of left pubis, initial encounter for closed fracture" } end def _S32502B do %ICDCode{full_code: "S32502B", category_code: "S32", short_code: "502B", full_name: "Unspecified fracture of left pubis, initial encounter for open fracture", short_name: "Unspecified fracture of left pubis, initial encounter for open fracture", category_name: "Unspecified fracture of left pubis, initial encounter for open fracture" } end def _S32502D do %ICDCode{full_code: "S32502D", category_code: "S32", short_code: "502D", full_name: "Unspecified fracture of left pubis, subsequent encounter for fracture with routine healing", short_name: "Unspecified fracture of left pubis, subsequent encounter for fracture with routine healing", category_name: "Unspecified fracture of left pubis, subsequent encounter for fracture with routine healing" } end def _S32502G do %ICDCode{full_code: "S32502G", category_code: "S32", short_code: "502G", full_name: "Unspecified fracture of left pubis, subsequent encounter for fracture with delayed healing", short_name: "Unspecified fracture of left pubis, subsequent encounter for fracture with delayed healing", category_name: "Unspecified fracture of left pubis, subsequent encounter for fracture with delayed healing" } end def _S32502K do %ICDCode{full_code: "S32502K", category_code: "S32", short_code: "502K", full_name: "Unspecified fracture of left pubis, subsequent encounter for fracture with nonunion", short_name: "Unspecified fracture of left pubis, subsequent encounter for fracture with nonunion", category_name: "Unspecified fracture of left pubis, subsequent encounter for fracture with nonunion" } end def _S32502S do %ICDCode{full_code: "S32502S", category_code: "S32", short_code: "502S", full_name: "Unspecified fracture of left pubis, sequela", short_name: "Unspecified fracture of left pubis, sequela", category_name: "Unspecified fracture of left pubis, sequela" } end def _S32509A do %ICDCode{full_code: "S32509A", category_code: "S32", short_code: "509A", full_name: "Unspecified fracture of unspecified pubis, initial encounter for closed fracture", short_name: "Unspecified fracture of unspecified pubis, initial encounter for closed fracture", category_name: "Unspecified fracture of unspecified pubis, initial encounter for closed fracture" } end def _S32509B do %ICDCode{full_code: "S32509B", category_code: "S32", short_code: "509B", full_name: "Unspecified fracture of unspecified pubis, initial encounter for open fracture", short_name: "Unspecified fracture of unspecified pubis, initial encounter for open fracture", category_name: "Unspecified fracture of unspecified pubis, initial encounter for open fracture" } end def _S32509D do %ICDCode{full_code: "S32509D", category_code: "S32", short_code: "509D", full_name: "Unspecified fracture of unspecified pubis, subsequent encounter for fracture with routine healing", short_name: "Unspecified fracture of unspecified pubis, subsequent encounter for fracture with routine healing", category_name: "Unspecified fracture of unspecified pubis, subsequent encounter for fracture with routine healing" } end def _S32509G do %ICDCode{full_code: "S32509G", category_code: "S32", short_code: "509G", full_name: "Unspecified fracture of unspecified pubis, subsequent encounter for fracture with delayed healing", short_name: "Unspecified fracture of unspecified pubis, subsequent encounter for fracture with delayed healing", category_name: "Unspecified fracture of unspecified pubis, subsequent encounter for fracture with delayed healing" } end def _S32509K do %ICDCode{full_code: "S32509K", category_code: "S32", short_code: "509K", full_name: "Unspecified fracture of unspecified pubis, subsequent encounter for fracture with nonunion", short_name: "Unspecified fracture of unspecified pubis, subsequent encounter for fracture with nonunion", category_name: "Unspecified fracture of unspecified pubis, subsequent encounter for fracture with nonunion" } end def _S32509S do %ICDCode{full_code: "S32509S", category_code: "S32", short_code: "509S", full_name: "Unspecified fracture of unspecified pubis, sequela", short_name: "Unspecified fracture of unspecified pubis, sequela", category_name: "Unspecified fracture of unspecified pubis, sequela" } end def _S32511A do %ICDCode{full_code: "S32511A", category_code: "S32", short_code: "511A", full_name: "Fracture of superior rim of right pubis, initial encounter for closed fracture", short_name: "Fracture of superior rim of right pubis, initial encounter for closed fracture", category_name: "Fracture of superior rim of right pubis, initial encounter for closed fracture" } end def _S32511B do %ICDCode{full_code: "S32511B", category_code: "S32", short_code: "511B", full_name: "Fracture of superior rim of right pubis, initial encounter for open fracture", short_name: "Fracture of superior rim of right pubis, initial encounter for open fracture", category_name: "Fracture of superior rim of right pubis, initial encounter for open fracture" } end def _S32511D do %ICDCode{full_code: "S32511D", category_code: "S32", short_code: "511D", full_name: "Fracture of superior rim of right pubis, subsequent encounter for fracture with routine healing", short_name: "Fracture of superior rim of right pubis, subsequent encounter for fracture with routine healing", category_name: "Fracture of superior rim of right pubis, subsequent encounter for fracture with routine healing" } end def _S32511G do %ICDCode{full_code: "S32511G", category_code: "S32", short_code: "511G", full_name: "Fracture of superior rim of right pubis, subsequent encounter for fracture with delayed healing", short_name: "Fracture of superior rim of right pubis, subsequent encounter for fracture with delayed healing", category_name: "Fracture of superior rim of right pubis, subsequent encounter for fracture with delayed healing" } end def _S32511K do %ICDCode{full_code: "S32511K", category_code: "S32", short_code: "511K", full_name: "Fracture of superior rim of right pubis, subsequent encounter for fracture with nonunion", short_name: "Fracture of superior rim of right pubis, subsequent encounter for fracture with nonunion", category_name: "Fracture of superior rim of right pubis, subsequent encounter for fracture with nonunion" } end def _S32511S do %ICDCode{full_code: "S32511S", category_code: "S32", short_code: "511S", full_name: "Fracture of superior rim of right pubis, sequela", short_name: "Fracture of superior rim of right pubis, sequela", category_name: "Fracture of superior rim of right pubis, sequela" } end def _S32512A do %ICDCode{full_code: "S32512A", category_code: "S32", short_code: "512A", full_name: "Fracture of superior rim of left pubis, initial encounter for closed fracture", short_name: "Fracture of superior rim of left pubis, initial encounter for closed fracture", category_name: "Fracture of superior rim of left pubis, initial encounter for closed fracture" } end def _S32512B do %ICDCode{full_code: "S32512B", category_code: "S32", short_code: "512B", full_name: "Fracture of superior rim of left pubis, initial encounter for open fracture", short_name: "Fracture of superior rim of left pubis, initial encounter for open fracture", category_name: "Fracture of superior rim of left pubis, initial encounter for open fracture" } end def _S32512D do %ICDCode{full_code: "S32512D", category_code: "S32", short_code: "512D", full_name: "Fracture of superior rim of left pubis, subsequent encounter for fracture with routine healing", short_name: "Fracture of superior rim of left pubis, subsequent encounter for fracture with routine healing", category_name: "Fracture of superior rim of left pubis, subsequent encounter for fracture with routine healing" } end def _S32512G do %ICDCode{full_code: "S32512G", category_code: "S32", short_code: "512G", full_name: "Fracture of superior rim of left pubis, subsequent encounter for fracture with delayed healing", short_name: "Fracture of superior rim of left pubis, subsequent encounter for fracture with delayed healing", category_name: "Fracture of superior rim of left pubis, subsequent encounter for fracture with delayed healing" } end def _S32512K do %ICDCode{full_code: "S32512K", category_code: "S32", short_code: "512K", full_name: "Fracture of superior rim of left pubis, subsequent encounter for fracture with nonunion", short_name: "Fracture of superior rim of left pubis, subsequent encounter for fracture with nonunion", category_name: "Fracture of superior rim of left pubis, subsequent encounter for fracture with nonunion" } end def _S32512S do %ICDCode{full_code: "S32512S", category_code: "S32", short_code: "512S", full_name: "Fracture of superior rim of left pubis, sequela", short_name: "Fracture of superior rim of left pubis, sequela", category_name: "Fracture of superior rim of left pubis, sequela" } end def _S32519A do %ICDCode{full_code: "S32519A", category_code: "S32", short_code: "519A", full_name: "Fracture of superior rim of unspecified pubis, initial encounter for closed fracture", short_name: "Fracture of superior rim of unspecified pubis, initial encounter for closed fracture", category_name: "Fracture of superior rim of unspecified pubis, initial encounter for closed fracture" } end def _S32519B do %ICDCode{full_code: "S32519B", category_code: "S32", short_code: "519B", full_name: "Fracture of superior rim of unspecified pubis, initial encounter for open fracture", short_name: "Fracture of superior rim of unspecified pubis, initial encounter for open fracture", category_name: "Fracture of superior rim of unspecified pubis, initial encounter for open fracture" } end def _S32519D do %ICDCode{full_code: "S32519D", category_code: "S32", short_code: "519D", full_name: "Fracture of superior rim of unspecified pubis, subsequent encounter for fracture with routine healing", short_name: "Fracture of superior rim of unspecified pubis, subsequent encounter for fracture with routine healing", category_name: "Fracture of superior rim of unspecified pubis, subsequent encounter for fracture with routine healing" } end def _S32519G do %ICDCode{full_code: "S32519G", category_code: "S32", short_code: "519G", full_name: "Fracture of superior rim of unspecified pubis, subsequent encounter for fracture with delayed healing", short_name: "Fracture of superior rim of unspecified pubis, subsequent encounter for fracture with delayed healing", category_name: "Fracture of superior rim of unspecified pubis, subsequent encounter for fracture with delayed healing" } end def _S32519K do %ICDCode{full_code: "S32519K", category_code: "S32", short_code: "519K", full_name: "Fracture of superior rim of unspecified pubis, subsequent encounter for fracture with nonunion", short_name: "Fracture of superior rim of unspecified pubis, subsequent encounter for fracture with nonunion", category_name: "Fracture of superior rim of unspecified pubis, subsequent encounter for fracture with nonunion" } end def _S32519S do %ICDCode{full_code: "S32519S", category_code: "S32", short_code: "519S", full_name: "Fracture of superior rim of unspecified pubis, sequela", short_name: "Fracture of superior rim of unspecified pubis, sequela", category_name: "Fracture of superior rim of unspecified pubis, sequela" } end def _S32591A do %ICDCode{full_code: "S32591A", category_code: "S32", short_code: "591A", full_name: "Other specified fracture of right pubis, initial encounter for closed fracture", short_name: "Other specified fracture of right pubis, initial encounter for closed fracture", category_name: "Other specified fracture of right pubis, initial encounter for closed fracture" } end def _S32591B do %ICDCode{full_code: "S32591B", category_code: "S32", short_code: "591B", full_name: "Other specified fracture of right pubis, initial encounter for open fracture", short_name: "Other specified fracture of right pubis, initial encounter for open fracture", category_name: "Other specified fracture of right pubis, initial encounter for open fracture" } end def _S32591D do %ICDCode{full_code: "S32591D", category_code: "S32", short_code: "591D", full_name: "Other specified fracture of right pubis, subsequent encounter for fracture with routine healing", short_name: "Other specified fracture of right pubis, subsequent encounter for fracture with routine healing", category_name: "Other specified fracture of right pubis, subsequent encounter for fracture with routine healing" } end def _S32591G do %ICDCode{full_code: "S32591G", category_code: "S32", short_code: "591G", full_name: "Other specified fracture of right pubis, subsequent encounter for fracture with delayed healing", short_name: "Other specified fracture of right pubis, subsequent encounter for fracture with delayed healing", category_name: "Other specified fracture of right pubis, subsequent encounter for fracture with delayed healing" } end def _S32591K do %ICDCode{full_code: "S32591K", category_code: "S32", short_code: "591K", full_name: "Other specified fracture of right pubis, subsequent encounter for fracture with nonunion", short_name: "Other specified fracture of right pubis, subsequent encounter for fracture with nonunion", category_name: "Other specified fracture of right pubis, subsequent encounter for fracture with nonunion" } end def _S32591S do %ICDCode{full_code: "S32591S", category_code: "S32", short_code: "591S", full_name: "Other specified fracture of right pubis, sequela", short_name: "Other specified fracture of right pubis, sequela", category_name: "Other specified fracture of right pubis, sequela" } end def _S32592A do %ICDCode{full_code: "S32592A", category_code: "S32", short_code: "592A", full_name: "Other specified fracture of left pubis, initial encounter for closed fracture", short_name: "Other specified fracture of left pubis, initial encounter for closed fracture", category_name: "Other specified fracture of left pubis, initial encounter for closed fracture" } end def _S32592B do %ICDCode{full_code: "S32592B", category_code: "S32", short_code: "592B", full_name: "Other specified fracture of left pubis, initial encounter for open fracture", short_name: "Other specified fracture of left pubis, initial encounter for open fracture", category_name: "Other specified fracture of left pubis, initial encounter for open fracture" } end def _S32592D do %ICDCode{full_code: "S32592D", category_code: "S32", short_code: "592D", full_name: "Other specified fracture of left pubis, subsequent encounter for fracture with routine healing", short_name: "Other specified fracture of left pubis, subsequent encounter for fracture with routine healing", category_name: "Other specified fracture of left pubis, subsequent encounter for fracture with routine healing" } end def _S32592G do %ICDCode{full_code: "S32592G", category_code: "S32", short_code: "592G", full_name: "Other specified fracture of left pubis, subsequent encounter for fracture with delayed healing", short_name: "Other specified fracture of left pubis, subsequent encounter for fracture with delayed healing", category_name: "Other specified fracture of left pubis, subsequent encounter for fracture with delayed healing" } end def _S32592K do %ICDCode{full_code: "S32592K", category_code: "S32", short_code: "592K", full_name: "Other specified fracture of left pubis, subsequent encounter for fracture with nonunion", short_name: "Other specified fracture of left pubis, subsequent encounter for fracture with nonunion", category_name: "Other specified fracture of left pubis, subsequent encounter for fracture with nonunion" } end def _S32592S do %ICDCode{full_code: "S32592S", category_code: "S32", short_code: "592S", full_name: "Other specified fracture of left pubis, sequela", short_name: "Other specified fracture of left pubis, sequela", category_name: "Other specified fracture of left pubis, sequela" } end def _S32599A do %ICDCode{full_code: "S32599A", category_code: "S32", short_code: "599A", full_name: "Other specified fracture of unspecified pubis, initial encounter for closed fracture", short_name: "Other specified fracture of unspecified pubis, initial encounter for closed fracture", category_name: "Other specified fracture of unspecified pubis, initial encounter for closed fracture" } end def _S32599B do %ICDCode{full_code: "S32599B", category_code: "S32", short_code: "599B", full_name: "Other specified fracture of unspecified pubis, initial encounter for open fracture", short_name: "Other specified fracture of unspecified pubis, initial encounter for open fracture", category_name: "Other specified fracture of unspecified pubis, initial encounter for open fracture" } end def _S32599D do %ICDCode{full_code: "S32599D", category_code: "S32", short_code: "599D", full_name: "Other specified fracture of unspecified pubis, subsequent encounter for fracture with routine healing", short_name: "Other specified fracture of unspecified pubis, subsequent encounter for fracture with routine healing", category_name: "Other specified fracture of unspecified pubis, subsequent encounter for fracture with routine healing" } end def _S32599G do %ICDCode{full_code: "S32599G", category_code: "S32", short_code: "599G", full_name: "Other specified fracture of unspecified pubis, subsequent encounter for fracture with delayed healing", short_name: "Other specified fracture of unspecified pubis, subsequent encounter for fracture with delayed healing", category_name: "Other specified fracture of unspecified pubis, subsequent encounter for fracture with delayed healing" } end def _S32599K do %ICDCode{full_code: "S32599K", category_code: "S32", short_code: "599K", full_name: "Other specified fracture of unspecified pubis, subsequent encounter for fracture with nonunion", short_name: "Other specified fracture of unspecified pubis, subsequent encounter for fracture with nonunion", category_name: "Other specified fracture of unspecified pubis, subsequent encounter for fracture with nonunion" } end def _S32599S do %ICDCode{full_code: "S32599S", category_code: "S32", short_code: "599S", full_name: "Other specified fracture of unspecified pubis, sequela", short_name: "Other specified fracture of unspecified pubis, sequela", category_name: "Other specified fracture of unspecified pubis, sequela" } end def _S32601A do %ICDCode{full_code: "S32601A", category_code: "S32", short_code: "601A", full_name: "Unspecified fracture of right ischium, initial encounter for closed fracture", short_name: "Unspecified fracture of right ischium, initial encounter for closed fracture", category_name: "Unspecified fracture of right ischium, initial encounter for closed fracture" } end def _S32601B do %ICDCode{full_code: "S32601B", category_code: "S32", short_code: "601B", full_name: "Unspecified fracture of right ischium, initial encounter for open fracture", short_name: "Unspecified fracture of right ischium, initial encounter for open fracture", category_name: "Unspecified fracture of right ischium, initial encounter for open fracture" } end def _S32601D do %ICDCode{full_code: "S32601D", category_code: "S32", short_code: "601D", full_name: "Unspecified fracture of right ischium, subsequent encounter for fracture with routine healing", short_name: "Unspecified fracture of right ischium, subsequent encounter for fracture with routine healing", category_name: "Unspecified fracture of right ischium, subsequent encounter for fracture with routine healing" } end def _S32601G do %ICDCode{full_code: "S32601G", category_code: "S32", short_code: "601G", full_name: "Unspecified fracture of right ischium, subsequent encounter for fracture with delayed healing", short_name: "Unspecified fracture of right ischium, subsequent encounter for fracture with delayed healing", category_name: "Unspecified fracture of right ischium, subsequent encounter for fracture with delayed healing" } end def _S32601K do %ICDCode{full_code: "S32601K", category_code: "S32", short_code: "601K", full_name: "Unspecified fracture of right ischium, subsequent encounter for fracture with nonunion", short_name: "Unspecified fracture of right ischium, subsequent encounter for fracture with nonunion", category_name: "Unspecified fracture of right ischium, subsequent encounter for fracture with nonunion" } end def _S32601S do %ICDCode{full_code: "S32601S", category_code: "S32", short_code: "601S", full_name: "Unspecified fracture of right ischium, sequela", short_name: "Unspecified fracture of right ischium, sequela", category_name: "Unspecified fracture of right ischium, sequela" } end def _S32602A do %ICDCode{full_code: "S32602A", category_code: "S32", short_code: "602A", full_name: "Unspecified fracture of left ischium, initial encounter for closed fracture", short_name: "Unspecified fracture of left ischium, initial encounter for closed fracture", category_name: "Unspecified fracture of left ischium, initial encounter for closed fracture" } end def _S32602B do %ICDCode{full_code: "S32602B", category_code: "S32", short_code: "602B", full_name: "Unspecified fracture of left ischium, initial encounter for open fracture", short_name: "Unspecified fracture of left ischium, initial encounter for open fracture", category_name: "Unspecified fracture of left ischium, initial encounter for open fracture" } end def _S32602D do %ICDCode{full_code: "S32602D", category_code: "S32", short_code: "602D", full_name: "Unspecified fracture of left ischium, subsequent encounter for fracture with routine healing", short_name: "Unspecified fracture of left ischium, subsequent encounter for fracture with routine healing", category_name: "Unspecified fracture of left ischium, subsequent encounter for fracture with routine healing" } end def _S32602G do %ICDCode{full_code: "S32602G", category_code: "S32", short_code: "602G", full_name: "Unspecified fracture of left ischium, subsequent encounter for fracture with delayed healing", short_name: "Unspecified fracture of left ischium, subsequent encounter for fracture with delayed healing", category_name: "Unspecified fracture of left ischium, subsequent encounter for fracture with delayed healing" } end def _S32602K do %ICDCode{full_code: "S32602K", category_code: "S32", short_code: "602K", full_name: "Unspecified fracture of left ischium, subsequent encounter for fracture with nonunion", short_name: "Unspecified fracture of left ischium, subsequent encounter for fracture with nonunion", category_name: "Unspecified fracture of left ischium, subsequent encounter for fracture with nonunion" } end def _S32602S do %ICDCode{full_code: "S32602S", category_code: "S32", short_code: "602S", full_name: "Unspecified fracture of left ischium, sequela", short_name: "Unspecified fracture of left ischium, sequela", category_name: "Unspecified fracture of left ischium, sequela" } end def _S32609A do %ICDCode{full_code: "S32609A", category_code: "S32", short_code: "609A", full_name: "Unspecified fracture of unspecified ischium, initial encounter for closed fracture", short_name: "Unspecified fracture of unspecified ischium, initial encounter for closed fracture", category_name: "Unspecified fracture of unspecified ischium, initial encounter for closed fracture" } end def _S32609B do %ICDCode{full_code: "S32609B", category_code: "S32", short_code: "609B", full_name: "Unspecified fracture of unspecified ischium, initial encounter for open fracture", short_name: "Unspecified fracture of unspecified ischium, initial encounter for open fracture", category_name: "Unspecified fracture of unspecified ischium, initial encounter for open fracture" } end def _S32609D do %ICDCode{full_code: "S32609D", category_code: "S32", short_code: "609D", full_name: "Unspecified fracture of unspecified ischium, subsequent encounter for fracture with routine healing", short_name: "Unspecified fracture of unspecified ischium, subsequent encounter for fracture with routine healing", category_name: "Unspecified fracture of unspecified ischium, subsequent encounter for fracture with routine healing" } end def _S32609G do %ICDCode{full_code: "S32609G", category_code: "S32", short_code: "609G", full_name: "Unspecified fracture of unspecified ischium, subsequent encounter for fracture with delayed healing", short_name: "Unspecified fracture of unspecified ischium, subsequent encounter for fracture with delayed healing", category_name: "Unspecified fracture of unspecified ischium, subsequent encounter for fracture with delayed healing" } end def _S32609K do %ICDCode{full_code: "S32609K", category_code: "S32", short_code: "609K", full_name: "Unspecified fracture of unspecified ischium, subsequent encounter for fracture with nonunion", short_name: "Unspecified fracture of unspecified ischium, subsequent encounter for fracture with nonunion", category_name: "Unspecified fracture of unspecified ischium, subsequent encounter for fracture with nonunion" } end def _S32609S do %ICDCode{full_code: "S32609S", category_code: "S32", short_code: "609S", full_name: "Unspecified fracture of unspecified ischium, sequela", short_name: "Unspecified fracture of unspecified ischium, sequela", category_name: "Unspecified fracture of unspecified ischium, sequela" } end def _S32611A do %ICDCode{full_code: "S32611A", category_code: "S32", short_code: "611A", full_name: "Displaced avulsion fracture of right ischium, initial encounter for closed fracture", short_name: "Displaced avulsion fracture of right ischium, initial encounter for closed fracture", category_name: "Displaced avulsion fracture of right ischium, initial encounter for closed fracture" } end def _S32611B do %ICDCode{full_code: "S32611B", category_code: "S32", short_code: "611B", full_name: "Displaced avulsion fracture of right ischium, initial encounter for open fracture", short_name: "Displaced avulsion fracture of right ischium, initial encounter for open fracture", category_name: "Displaced avulsion fracture of right ischium, initial encounter for open fracture" } end def _S32611D do %ICDCode{full_code: "S32611D", category_code: "S32", short_code: "611D", full_name: "Displaced avulsion fracture of right ischium, subsequent encounter for fracture with routine healing", short_name: "Displaced avulsion fracture of right ischium, subsequent encounter for fracture with routine healing", category_name: "Displaced avulsion fracture of right ischium, subsequent encounter for fracture with routine healing" } end def _S32611G do %ICDCode{full_code: "S32611G", category_code: "S32", short_code: "611G", full_name: "Displaced avulsion fracture of right ischium, subsequent encounter for fracture with delayed healing", short_name: "Displaced avulsion fracture of right ischium, subsequent encounter for fracture with delayed healing", category_name: "Displaced avulsion fracture of right ischium, subsequent encounter for fracture with delayed healing" } end def _S32611K do %ICDCode{full_code: "S32611K", category_code: "S32", short_code: "611K", full_name: "Displaced avulsion fracture of right ischium, subsequent encounter for fracture with nonunion", short_name: "Displaced avulsion fracture of right ischium, subsequent encounter for fracture with nonunion", category_name: "Displaced avulsion fracture of right ischium, subsequent encounter for fracture with nonunion" } end def _S32611S do %ICDCode{full_code: "S32611S", category_code: "S32", short_code: "611S", full_name: "Displaced avulsion fracture of right ischium, sequela", short_name: "Displaced avulsion fracture of right ischium, sequela", category_name: "Displaced avulsion fracture of right ischium, sequela" } end def _S32612A do %ICDCode{full_code: "S32612A", category_code: "S32", short_code: "612A", full_name: "Displaced avulsion fracture of left ischium, initial encounter for closed fracture", short_name: "Displaced avulsion fracture of left ischium, initial encounter for closed fracture", category_name: "Displaced avulsion fracture of left ischium, initial encounter for closed fracture" } end def _S32612B do %ICDCode{full_code: "S32612B", category_code: "S32", short_code: "612B", full_name: "Displaced avulsion fracture of left ischium, initial encounter for open fracture", short_name: "Displaced avulsion fracture of left ischium, initial encounter for open fracture", category_name: "Displaced avulsion fracture of left ischium, initial encounter for open fracture" } end def _S32612D do %ICDCode{full_code: "S32612D", category_code: "S32", short_code: "612D", full_name: "Displaced avulsion fracture of left ischium, subsequent encounter for fracture with routine healing", short_name: "Displaced avulsion fracture of left ischium, subsequent encounter for fracture with routine healing", category_name: "Displaced avulsion fracture of left ischium, subsequent encounter for fracture with routine healing" } end def _S32612G do %ICDCode{full_code: "S32612G", category_code: "S32", short_code: "612G", full_name: "Displaced avulsion fracture of left ischium, subsequent encounter for fracture with delayed healing", short_name: "Displaced avulsion fracture of left ischium, subsequent encounter for fracture with delayed healing", category_name: "Displaced avulsion fracture of left ischium, subsequent encounter for fracture with delayed healing" } end def _S32612K do %ICDCode{full_code: "S32612K", category_code: "S32", short_code: "612K", full_name: "Displaced avulsion fracture of left ischium, subsequent encounter for fracture with nonunion", short_name: "Displaced avulsion fracture of left ischium, subsequent encounter for fracture with nonunion", category_name: "Displaced avulsion fracture of left ischium, subsequent encounter for fracture with nonunion" } end def _S32612S do %ICDCode{full_code: "S32612S", category_code: "S32", short_code: "612S", full_name: "Displaced avulsion fracture of left ischium, sequela", short_name: "Displaced avulsion fracture of left ischium, sequela", category_name: "Displaced avulsion fracture of left ischium, sequela" } end def _S32613A do %ICDCode{full_code: "S32613A", category_code: "S32", short_code: "613A", full_name: "Displaced avulsion fracture of unspecified ischium, initial encounter for closed fracture", short_name: "Displaced avulsion fracture of unspecified ischium, initial encounter for closed fracture", category_name: "Displaced avulsion fracture of unspecified ischium, initial encounter for closed fracture" } end def _S32613B do %ICDCode{full_code: "S32613B", category_code: "S32", short_code: "613B", full_name: "Displaced avulsion fracture of unspecified ischium, initial encounter for open fracture", short_name: "Displaced avulsion fracture of unspecified ischium, initial encounter for open fracture", category_name: "Displaced avulsion fracture of unspecified ischium, initial encounter for open fracture" } end def _S32613D do %ICDCode{full_code: "S32613D", category_code: "S32", short_code: "613D", full_name: "Displaced avulsion fracture of unspecified ischium, subsequent encounter for fracture with routine healing", short_name: "Displaced avulsion fracture of unspecified ischium, subsequent encounter for fracture with routine healing", category_name: "Displaced avulsion fracture of unspecified ischium, subsequent encounter for fracture with routine healing" } end def _S32613G do %ICDCode{full_code: "S32613G", category_code: "S32", short_code: "613G", full_name: "Displaced avulsion fracture of unspecified ischium, subsequent encounter for fracture with delayed healing", short_name: "Displaced avulsion fracture of unspecified ischium, subsequent encounter for fracture with delayed healing", category_name: "Displaced avulsion fracture of unspecified ischium, subsequent encounter for fracture with delayed healing" } end def _S32613K do %ICDCode{full_code: "S32613K", category_code: "S32", short_code: "613K", full_name: "Displaced avulsion fracture of unspecified ischium, subsequent encounter for fracture with nonunion", short_name: "Displaced avulsion fracture of unspecified ischium, subsequent encounter for fracture with nonunion", category_name: "Displaced avulsion fracture of unspecified ischium, subsequent encounter for fracture with nonunion" } end def _S32613S do %ICDCode{full_code: "S32613S", category_code: "S32", short_code: "613S", full_name: "Displaced avulsion fracture of unspecified ischium, sequela", short_name: "Displaced avulsion fracture of unspecified ischium, sequela", category_name: "Displaced avulsion fracture of unspecified ischium, sequela" } end def _S32614A do %ICDCode{full_code: "S32614A", category_code: "S32", short_code: "614A", full_name: "Nondisplaced avulsion fracture of right ischium, initial encounter for closed fracture", short_name: "Nondisplaced avulsion fracture of right ischium, initial encounter for closed fracture", category_name: "Nondisplaced avulsion fracture of right ischium, initial encounter for closed fracture" } end def _S32614B do %ICDCode{full_code: "S32614B", category_code: "S32", short_code: "614B", full_name: "Nondisplaced avulsion fracture of right ischium, initial encounter for open fracture", short_name: "Nondisplaced avulsion fracture of right ischium, initial encounter for open fracture", category_name: "Nondisplaced avulsion fracture of right ischium, initial encounter for open fracture" } end def _S32614D do %ICDCode{full_code: "S32614D", category_code: "S32", short_code: "614D", full_name: "Nondisplaced avulsion fracture of right ischium, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced avulsion fracture of right ischium, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced avulsion fracture of right ischium, subsequent encounter for fracture with routine healing" } end def _S32614G do %ICDCode{full_code: "S32614G", category_code: "S32", short_code: "614G", full_name: "Nondisplaced avulsion fracture of right ischium, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced avulsion fracture of right ischium, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced avulsion fracture of right ischium, subsequent encounter for fracture with delayed healing" } end def _S32614K do %ICDCode{full_code: "S32614K", category_code: "S32", short_code: "614K", full_name: "Nondisplaced avulsion fracture of right ischium, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced avulsion fracture of right ischium, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced avulsion fracture of right ischium, subsequent encounter for fracture with nonunion" } end def _S32614S do %ICDCode{full_code: "S32614S", category_code: "S32", short_code: "614S", full_name: "Nondisplaced avulsion fracture of right ischium, sequela", short_name: "Nondisplaced avulsion fracture of right ischium, sequela", category_name: "Nondisplaced avulsion fracture of right ischium, sequela" } end def _S32615A do %ICDCode{full_code: "S32615A", category_code: "S32", short_code: "615A", full_name: "Nondisplaced avulsion fracture of left ischium, initial encounter for closed fracture", short_name: "Nondisplaced avulsion fracture of left ischium, initial encounter for closed fracture", category_name: "Nondisplaced avulsion fracture of left ischium, initial encounter for closed fracture" } end def _S32615B do %ICDCode{full_code: "S32615B", category_code: "S32", short_code: "615B", full_name: "Nondisplaced avulsion fracture of left ischium, initial encounter for open fracture", short_name: "Nondisplaced avulsion fracture of left ischium, initial encounter for open fracture", category_name: "Nondisplaced avulsion fracture of left ischium, initial encounter for open fracture" } end def _S32615D do %ICDCode{full_code: "S32615D", category_code: "S32", short_code: "615D", full_name: "Nondisplaced avulsion fracture of left ischium, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced avulsion fracture of left ischium, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced avulsion fracture of left ischium, subsequent encounter for fracture with routine healing" } end def _S32615G do %ICDCode{full_code: "S32615G", category_code: "S32", short_code: "615G", full_name: "Nondisplaced avulsion fracture of left ischium, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced avulsion fracture of left ischium, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced avulsion fracture of left ischium, subsequent encounter for fracture with delayed healing" } end def _S32615K do %ICDCode{full_code: "S32615K", category_code: "S32", short_code: "615K", full_name: "Nondisplaced avulsion fracture of left ischium, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced avulsion fracture of left ischium, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced avulsion fracture of left ischium, subsequent encounter for fracture with nonunion" } end def _S32615S do %ICDCode{full_code: "S32615S", category_code: "S32", short_code: "615S", full_name: "Nondisplaced avulsion fracture of left ischium, sequela", short_name: "Nondisplaced avulsion fracture of left ischium, sequela", category_name: "Nondisplaced avulsion fracture of left ischium, sequela" } end def _S32616A do %ICDCode{full_code: "S32616A", category_code: "S32", short_code: "616A", full_name: "Nondisplaced avulsion fracture of unspecified ischium, initial encounter for closed fracture", short_name: "Nondisplaced avulsion fracture of unspecified ischium, initial encounter for closed fracture", category_name: "Nondisplaced avulsion fracture of unspecified ischium, initial encounter for closed fracture" } end def _S32616B do %ICDCode{full_code: "S32616B", category_code: "S32", short_code: "616B", full_name: "Nondisplaced avulsion fracture of unspecified ischium, initial encounter for open fracture", short_name: "Nondisplaced avulsion fracture of unspecified ischium, initial encounter for open fracture", category_name: "Nondisplaced avulsion fracture of unspecified ischium, initial encounter for open fracture" } end def _S32616D do %ICDCode{full_code: "S32616D", category_code: "S32", short_code: "616D", full_name: "Nondisplaced avulsion fracture of unspecified ischium, subsequent encounter for fracture with routine healing", short_name: "Nondisplaced avulsion fracture of unspecified ischium, subsequent encounter for fracture with routine healing", category_name: "Nondisplaced avulsion fracture of unspecified ischium, subsequent encounter for fracture with routine healing" } end def _S32616G do %ICDCode{full_code: "S32616G", category_code: "S32", short_code: "616G", full_name: "Nondisplaced avulsion fracture of unspecified ischium, subsequent encounter for fracture with delayed healing", short_name: "Nondisplaced avulsion fracture of unspecified ischium, subsequent encounter for fracture with delayed healing", category_name: "Nondisplaced avulsion fracture of unspecified ischium, subsequent encounter for fracture with delayed healing" } end def _S32616K do %ICDCode{full_code: "S32616K", category_code: "S32", short_code: "616K", full_name: "Nondisplaced avulsion fracture of unspecified ischium, subsequent encounter for fracture with nonunion", short_name: "Nondisplaced avulsion fracture of unspecified ischium, subsequent encounter for fracture with nonunion", category_name: "Nondisplaced avulsion fracture of unspecified ischium, subsequent encounter for fracture with nonunion" } end def _S32616S do %ICDCode{full_code: "S32616S", category_code: "S32", short_code: "616S", full_name: "Nondisplaced avulsion fracture of unspecified ischium, sequela", short_name: "Nondisplaced avulsion fracture of unspecified ischium, sequela", category_name: "Nondisplaced avulsion fracture of unspecified ischium, sequela" } end def _S32691A do %ICDCode{full_code: "S32691A", category_code: "S32", short_code: "691A", full_name: "Other specified fracture of right ischium, initial encounter for closed fracture", short_name: "Other specified fracture of right ischium, initial encounter for closed fracture", category_name: "Other specified fracture of right ischium, initial encounter for closed fracture" } end def _S32691B do %ICDCode{full_code: "S32691B", category_code: "S32", short_code: "691B", full_name: "Other specified fracture of right ischium, initial encounter for open fracture", short_name: "Other specified fracture of right ischium, initial encounter for open fracture", category_name: "Other specified fracture of right ischium, initial encounter for open fracture" } end def _S32691D do %ICDCode{full_code: "S32691D", category_code: "S32", short_code: "691D", full_name: "Other specified fracture of right ischium, subsequent encounter for fracture with routine healing", short_name: "Other specified fracture of right ischium, subsequent encounter for fracture with routine healing", category_name: "Other specified fracture of right ischium, subsequent encounter for fracture with routine healing" } end def _S32691G do %ICDCode{full_code: "S32691G", category_code: "S32", short_code: "691G", full_name: "Other specified fracture of right ischium, subsequent encounter for fracture with delayed healing", short_name: "Other specified fracture of right ischium, subsequent encounter for fracture with delayed healing", category_name: "Other specified fracture of right ischium, subsequent encounter for fracture with delayed healing" } end def _S32691K do %ICDCode{full_code: "S32691K", category_code: "S32", short_code: "691K", full_name: "Other specified fracture of right ischium, subsequent encounter for fracture with nonunion", short_name: "Other specified fracture of right ischium, subsequent encounter for fracture with nonunion", category_name: "Other specified fracture of right ischium, subsequent encounter for fracture with nonunion" } end def _S32691S do %ICDCode{full_code: "S32691S", category_code: "S32", short_code: "691S", full_name: "Other specified fracture of right ischium, sequela", short_name: "Other specified fracture of right ischium, sequela", category_name: "Other specified fracture of right ischium, sequela" } end def _S32692A do %ICDCode{full_code: "S32692A", category_code: "S32", short_code: "692A", full_name: "Other specified fracture of left ischium, initial encounter for closed fracture", short_name: "Other specified fracture of left ischium, initial encounter for closed fracture", category_name: "Other specified fracture of left ischium, initial encounter for closed fracture" } end def _S32692B do %ICDCode{full_code: "S32692B", category_code: "S32", short_code: "692B", full_name: "Other specified fracture of left ischium, initial encounter for open fracture", short_name: "Other specified fracture of left ischium, initial encounter for open fracture", category_name: "Other specified fracture of left ischium, initial encounter for open fracture" } end def _S32692D do %ICDCode{full_code: "S32692D", category_code: "S32", short_code: "692D", full_name: "Other specified fracture of left ischium, subsequent encounter for fracture with routine healing", short_name: "Other specified fracture of left ischium, subsequent encounter for fracture with routine healing", category_name: "Other specified fracture of left ischium, subsequent encounter for fracture with routine healing" } end def _S32692G do %ICDCode{full_code: "S32692G", category_code: "S32", short_code: "692G", full_name: "Other specified fracture of left ischium, subsequent encounter for fracture with delayed healing", short_name: "Other specified fracture of left ischium, subsequent encounter for fracture with delayed healing", category_name: "Other specified fracture of left ischium, subsequent encounter for fracture with delayed healing" } end def _S32692K do %ICDCode{full_code: "S32692K", category_code: "S32", short_code: "692K", full_name: "Other specified fracture of left ischium, subsequent encounter for fracture with nonunion", short_name: "Other specified fracture of left ischium, subsequent encounter for fracture with nonunion", category_name: "Other specified fracture of left ischium, subsequent encounter for fracture with nonunion" } end def _S32692S do %ICDCode{full_code: "S32692S", category_code: "S32", short_code: "692S", full_name: "Other specified fracture of left ischium, sequela", short_name: "Other specified fracture of left ischium, sequela", category_name: "Other specified fracture of left ischium, sequela" } end def _S32699A do %ICDCode{full_code: "S32699A", category_code: "S32", short_code: "699A", full_name: "Other specified fracture of unspecified ischium, initial encounter for closed fracture", short_name: "Other specified fracture of unspecified ischium, initial encounter for closed fracture", category_name: "Other specified fracture of unspecified ischium, initial encounter for closed fracture" } end def _S32699B do %ICDCode{full_code: "S32699B", category_code: "S32", short_code: "699B", full_name: "Other specified fracture of unspecified ischium, initial encounter for open fracture", short_name: "Other specified fracture of unspecified ischium, initial encounter for open fracture", category_name: "Other specified fracture of unspecified ischium, initial encounter for open fracture" } end def _S32699D do %ICDCode{full_code: "S32699D", category_code: "S32", short_code: "699D", full_name: "Other specified fracture of unspecified ischium, subsequent encounter for fracture with routine healing", short_name: "Other specified fracture of unspecified ischium, subsequent encounter for fracture with routine healing", category_name: "Other specified fracture of unspecified ischium, subsequent encounter for fracture with routine healing" } end def _S32699G do %ICDCode{full_code: "S32699G", category_code: "S32", short_code: "699G", full_name: "Other specified fracture of unspecified ischium, subsequent encounter for fracture with delayed healing", short_name: "Other specified fracture of unspecified ischium, subsequent encounter for fracture with delayed healing", category_name: "Other specified fracture of unspecified ischium, subsequent encounter for fracture with delayed healing" } end def _S32699K do %ICDCode{full_code: "S32699K", category_code: "S32", short_code: "699K", full_name: "Other specified fracture of unspecified ischium, subsequent encounter for fracture with nonunion", short_name: "Other specified fracture of unspecified ischium, subsequent encounter for fracture with nonunion", category_name: "Other specified fracture of unspecified ischium, subsequent encounter for fracture with nonunion" } end def _S32699S do %ICDCode{full_code: "S32699S", category_code: "S32", short_code: "699S", full_name: "Other specified fracture of unspecified ischium, sequela", short_name: "Other specified fracture of unspecified ischium, sequela", category_name: "Other specified fracture of unspecified ischium, sequela" } end def _S32810A do %ICDCode{full_code: "S32810A", category_code: "S32", short_code: "810A", full_name: "Multiple fractures of pelvis with stable disruption of pelvic ring, initial encounter for closed fracture", short_name: "Multiple fractures of pelvis with stable disruption of pelvic ring, initial encounter for closed fracture", category_name: "Multiple fractures of pelvis with stable disruption of pelvic ring, initial encounter for closed fracture" } end def _S32810B do %ICDCode{full_code: "S32810B", category_code: "S32", short_code: "810B", full_name: "Multiple fractures of pelvis with stable disruption of pelvic ring, initial encounter for open fracture", short_name: "Multiple fractures of pelvis with stable disruption of pelvic ring, initial encounter for open fracture", category_name: "Multiple fractures of pelvis with stable disruption of pelvic ring, initial encounter for open fracture" } end def _S32810D do %ICDCode{full_code: "S32810D", category_code: "S32", short_code: "810D", full_name: "Multiple fractures of pelvis with stable disruption of pelvic ring, subsequent encounter for fracture with routine healing", short_name: "Multiple fractures of pelvis with stable disruption of pelvic ring, subsequent encounter for fracture with routine healing", category_name: "Multiple fractures of pelvis with stable disruption of pelvic ring, subsequent encounter for fracture with routine healing" } end def _S32810G do %ICDCode{full_code: "S32810G", category_code: "S32", short_code: "810G", full_name: "Multiple fractures of pelvis with stable disruption of pelvic ring, subsequent encounter for fracture with delayed healing", short_name: "Multiple fractures of pelvis with stable disruption of pelvic ring, subsequent encounter for fracture with delayed healing", category_name: "Multiple fractures of pelvis with stable disruption of pelvic ring, subsequent encounter for fracture with delayed healing" } end def _S32810K do %ICDCode{full_code: "S32810K", category_code: "S32", short_code: "810K", full_name: "Multiple fractures of pelvis with stable disruption of pelvic ring, subsequent encounter for fracture with nonunion", short_name: "Multiple fractures of pelvis with stable disruption of pelvic ring, subsequent encounter for fracture with nonunion", category_name: "Multiple fractures of pelvis with stable disruption of pelvic ring, subsequent encounter for fracture with nonunion" } end def _S32810S do %ICDCode{full_code: "S32810S", category_code: "S32", short_code: "810S", full_name: "Multiple fractures of pelvis with stable disruption of pelvic ring, sequela", short_name: "Multiple fractures of pelvis with stable disruption of pelvic ring, sequela", category_name: "Multiple fractures of pelvis with stable disruption of pelvic ring, sequela" } end def _S32811A do %ICDCode{full_code: "S32811A", category_code: "S32", short_code: "811A", full_name: "Multiple fractures of pelvis with unstable disruption of pelvic ring, initial encounter for closed fracture", short_name: "Multiple fractures of pelvis with unstable disruption of pelvic ring, initial encounter for closed fracture", category_name: "Multiple fractures of pelvis with unstable disruption of pelvic ring, initial encounter for closed fracture" } end def _S32811B do %ICDCode{full_code: "S32811B", category_code: "S32", short_code: "811B", full_name: "Multiple fractures of pelvis with unstable disruption of pelvic ring, initial encounter for open fracture", short_name: "Multiple fractures of pelvis with unstable disruption of pelvic ring, initial encounter for open fracture", category_name: "Multiple fractures of pelvis with unstable disruption of pelvic ring, initial encounter for open fracture" } end def _S32811D do %ICDCode{full_code: "S32811D", category_code: "S32", short_code: "811D", full_name: "Multiple fractures of pelvis with unstable disruption of pelvic ring, subsequent encounter for fracture with routine healing", short_name: "Multiple fractures of pelvis with unstable disruption of pelvic ring, subsequent encounter for fracture with routine healing", category_name: "Multiple fractures of pelvis with unstable disruption of pelvic ring, subsequent encounter for fracture with routine healing" } end def _S32811G do %ICDCode{full_code: "S32811G", category_code: "S32", short_code: "811G", full_name: "Multiple fractures of pelvis with unstable disruption of pelvic ring, subsequent encounter for fracture with delayed healing", short_name: "Multiple fractures of pelvis with unstable disruption of pelvic ring, subsequent encounter for fracture with delayed healing", category_name: "Multiple fractures of pelvis with unstable disruption of pelvic ring, subsequent encounter for fracture with delayed healing" } end def _S32811K do %ICDCode{full_code: "S32811K", category_code: "S32", short_code: "811K", full_name: "Multiple fractures of pelvis with unstable disruption of pelvic ring, subsequent encounter for fracture with nonunion", short_name: "Multiple fractures of pelvis with unstable disruption of pelvic ring, subsequent encounter for fracture with nonunion", category_name: "Multiple fractures of pelvis with unstable disruption of pelvic ring, subsequent encounter for fracture with nonunion" } end def _S32811S do %ICDCode{full_code: "S32811S", category_code: "S32", short_code: "811S", full_name: "Multiple fractures of pelvis with unstable disruption of pelvic ring, sequela", short_name: "Multiple fractures of pelvis with unstable disruption of pelvic ring, sequela", category_name: "Multiple fractures of pelvis with unstable disruption of pelvic ring, sequela" } end def _S3282XA do %ICDCode{full_code: "S3282XA", category_code: "S32", short_code: "82XA", full_name: "Multiple fractures of pelvis without disruption of pelvic ring, initial encounter for closed fracture", short_name: "Multiple fractures of pelvis without disruption of pelvic ring, initial encounter for closed fracture", category_name: "Multiple fractures of pelvis without disruption of pelvic ring, initial encounter for closed fracture" } end def _S3282XB do %ICDCode{full_code: "S3282XB", category_code: "S32", short_code: "82XB", full_name: "Multiple fractures of pelvis without disruption of pelvic ring, initial encounter for open fracture", short_name: "Multiple fractures of pelvis without disruption of pelvic ring, initial encounter for open fracture", category_name: "Multiple fractures of pelvis without disruption of pelvic ring, initial encounter for open fracture" } end def _S3282XD do %ICDCode{full_code: "S3282XD", category_code: "S32", short_code: "82XD", full_name: "Multiple fractures of pelvis without disruption of pelvic ring, subsequent encounter for fracture with routine healing", short_name: "Multiple fractures of pelvis without disruption of pelvic ring, subsequent encounter for fracture with routine healing", category_name: "Multiple fractures of pelvis without disruption of pelvic ring, subsequent encounter for fracture with routine healing" } end def _S3282XG do %ICDCode{full_code: "S3282XG", category_code: "S32", short_code: "82XG", full_name: "Multiple fractures of pelvis without disruption of pelvic ring, subsequent encounter for fracture with delayed healing", short_name: "Multiple fractures of pelvis without disruption of pelvic ring, subsequent encounter for fracture with delayed healing", category_name: "Multiple fractures of pelvis without disruption of pelvic ring, subsequent encounter for fracture with delayed healing" } end def _S3282XK do %ICDCode{full_code: "S3282XK", category_code: "S32", short_code: "82XK", full_name: "Multiple fractures of pelvis without disruption of pelvic ring, subsequent encounter for fracture with nonunion", short_name: "Multiple fractures of pelvis without disruption of pelvic ring, subsequent encounter for fracture with nonunion", category_name: "Multiple fractures of pelvis without disruption of pelvic ring, subsequent encounter for fracture with nonunion" } end def _S3282XS do %ICDCode{full_code: "S3282XS", category_code: "S32", short_code: "82XS", full_name: "Multiple fractures of pelvis without disruption of pelvic ring, sequela", short_name: "Multiple fractures of pelvis without disruption of pelvic ring, sequela", category_name: "Multiple fractures of pelvis without disruption of pelvic ring, sequela" } end def _S3289XA do %ICDCode{full_code: "S3289XA", category_code: "S32", short_code: "89XA", full_name: "Fracture of other parts of pelvis, initial encounter for closed fracture", short_name: "Fracture of other parts of pelvis, initial encounter for closed fracture", category_name: "Fracture of other parts of pelvis, initial encounter for closed fracture" } end def _S3289XB do %ICDCode{full_code: "S3289XB", category_code: "S32", short_code: "89XB", full_name: "Fracture of other parts of pelvis, initial encounter for open fracture", short_name: "Fracture of other parts of pelvis, initial encounter for open fracture", category_name: "Fracture of other parts of pelvis, initial encounter for open fracture" } end def _S3289XD do %ICDCode{full_code: "S3289XD", category_code: "S32", short_code: "89XD", full_name: "Fracture of other parts of pelvis, subsequent encounter for fracture with routine healing", short_name: "Fracture of other parts of pelvis, subsequent encounter for fracture with routine healing", category_name: "Fracture of other parts of pelvis, subsequent encounter for fracture with routine healing" } end def _S3289XG do %ICDCode{full_code: "S3289XG", category_code: "S32", short_code: "89XG", full_name: "Fracture of other parts of pelvis, subsequent encounter for fracture with delayed healing", short_name: "Fracture of other parts of pelvis, subsequent encounter for fracture with delayed healing", category_name: "Fracture of other parts of pelvis, subsequent encounter for fracture with delayed healing" } end def _S3289XK do %ICDCode{full_code: "S3289XK", category_code: "S32", short_code: "89XK", full_name: "Fracture of other parts of pelvis, subsequent encounter for fracture with nonunion", short_name: "Fracture of other parts of pelvis, subsequent encounter for fracture with nonunion", category_name: "Fracture of other parts of pelvis, subsequent encounter for fracture with nonunion" } end def _S3289XS do %ICDCode{full_code: "S3289XS", category_code: "S32", short_code: "89XS", full_name: "Fracture of other parts of pelvis, sequela", short_name: "Fracture of other parts of pelvis, sequela", category_name: "Fracture of other parts of pelvis, sequela" } end def _S329XXA do %ICDCode{full_code: "S329XXA", category_code: "S32", short_code: "9XXA", full_name: "Fracture of unspecified parts of lumbosacral spine and pelvis, initial encounter for closed fracture", short_name: "Fracture of unspecified parts of lumbosacral spine and pelvis, initial encounter for closed fracture", category_name: "Fracture of unspecified parts of lumbosacral spine and pelvis, initial encounter for closed fracture" } end def _S329XXB do %ICDCode{full_code: "S329XXB", category_code: "S32", short_code: "9XXB", full_name: "Fracture of unspecified parts of lumbosacral spine and pelvis, initial encounter for open fracture", short_name: "Fracture of unspecified parts of lumbosacral spine and pelvis, initial encounter for open fracture", category_name: "Fracture of unspecified parts of lumbosacral spine and pelvis, initial encounter for open fracture" } end def _S329XXD do %ICDCode{full_code: "S329XXD", category_code: "S32", short_code: "9XXD", full_name: "Fracture of unspecified parts of lumbosacral spine and pelvis, subsequent encounter for fracture with routine healing", short_name: "Fracture of unspecified parts of lumbosacral spine and pelvis, subsequent encounter for fracture with routine healing", category_name: "Fracture of unspecified parts of lumbosacral spine and pelvis, subsequent encounter for fracture with routine healing" } end def _S329XXG do %ICDCode{full_code: "S329XXG", category_code: "S32", short_code: "9XXG", full_name: "Fracture of unspecified parts of lumbosacral spine and pelvis, subsequent encounter for fracture with delayed healing", short_name: "Fracture of unspecified parts of lumbosacral spine and pelvis, subsequent encounter for fracture with delayed healing", category_name: "Fracture of unspecified parts of lumbosacral spine and pelvis, subsequent encounter for fracture with delayed healing" } end def _S329XXK do %ICDCode{full_code: "S329XXK", category_code: "S32", short_code: "9XXK", full_name: "Fracture of unspecified parts of lumbosacral spine and pelvis, subsequent encounter for fracture with nonunion", short_name: "Fracture of unspecified parts of lumbosacral spine and pelvis, subsequent encounter for fracture with nonunion", category_name: "Fracture of unspecified parts of lumbosacral spine and pelvis, subsequent encounter for fracture with nonunion" } end def _S329XXS do %ICDCode{full_code: "S329XXS", category_code: "S32", short_code: "9XXS", full_name: "Fracture of unspecified parts of lumbosacral spine and pelvis, sequela", short_name: "Fracture of unspecified parts of lumbosacral spine and pelvis, sequela", category_name: "Fracture of unspecified parts of lumbosacral spine and pelvis, sequela" } end end
53.279228
164
0.699695
0352a01e43d30b811b196feeb0a0c55c9fd08865
2,342
ex
Elixir
clients/video_intelligence/lib/google_api/video_intelligence/v1/model/google_cloud_videointelligence_v1p1beta1__face_frame.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
1
2021-12-20T03:40:53.000Z
2021-12-20T03:40:53.000Z
clients/video_intelligence/lib/google_api/video_intelligence/v1/model/google_cloud_videointelligence_v1p1beta1__face_frame.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
1
2020-08-18T00:11:23.000Z
2020-08-18T00:44:16.000Z
clients/video_intelligence/lib/google_api/video_intelligence/v1/model/google_cloud_videointelligence_v1p1beta1__face_frame.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1p1beta1_FaceFrame do @moduledoc """ Deprecated. No effect. ## Attributes * `normalizedBoundingBoxes` (*type:* `list(GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1p1beta1_NormalizedBoundingBox.t)`, *default:* `nil`) - Normalized Bounding boxes in a frame. There can be more than one boxes if the same face is detected in multiple locations within the current frame. * `timeOffset` (*type:* `String.t`, *default:* `nil`) - Time-offset, relative to the beginning of the video, corresponding to the video frame for this location. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :normalizedBoundingBoxes => list( GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1p1beta1_NormalizedBoundingBox.t() ) | nil, :timeOffset => String.t() | nil } field(:normalizedBoundingBoxes, as: GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1p1beta1_NormalizedBoundingBox, type: :list ) field(:timeOffset) end defimpl Poison.Decoder, for: GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1p1beta1_FaceFrame do def decode(value, options) do GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1p1beta1_FaceFrame.decode( value, options ) end end defimpl Poison.Encoder, for: GoogleApi.VideoIntelligence.V1.Model.GoogleCloudVideointelligenceV1p1beta1_FaceFrame do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
36.59375
316
0.748933
0352bf386c880d77bd0b629432879932d60c1ab8
1,734
ex
Elixir
lib/restarter.ex
CultivateHQ/restarter
86db420127bff59a91b17d08dd35090a96aebec2
[ "MIT" ]
2
2016-07-26T17:43:20.000Z
2016-07-27T21:12:32.000Z
lib/restarter.ex
CultivateHQ/restarter
86db420127bff59a91b17d08dd35090a96aebec2
[ "MIT" ]
null
null
null
lib/restarter.ex
CultivateHQ/restarter
86db420127bff59a91b17d08dd35090a96aebec2
[ "MIT" ]
null
null
null
defmodule Restarter do @moduledoc """ Acts as a back stop. Starts a service (with the supplied module, function, and args). The function is expected to return {:ok, pid}. Should the service exit, then it is restarted after an interval. There is also the opportunity to delay the start by a period of time. """ use GenServer @doc """ Start this `Restarter`, and also start the child. Arguments: * `{module, function, arg}` - the child function to start. The function should return `{:ok, pid}`. * `retry_interval` - on destruction of the child, the number of milliseconds to wait before restarting * `restarter_otp_opts` - OTP options for this Genserver, such as the name. Defaults to `[]` * `start_delay` - the number of milliseconds to wait before first starting the child. Defaults to `0`. """ def start_link({module, function, args}, retry_interval, restarter_otp_opts \\ [], start_delay \\ 0) do GenServer.start_link(__MODULE__, {%{retry_interval: retry_interval, module: module, function: function, args: args}, start_delay}, restarter_otp_opts) end def init({status, start_delay}) do Process.send_after(self, :start, start_delay) Process.flag(:trap_exit, true) {:ok, status} end def handle_info(:start, state = %{module: module, function: function, args: args}) do {:ok, pid} = apply(module, function, args) Process.link(pid) {:noreply, state} end def handle_info({:EXIT, _pid, _reason}, status = %{retry_interval: retry_interval}) do Process.send_after(self, :start, retry_interval) {:noreply, status} end end
39.409091
105
0.654556
0352f0e2e6d4105d8e715677827dd233e77f58a1
21,827
exs
Elixir
lib/elixir/test/elixir/code_normalizer/quoted_ast_test.exs
samgaw/elixir
92e8263102d95281a5aa7850b747636805f13fc9
[ "Apache-2.0" ]
2
2020-08-11T16:19:53.000Z
2020-08-11T18:07:11.000Z
lib/elixir/test/elixir/code_normalizer/quoted_ast_test.exs
samgaw/elixir
92e8263102d95281a5aa7850b747636805f13fc9
[ "Apache-2.0" ]
1
2021-10-21T08:22:30.000Z
2021-10-21T08:22:30.000Z
lib/elixir/test/elixir/code_normalizer/quoted_ast_test.exs
samgaw/elixir
92e8263102d95281a5aa7850b747636805f13fc9
[ "Apache-2.0" ]
1
2020-12-18T19:20:35.000Z
2020-12-18T19:20:35.000Z
Code.require_file("../test_helper.exs", __DIR__) defmodule Code.Normalizer.QuotedASTTest do use ExUnit.Case, async: true describe "quoted_to_algebra/2" do test "variable" do assert quoted_to_string(quote(do: foo)) == "foo" end test "local call" do assert quoted_to_string(quote(do: foo(1, 2, 3))) == "foo(1, 2, 3)" assert quoted_to_string(quote(do: foo([1, 2, 3]))) == "foo([1, 2, 3])" assert quoted_to_string(quote(do: foo(1, 2, 3)), locals_without_parens: [foo: 3]) == "foo 1, 2, 3" # Mixing literals and non-literals assert quoted_to_string(quote(do: foo(a, 2))) == "foo(a, 2)" assert quoted_to_string(quote(do: foo(1, b))) == "foo(1, b)" # Mixing literals and non-literals with line assert quoted_to_string(quote(line: __ENV__.line, do: foo(a, 2))) == "foo(a, 2)" assert quoted_to_string(quote(line: __ENV__.line, do: foo(1, b))) == "foo(1, b)" end test "local call no parens" do assert quoted_to_string({:def, [], [1, 2]}) == "def 1, 2" assert quoted_to_string({:def, [closing: []], [1, 2]}) == "def(1, 2)" end test "remote call" do assert quoted_to_string(quote(do: foo.bar(1, 2, 3))) == "foo.bar(1, 2, 3)" assert quoted_to_string(quote(do: foo.bar([1, 2, 3]))) == "foo.bar([1, 2, 3])" quoted = quote do (foo do :ok end).bar([1, 2, 3]) end assert quoted_to_string(quoted) == "(foo do\n :ok\n end).bar([1, 2, 3])" end test "nullary remote call" do assert quoted_to_string(quote do: foo.bar) == "foo.bar" assert quoted_to_string(quote do: foo.bar()) == "foo.bar()" end test "atom remote call" do assert quoted_to_string(quote(do: :foo.bar(1, 2, 3))) == ":foo.bar(1, 2, 3)" end test "remote and fun call" do assert quoted_to_string(quote(do: foo.bar().(1, 2, 3))) == "foo.bar().(1, 2, 3)" assert quoted_to_string(quote(do: foo.bar().([1, 2, 3]))) == "foo.bar().([1, 2, 3])" end test "unusual remote atom fun call" do assert quoted_to_string(quote(do: Foo."42"())) == ~s/Foo."42"()/ assert quoted_to_string(quote(do: Foo."Bar"())) == ~s/Foo."Bar"()/ assert quoted_to_string(quote(do: Foo."bar baz"().""())) == ~s/Foo."bar baz"().""()/ assert quoted_to_string(quote(do: Foo."%{}"())) == ~s/Foo."%{}"()/ assert quoted_to_string(quote(do: Foo."..."())) == ~s/Foo."..."()/ end test "atom fun call" do assert quoted_to_string(quote(do: :foo.(1, 2, 3))) == ":foo.(1, 2, 3)" end test "aliases call" do assert quoted_to_string(quote(do: Foo.Bar.baz(1, 2, 3))) == "Foo.Bar.baz(1, 2, 3)" assert quoted_to_string(quote(do: Foo.Bar.baz([1, 2, 3]))) == "Foo.Bar.baz([1, 2, 3])" assert quoted_to_string(quote(do: ?0.Bar.baz([1, 2, 3]))) == "48.Bar.baz([1, 2, 3])" assert quoted_to_string(quote(do: Foo.bar(<<>>, []))) == "Foo.bar(<<>>, [])" end test "keyword call" do assert quoted_to_string(quote(do: Foo.bar(foo: :bar))) == "Foo.bar(foo: :bar)" assert quoted_to_string(quote(do: Foo.bar("Elixir.Foo": :bar))) == "Foo.bar([{Foo, :bar}])" end test "sigil call" do assert quoted_to_string(quote(do: ~r"123")) == ~S/~r"123"/ assert quoted_to_string(quote(do: ~r"\n123")) == ~S/~r"\n123"/ assert quoted_to_string(quote(do: ~r"12\"3")) == ~S/~r"12\"3"/ assert quoted_to_string(quote(do: ~r/12\/3/u)) == ~S"~r/12\/3/u" assert quoted_to_string(quote(do: ~r{\n123})) == ~S/~r{\n123}/ assert quoted_to_string(quote(do: ~r((1\)(2\)3))) == ~S/~r((1\)(2\)3)/ assert quoted_to_string(quote(do: ~r{\n1{1\}23})) == ~S/~r{\n1{1\}23}/ assert quoted_to_string(quote(do: ~r|12\|3|)) == ~S"~r|12\|3|" assert quoted_to_string(quote(do: ~r[1#{two}3])) == ~S/~r[1#{two}3]/ assert quoted_to_string(quote(do: ~r|1[#{two}]3|)) == ~S/~r|1[#{two}]3|/ assert quoted_to_string(quote(do: ~r'1#{two}3'u)) == ~S/~r'1#{two}3'u/ assert quoted_to_string(quote(do: ~R"123")) == ~S/~R"123"/ assert quoted_to_string(quote(do: ~R"123"u)) == ~S/~R"123"u/ assert quoted_to_string(quote(do: ~R"\n123")) == ~S/~R"\n123"/ assert quoted_to_string(quote(do: ~S["'(123)'"])) == ~S/~S["'(123)'"]/ assert quoted_to_string(quote(do: ~s"#{"foo"}")) == ~S/~s"#{"foo"}"/ assert quoted_to_string(quote(do: ~S["'(123)'"]) |> strip_metadata()) == ~S/~S"\"'(123)'\""/ assert quoted_to_string(quote(do: ~s"#{"foo"}") |> strip_metadata()) == ~S/~s"#{"foo"}"/ assert quoted_to_string( quote do ~s""" "\""foo"\"" """ end ) == ~s[~s"""\n"\\""foo"\\""\n"""] assert quoted_to_string( quote do ~s''' '\''foo'\'' ''' end ) == ~s[~s'''\n'\\''foo'\\''\n'''] assert quoted_to_string( quote do ~s""" "\"foo\"" """ end ) == ~s[~s"""\n"\\"foo\\""\n"""] assert quoted_to_string( quote do ~s''' '\"foo\"' ''' end ) == ~s[~s'''\n'\\"foo\\"'\n'''] assert quoted_to_string( quote do ~S""" "123" """ end ) == ~s[~S"""\n"123"\n"""] end test "tuple" do assert quoted_to_string(quote do: {1, 2}) == "{1, 2}" assert quoted_to_string(quote do: {1}) == "{1}" assert quoted_to_string(quote do: {1, 2, 3}) == "{1, 2, 3}" assert quoted_to_string(quote do: {1, 2, 3, foo: :bar}) == "{1, 2, 3, [foo: :bar]}" end test "tuple call" do assert quoted_to_string(quote(do: alias(Foo.{Bar, Baz, Bong}))) == "alias Foo.{Bar, Baz, Bong}" assert quoted_to_string(quote(do: foo(Foo.{}))) == "foo(Foo.{})" end test "arrow" do assert quoted_to_string(quote(do: foo(1, (2 -> 3)))) == "foo(1, (2 -> 3))" end test "block" do quoted = quote do 1 2 ( :foo :bar ) 3 end expected = """ 1 2 ( :foo :bar ) 3 """ assert quoted_to_string(quoted) <> "\n" == expected end test "not in" do assert quoted_to_string(quote(do: false not in [])) == "false not in []" end test "if else" do expected = """ if foo do bar else baz end """ assert quoted_to_string(quote(do: if(foo, do: bar, else: baz))) <> "\n" == expected end test "case" do quoted = quote do case foo do true -> 0 false -> 1 2 end end expected = """ case foo do true -> 0 false -> 1 2 end """ assert quoted_to_string(quoted) <> "\n" == expected end test "case if else" do expected = """ case (if foo do bar else baz end) do end """ assert quoted_to_string( quote( do: case if(foo, do: bar, else: baz) do end ) ) <> "\n" == expected end test "try" do quoted = quote do try do foo catch _, _ -> 2 rescue ArgumentError -> 1 after 4 else _ -> 3 end end expected = """ try do foo catch _, _ -> 2 rescue ArgumentError -> 1 after 4 else _ -> 3 end """ assert quoted_to_string(quoted) <> "\n" == expected end test "fn" do assert quoted_to_string(quote(do: fn -> 1 + 2 end)) == "fn -> 1 + 2 end" assert quoted_to_string(quote(do: fn x -> x + 1 end)) == "fn x -> x + 1 end" quoted = quote do fn x -> y = x + 1 y end end expected = """ fn x -> y = x + 1 y end """ assert quoted_to_string(quoted) <> "\n" == expected quoted = quote do fn x -> y = x + 1 y z -> z end end expected = """ fn x -> y = x + 1 y z -> z end """ assert quoted_to_string(quoted) <> "\n" == expected assert quoted_to_string(quote(do: (fn x -> x end).(1))) == "(fn x -> x end).(1)" quoted = quote do (fn %{} -> :map _ -> :other end).(1) end expected = """ (fn %{} -> :map _ -> :other end).(1) """ assert quoted_to_string(quoted) <> "\n" == expected end test "range" do assert quoted_to_string(quote(do: unquote(-1..+2))) == "-1..2" assert quoted_to_string(quote(do: Foo.integer()..3)) == "Foo.integer()..3" assert quoted_to_string(quote(do: unquote(-1..+2//-3))) == "-1..2//-3" assert quoted_to_string(quote(do: Foo.integer()..3//Bar.bat())) == "Foo.integer()..3//Bar.bat()" end test "when" do assert quoted_to_string(quote(do: (() -> x))) == "(() -> x)" assert quoted_to_string(quote(do: (x when y -> z))) == "(x when y -> z)" assert quoted_to_string(quote(do: (x, y when z -> w))) == "(x, y when z -> w)" assert quoted_to_string(quote(do: (x, y when z -> w))) == "(x, y when z -> w)" assert quoted_to_string(quote(do: (x, y when z -> w))) == "(x, y when z -> w)" assert quoted_to_string(quote(do: (x when y: z))) == "x when y: z" assert quoted_to_string(quote(do: (x when y: z, z: w))) == "x when y: z, z: w" end test "nested" do quoted = quote do defmodule Foo do def foo do 1 + 1 end end end expected = """ defmodule Foo do def foo do 1 + 1 end end """ assert quoted_to_string(quoted) <> "\n" == expected end test "operator precedence" do assert quoted_to_string(quote(do: (1 + 2) * (3 - 4))) == "(1 + 2) * (3 - 4)" assert quoted_to_string(quote(do: (1 + 2) * 3 - 4)) == "(1 + 2) * 3 - 4" assert quoted_to_string(quote(do: 1 + 2 + 3)) == "1 + 2 + 3" assert quoted_to_string(quote(do: 1 + 2 - 3)) == "1 + 2 - 3" end test "capture operator" do assert quoted_to_string(quote(do: &foo/0)) == "&foo/0" assert quoted_to_string(quote(do: &Foo.foo/0)) == "&Foo.foo/0" assert quoted_to_string(quote(do: &(&1 + &2))) == "&(&1 + &2)" assert quoted_to_string(quote(do: & &1)) == "& &1" assert quoted_to_string(quote(do: & &1.(:x))) == "& &1.(:x)" assert quoted_to_string(quote(do: (& &1).(:x))) == "(& &1).(:x)" end test "operators" do assert quoted_to_string(quote(do: foo |> {1, 2})) == "foo |> {1, 2}" assert quoted_to_string(quote(do: foo |> {:map, arg})) == "foo |> {:map, arg}" end test "containers" do assert quoted_to_string(quote(do: {})) == "{}" assert quoted_to_string(quote(do: [])) == "[]" assert quoted_to_string(quote(do: {1, 2, 3})) == "{1, 2, 3}" assert quoted_to_string(quote(do: [1, 2, 3])) == "[1, 2, 3]" assert quoted_to_string(quote(do: ["Elixir.Foo": :bar])) == "[{Foo, :bar}]" assert quoted_to_string(quote(do: %{})) == "%{}" assert quoted_to_string(quote(do: %{:foo => :bar})) == "%{foo: :bar}" assert quoted_to_string(quote(do: %{:"Elixir.Foo" => :bar})) == "%{Foo => :bar}" assert quoted_to_string(quote(do: %{{1, 2} => [1, 2, 3]})) == "%{{1, 2} => [1, 2, 3]}" assert quoted_to_string(quote(do: %{map | "a" => "b"})) == "%{map | \"a\" => \"b\"}" assert quoted_to_string(quote(do: [1, 2, 3])) == "[1, 2, 3]" end test "false positive containers" do assert quoted_to_string({:%{}, [], nil}) == "%{}" end test "struct" do assert quoted_to_string(quote(do: %Test{})) == "%Test{}" assert quoted_to_string(quote(do: %Test{foo: 1, bar: 1})) == "%Test{foo: 1, bar: 1}" assert quoted_to_string(quote(do: %Test{struct | foo: 2})) == "%Test{struct | foo: 2}" assert quoted_to_string(quote(do: %Test{} + 1)) == "%Test{} + 1" assert quoted_to_string(quote(do: %Test{foo(1)} + 2)) == "%Test{foo(1)} + 2" end test "binary operators" do assert quoted_to_string(quote(do: 1 + 2)) == "1 + 2" assert quoted_to_string(quote(do: [1, 2 | 3])) == "[1, 2 | 3]" assert quoted_to_string(quote(do: [h | t] = [1, 2, 3])) == "[h | t] = [1, 2, 3]" assert quoted_to_string(quote(do: (x ++ y) ++ z)) == "(x ++ y) ++ z" assert quoted_to_string(quote(do: (x +++ y) +++ z)) == "(x +++ y) +++ z" end test "unary operators" do assert quoted_to_string(quote(do: not 1)) == "not 1" assert quoted_to_string(quote(do: not foo)) == "not foo" assert quoted_to_string(quote(do: -1)) == "-1" assert quoted_to_string(quote(do: +(+1))) == "+(+1)" assert quoted_to_string(quote(do: !(foo > bar))) == "!(foo > bar)" assert quoted_to_string(quote(do: @foo(bar))) == "@foo bar" assert quoted_to_string(quote(do: identity(&1))) == "identity(&1)" end test "access" do assert quoted_to_string(quote(do: a[b])) == "a[b]" assert quoted_to_string(quote(do: a[1 + 2])) == "a[1 + 2]" assert quoted_to_string(quote(do: (a || [a: 1])[:a])) == "(a || [a: 1])[:a]" assert quoted_to_string(quote(do: Map.put(%{}, :a, 1)[:a])) == "Map.put(%{}, :a, 1)[:a]" end test "keyword list" do assert quoted_to_string(quote(do: [a: a, b: b])) == "[a: a, b: b]" assert quoted_to_string(quote(do: [a: 1, b: 1 + 2])) == "[a: 1, b: 1 + 2]" assert quoted_to_string(quote(do: ["a.b": 1, c: 1 + 2])) == "[\"a.b\": 1, c: 1 + 2]" tuple = {{:__block__, [format: :keyword], [:a]}, {:b, [], nil}} assert quoted_to_string([tuple, :foo, tuple]) == "[{:a, b}, :foo, a: b]" assert quoted_to_string([tuple, :foo, {:c, :d}, tuple]) == "[{:a, b}, :foo, c: :d, a: b]" # Not keyword lists assert quoted_to_string(quote(do: [{binary(), integer()}])) == "[{binary(), integer()}]" end test "interpolation" do assert quoted_to_string(quote(do: "foo#{bar}baz")) == ~S["foo#{bar}baz"] end test "bit syntax" do ast = quote(do: <<1::8*4>>) assert quoted_to_string(ast) == "<<1::8*4>>" ast = quote(do: @type(foo :: <<_::8, _::_*4>>)) assert quoted_to_string(ast) == "@type foo :: <<_::8, _::_*4>>" ast = quote(do: <<69 - 4::bits-size(8 - 4)-unit(1), 65>>) assert quoted_to_string(ast) == "<<69 - 4::bits-size(8 - 4)-unit(1), 65>>" ast = quote(do: <<(<<65>>), 65>>) assert quoted_to_string(ast) == "<<(<<65>>), 65>>" ast = quote(do: <<65, (<<65>>)>>) assert quoted_to_string(ast) == "<<65, (<<65>>)>>" ast = quote(do: for(<<(a::4 <- <<1, 2>>)>>, do: a)) assert quoted_to_string(ast) == "for <<(a::4 <- <<1, 2>>)>> do\n a\nend" end test "integer/float" do assert quoted_to_string(1) == "1" assert quoted_to_string({:__block__, [], [1]}) == "1" end test "charlist" do assert quoted_to_string(quote(do: [])) == "[]" assert quoted_to_string(quote(do: 'abc')) == "'abc'" end test "string" do assert quoted_to_string(quote(do: "")) == ~S/""/ assert quoted_to_string(quote(do: "abc")) == ~S/"abc"/ assert quoted_to_string(quote(do: "#{"abc"}")) == ~S/"#{"abc"}"/ end test "catch-all" do assert quoted_to_string(quote do: {unquote(self())}) == "{#{inspect(self())}}" assert quoted_to_string(quote do: foo(unquote(self()))) == "foo(#{inspect(self())})" end test "last arg keyword list" do assert quoted_to_string(quote(do: foo([]))) == "foo([])" assert quoted_to_string(quote(do: foo(x: y))) == "foo(x: y)" assert quoted_to_string(quote(do: foo(x: 1 + 2))) == "foo(x: 1 + 2)" assert quoted_to_string(quote(do: foo(x: y, p: q))) == "foo(x: y, p: q)" assert quoted_to_string(quote(do: foo(a, x: y, p: q))) == "foo(a, x: y, p: q)" assert quoted_to_string(quote(do: {[]})) == "{[]}" assert quoted_to_string(quote(do: {[a: b]})) == "{[a: b]}" assert quoted_to_string(quote(do: {x, a: b})) == "{x, [a: b]}" assert quoted_to_string(quote(do: foo(else: a))) == "foo(else: a)" assert quoted_to_string(quote(do: foo(catch: a))) == "foo(catch: a)" assert quoted_to_string(quote(do: foo |> [bar: :baz])) == "foo |> [bar: :baz]" end end describe "quoted_to_algebra/2 escapes" do test "strings with slash escapes" do assert quoted_to_string(quote(do: "\a\b\d\e\f\n\r\t\v"), escape: false) == ~s/"\a\b\d\e\f\n\r\t\v"/ assert quoted_to_string(quote(do: "\a\b\d\e\f\n\r\t\v")) == ~s/"\\a\\b\\d\\e\\f\\n\\r\\t\\v"/ assert quoted_to_string({:__block__, [], ["\a\b\d\e\f\n\r\t\v"]}, escape: false) == ~s/"\a\b\d\e\f\n\r\t\v"/ assert quoted_to_string({:__block__, [], ["\a\b\d\e\f\n\r\t\v"]}) == ~s/"\\a\\b\\d\\e\\f\\n\\r\\t\\v"/ end test "strings with non printable characters" do assert quoted_to_string(quote(do: "\x00\x01\x10"), escape: false) == ~s/"\x00\x01\x10"/ assert quoted_to_string(quote(do: "\x00\x01\x10")) == ~S/"\0\x01\x10"/ end test "charlists with slash escapes" do assert quoted_to_string(quote(do: '\a\b\e\n\r\t\v'), escape: false) == ~s/'\a\b\e\n\r\t\v'/ assert quoted_to_string(quote(do: '\a\b\e\n\r\t\v')) == ~s/'\\a\\b\\e\\n\\r\\t\\v'/ assert quoted_to_string({:__block__, [], ['\a\b\e\n\r\t\v']}, escape: false) == ~s/'\a\b\e\n\r\t\v'/ assert quoted_to_string({:__block__, [], ['\a\b\e\n\r\t\v']}) == ~s/'\\a\\b\\e\\n\\r\\t\\v'/ end test "charlists with non printable characters" do assert quoted_to_string(quote(do: '\x00\x01\x10'), escape: false) == ~S/[0, 1, 16]/ assert quoted_to_string(quote(do: '\x00\x01\x10')) == ~S/[0, 1, 16]/ end test "charlists with interpolations" do assert quoted_to_string(quote(do: 'one #{2} three'), escape: false) == ~S/'one #{2} three'/ assert quoted_to_string(quote(do: 'one #{2} three')) == ~S/'one #{2} three'/ assert quoted_to_string(quote(do: 'one\n\'#{2}\'\nthree'), escape: false) == ~s['one\n\\'\#{2}\\'\nthree'] assert quoted_to_string(quote(do: 'one\n\'#{2}\'\nthree')) == ~S['one\n\'#{2}\'\nthree'] end test "atoms" do assert quoted_to_string(quote(do: :"a\nb\tc"), escape: false) == ~s/:"a\nb\tc"/ assert quoted_to_string(quote(do: :"a\nb\tc")) == ~S/:"a\nb\tc"/ assert quoted_to_string({:__block__, [], [:"a\nb\tc"]}, escape: false) == ~s/:"a\nb\tc"/ assert quoted_to_string({:__block__, [], [:"a\nb\tc"]}) == ~S/:"a\nb\tc"/ assert quoted_to_string(quote(do: :"Elixir.Foo")) == "Foo" assert quoted_to_string(quote(do: :"Elixir.Foo.Bar")) == "Foo.Bar" assert quoted_to_string(quote(do: :"Elixir.foobar")) == ~S/:"Elixir.foobar"/ end test "atoms with non printable characters" do assert quoted_to_string(quote(do: :"\x00\x01\x10"), escape: false) == ~s/:"\0\x01\x10"/ assert quoted_to_string(quote(do: :"\x00\x01\x10")) == ~S/:"\0\x01\x10"/ end test "atoms with interpolations" do assert quoted_to_string(quote(do: :"foo\n#{bar}\tbaz"), escape: false) == ~s[:"foo\n\#{bar}\tbaz"] assert quoted_to_string(quote(do: :"foo\n#{bar}\tbaz")) == ~S[:"foo\n#{bar}\tbaz"] assert quoted_to_string(quote(do: :"foo\"bar"), escape: false) == ~S[:"foo\"bar"] assert quoted_to_string(quote(do: :"foo\"bar")) == ~S[:"foo\"bar"] assert quoted_to_string(quote(do: :"foo#{~s/\n/}bar"), escape: false) == ~S[:"foo#{~s/\n/}bar"] assert quoted_to_string(quote(do: :"foo#{~s/\n/}bar")) == ~S[:"foo#{~s/\n/}bar"] assert quoted_to_string(quote(do: :"one\n\"#{2}\"\nthree"), escape: false) == ~s[:"one\n\\"\#{2}\\"\nthree"] assert quoted_to_string(quote(do: :"one\n\"#{2}\"\nthree")) == ~S[:"one\n\"#{2}\"\nthree"] end end describe "quoted_to_algebra/2 does not escape" do test "sigils" do assert quoted_to_string(quote(do: ~s/a\nb\tc/), escape: false) == ~S"~s/a\nb\tc/" assert quoted_to_string(quote(do: ~s/a\nb\tc/)) == ~S"~s/a\nb\tc/" assert quoted_to_string(quote(do: ~s/\a\b\d\e\f\n\r\t\v/), escape: false) == ~S"~s/\a\b\d\e\f\n\r\t\v/" assert quoted_to_string(quote(do: ~s/\a\b\d\e\f\n\r\t\v/)) == ~S"~s/\a\b\d\e\f\n\r\t\v/" assert quoted_to_string(quote(do: ~s/\x00\x01\x10/), escape: false) == ~S"~s/\x00\x01\x10/" assert quoted_to_string(quote(do: ~s/\x00\x01\x10/)) == ~S"~s/\x00\x01\x10/" end end defp strip_metadata(ast) do Macro.prewalk(ast, &Macro.update_meta(&1, fn _ -> [] end)) end defp quoted_to_string(quoted, opts \\ []) do doc = Code.quoted_to_algebra(quoted, opts) Inspect.Algebra.format(doc, 98) |> IO.iodata_to_binary() end end
33.121396
98
0.501168
0352f366dd270d76ca51be8036a3bed9c1db5ee1
1,497
exs
Elixir
mix.exs
code-and-effect/ex_effective_bootstrap
533e43ebd3bb83ec7a98eba3fd128d12fa43e2bb
[ "MIT" ]
12
2020-01-05T14:47:36.000Z
2021-07-23T14:59:19.000Z
mix.exs
alanvardy/ex_effective_bootstrap
533e43ebd3bb83ec7a98eba3fd128d12fa43e2bb
[ "MIT" ]
4
2020-01-16T04:55:36.000Z
2021-07-05T14:13:37.000Z
mix.exs
alanvardy/ex_effective_bootstrap
533e43ebd3bb83ec7a98eba3fd128d12fa43e2bb
[ "MIT" ]
7
2020-01-22T07:48:51.000Z
2021-07-23T14:59:25.000Z
defmodule ExEffectiveBootstrap.MixProject do use Mix.Project @version "0.1.21" def project do [ app: :ex_effective_bootstrap, version: @version, elixir: "~> 1.9", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod, compilers: [:phoenix] ++ Mix.compilers(), deps: deps(), package: package(), source_url: "https://github.com/code-and-effect/ex_effective_bootstrap", name: "ExEffectiveBootstrap", description: "Everything your Phoenix Elixir app needs to use Twitter Bootstrap 4" ] end # Run "mix help compile.app" to learn about applications. def application do [ extra_applications: [:logger] ] end # Run "mix help deps" to learn about dependencies. defp deps do [ {:phoenix, "~> 1.5"}, {:phoenix_html, "~> 2.1"}, {:jason, "~> 1.2"}, {:plug_cowboy, "~> 2.0"}, {:ecto, "~> 3.6"}, {:ex_check, "~> 0.12", only: :dev, runtime: false}, {:ex_doc, "~> 0.21", only: :dev, runtime: false}, {:credo, "~> 1.4.0", only: [:dev, :test], runtime: false} ] end defp package do [ maintainers: ["Code and Effect Inc."], licenses: ["MIT"], files: ~w(lib priv mix.exs package.json LICENSE.md README.md), links: %{github: "https://github.com/code-and-effect/ex_effective_bootstrap"} ] end defp elixirc_paths(:test), do: ["lib", "test/support"] defp elixirc_paths(_), do: ["lib"] end
27.218182
88
0.591182
035306928acf95cbc40570a8b8ad8713b285b059
955
exs
Elixir
mix.exs
cogini/mix_deploy_local
52a40445d1b917674f27eeb3b52c2d4b75885767
[ "Apache-2.0" ]
1
2020-01-13T23:23:59.000Z
2020-01-13T23:23:59.000Z
mix.exs
cogini/mix_deploy_local
52a40445d1b917674f27eeb3b52c2d4b75885767
[ "Apache-2.0" ]
null
null
null
mix.exs
cogini/mix_deploy_local
52a40445d1b917674f27eeb3b52c2d4b75885767
[ "Apache-2.0" ]
null
null
null
defmodule MixDeployLocal.MixProject do use Mix.Project def project do [ app: :mix_deploy_local, version: "0.1.0", elixir: "~> 1.6", start_permanent: Mix.env() == :prod, deps: deps(), dialyzer: [ plt_add_apps: [:mix, :eex] # plt_add_deps: true, # flags: ["-Werror_handling", "-Wrace_conditions"], # flags: ["-Wunmatched_returns", :error_handling, :race_conditions, :underspecs], # ignore_warnings: "dialyzer.ignore-warnings" ], ] end # Run "mix help compile.app" to learn about applications. def application do [ extra_applications: [:logger] ] end # Run "mix help deps" to learn about dependencies. defp deps do [ # {:dialyxir, "~> 0.5.1", only: [:dev, :test], runtime: false}, # {:dep_from_hexpm, "~> 0.3.0"}, # {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}, ] end end
25.810811
89
0.582199
03530a77195768238034c6a9c82025f69a8ce813
3,644
ex
Elixir
back/lib/api_web/controllers/role_controller.ex
HugoLefebvre/Epitech_TM_MP03
0ed161c956f7a10aec245fe2e17eb5a9b55f6075
[ "MIT" ]
null
null
null
back/lib/api_web/controllers/role_controller.ex
HugoLefebvre/Epitech_TM_MP03
0ed161c956f7a10aec245fe2e17eb5a9b55f6075
[ "MIT" ]
null
null
null
back/lib/api_web/controllers/role_controller.ex
HugoLefebvre/Epitech_TM_MP03
0ed161c956f7a10aec245fe2e17eb5a9b55f6075
[ "MIT" ]
null
null
null
defmodule ApiWeb.RoleController do use ApiWeb, :controller alias Api.Auth alias Api.Auth.Role action_fallback ApiWeb.FallbackController def index(conn, _params) do case decode(conn) do # Get the user connect with the token nil -> {:error, :unauthorizedUser} currentUser -> case (String.equivalent?(currentUser.role.name, "admin")) do false -> {:error, :unauthorizedUser} true -> roles = Auth.list_roles() render(conn, "index.json", roles: roles) end end end def create(conn, %{"role" => role_params}) do case decode(conn) do # Get the user connect with the token nil -> {:error, :unauthorizedUser} currentUser -> case (String.equivalent?(currentUser.role.name, "admin")) do false -> {:error, :unauthorizedUser} true -> with {:ok, %Role{} = role} <- Auth.create_role(role_params) do conn |> put_status(:created) |> put_resp_header("location", role_path(conn, :show, role)) |> render("show.json", role: role) end end end end def show(conn, %{"id" => id}) do case decode(conn) do # Get the user connect with the token nil -> {:error, :unauthorizedUser} currentUser -> case (String.equivalent?(currentUser.role.name, "admin")) do false -> {:error, :unauthorizedUser} true -> role = Auth.get_role!(id) render(conn, "show.json", role: role) end end end def update(conn, %{"id" => id, "role" => role_params}) do case decode(conn) do # Get the user connect with the token nil -> {:error, :unauthorizedUser} currentUser -> case (String.equivalent?(currentUser.role.name, "admin")) do false -> {:error, :unauthorizedUser} true -> role = Auth.get_role!(id) with {:ok, %Role{} = role} <- Auth.update_role(role, role_params) do render(conn, "show.json", role: role) end end end end def delete(conn, %{"id" => id}) do case decode(conn) do # Get the user connect with the token nil -> {:error, :unauthorizedUser} currentUser -> case (String.equivalent?(currentUser.role.name, "admin")) do false -> {:error, :unauthorizedUser} true -> role = Auth.get_role!(id) with {:ok, %Role{}} <- Auth.delete_role(role) do send_resp(conn, :no_content, "") end end end end # Get user connected with the token defp decode(conn) do # Take the prefix from a string take_prefix = fn full, prefix -> base = String.length(prefix) String.slice(full, base, String.length(full) - base) end case List.first(get_req_header(conn, "authorization")) do # Get the token in the header nil -> nil # Return null if there is no authorization bearer -> token = take_prefix.(bearer,"Bearer ") # Get the token {code, claims} = Api.Token.verify_and_validate(token) # Get the claims if code == :ok do # If there is no problem user = Auth.get_user!(Map.get(claims, "id")) # Get the user |> Api.Repo.preload(:role) # Get the role # If there is a token and is match with the user if (user.c_xsrf_token != nil && String.equivalent?(Map.get(claims, "c-xsrf-token"), user.c_xsrf_token)) do user # Return the user else nil end else nil end end end end
32.828829
116
0.568606
035330cae263d87ab09e968b405f97f9fbd244ed
1,188
ex
Elixir
lib/places_alloverse_com/application.ex
alloverse/places_alloverse_com
5c15ea08a88429378ce8f41047418e166cbde7e9
[ "BSD-2-Clause" ]
null
null
null
lib/places_alloverse_com/application.ex
alloverse/places_alloverse_com
5c15ea08a88429378ce8f41047418e166cbde7e9
[ "BSD-2-Clause" ]
null
null
null
lib/places_alloverse_com/application.ex
alloverse/places_alloverse_com
5c15ea08a88429378ce8f41047418e166cbde7e9
[ "BSD-2-Clause" ]
null
null
null
defmodule PlacesAlloverseCom.Application do # See https://hexdocs.pm/elixir/Application.html # for more information on OTP Applications @moduledoc false use Application def start(_type, _args) do # List all child processes to be supervised children = [ # Start the PubSub system # {Phoenix.PubSub, [name: PlacesAlloverseCom.PubSub, adapter: Phoenix.PubSub.PG2]} {Phoenix.PubSub, name: PlacesAlloverseCom.PubSub}, # Start the Ecto repository PlacesAlloverseCom.Repo, # Start the endpoint when the application starts PlacesAlloverseComWeb.Endpoint # Starts a worker by calling: PlacesAlloverseCom.Worker.start_link(arg) # {PlacesAlloverseCom.Worker, arg}, ] # See https://hexdocs.pm/elixir/Supervisor.html # for other strategies and supported options opts = [strategy: :one_for_one, name: PlacesAlloverseCom.Supervisor] Supervisor.start_link(children, opts) end # Tell Phoenix to update the endpoint configuration # whenever the application is updated. def config_change(changed, _new, removed) do PlacesAlloverseComWeb.Endpoint.config_change(changed, removed) :ok end end
31.263158
88
0.728956
0353338afbe879867b21f89484b1998e77de181e
1,601
ex
Elixir
lib/oauth2/response.ex
stephenmoloney/oauth2
4a1b2441700f34a54bb4446a36415b71217086d5
[ "MIT" ]
null
null
null
lib/oauth2/response.ex
stephenmoloney/oauth2
4a1b2441700f34a54bb4446a36415b71217086d5
[ "MIT" ]
2
2018-09-07T04:52:56.000Z
2018-09-07T04:53:07.000Z
lib/oauth2/response.ex
stephenmoloney/oauth2
4a1b2441700f34a54bb4446a36415b71217086d5
[ "MIT" ]
1
2020-02-07T15:27:26.000Z
2020-02-07T15:27:26.000Z
defmodule OAuth2.Response do @moduledoc """ Defines the `OAuth2.Response` struct which is created from the HTTP responses made by the `OAuth2.Client` module. ## Struct fields * `status_code` - HTTP response status code * `headers` - HTTP response headers * `body` - Parsed HTTP response body (based on "content-type" header) """ require Logger import OAuth2.Util alias OAuth2.Serializer @type status_code :: integer @type headers :: list @type body :: binary | map @type t :: %__MODULE__{ status_code: status_code, headers: headers, body: body } defstruct status_code: nil, headers: [], body: nil @doc false def new(code, headers, body) do headers = process_headers(headers) body = decode_response_body(body, content_type(headers)) resp = %__MODULE__{status_code: code, headers: headers, body: body} if Application.get_env(:oauth2, :debug) do Logger.debug("OAuth2 Provider Response #{inspect resp}") end resp end defp process_headers(headers) do Enum.map(headers, fn {k, v} -> {String.downcase(k), v} end) end defp decode_response_body("", _type), do: "" defp decode_response_body(" ", _type), do: "" # Facebook sends text/plain tokens!? defp decode_response_body(body, "text/plain") do case URI.decode_query(body) do %{"access_token" => _} = token -> token _ -> body end end defp decode_response_body(body, "application/x-www-form-urlencoded"), do: URI.decode_query(body) defp decode_response_body(body, type), do: Serializer.decode!(body, type) end
27.135593
79
0.678326
03533d73d7fd702d7d5b258943be186a9888fbe0
92
ex
Elixir
test/support/web/views/broadcast5_view.ex
Gamecode-HQ/drab
dfbe73c0675831f42829f0f3f7fe12d47a78badc
[ "MIT" ]
933
2017-01-14T13:47:37.000Z
2022-03-21T18:14:41.000Z
test/support/web/views/broadcast5_view.ex
Gamecode-HQ/drab
dfbe73c0675831f42829f0f3f7fe12d47a78badc
[ "MIT" ]
189
2017-01-15T18:35:06.000Z
2022-01-24T17:41:22.000Z
test/support/web/views/broadcast5_view.ex
Gamecode-HQ/drab
dfbe73c0675831f42829f0f3f7fe12d47a78badc
[ "MIT" ]
54
2017-01-15T18:10:48.000Z
2021-02-06T17:21:44.000Z
defmodule DrabTestApp.Broadcast5View do @moduledoc false use DrabTestApp.Web, :view end
18.4
39
0.804348
0353551110cbc7c4d9d864f783b087f2b6678c68
1,736
ex
Elixir
clients/classroom/lib/google_api/classroom/v1/model/course_material_set.ex
GoNZooo/elixir-google-api
cf3ad7392921177f68091f3d9001f1b01b92f1cc
[ "Apache-2.0" ]
null
null
null
clients/classroom/lib/google_api/classroom/v1/model/course_material_set.ex
GoNZooo/elixir-google-api
cf3ad7392921177f68091f3d9001f1b01b92f1cc
[ "Apache-2.0" ]
null
null
null
clients/classroom/lib/google_api/classroom/v1/model/course_material_set.ex
GoNZooo/elixir-google-api
cf3ad7392921177f68091f3d9001f1b01b92f1cc
[ "Apache-2.0" ]
1
2018-07-28T20:50:50.000Z
2018-07-28T20:50:50.000Z
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an &quot;AS IS&quot; BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This class is auto generated by the swagger code generator program. # https://github.com/swagger-api/swagger-codegen.git # Do not edit the class manually. defmodule GoogleApi.Classroom.V1.Model.CourseMaterialSet do @moduledoc """ A set of materials that appears on the \&quot;About\&quot; page of the course. These materials might include a syllabus, schedule, or other background information relating to the course as a whole. ## Attributes - materials (List[CourseMaterial]): Materials attached to this set. Defaults to: `null`. - title (String): Title for this set. Defaults to: `null`. """ defstruct [ :"materials", :"title" ] end defimpl Poison.Decoder, for: GoogleApi.Classroom.V1.Model.CourseMaterialSet do import GoogleApi.Classroom.V1.Deserializer def decode(value, options) do value |> deserialize(:"materials", :list, GoogleApi.Classroom.V1.Model.CourseMaterial, options) end end defimpl Poison.Encoder, for: GoogleApi.Classroom.V1.Model.CourseMaterialSet do def encode(value, options) do GoogleApi.Classroom.V1.Deserializer.serialize_non_nil(value, options) end end
34.72
199
0.753456
03535b1641351cdd80d580060a9f9406a685b4d3
7,543
exs
Elixir
test/cadet/jobs/autograder/lambda_worker_test.exs
chownces/cadet
0d8b264e4fad1c9aaab7ef3f037ac4e07a4c9b22
[ "Apache-2.0" ]
null
null
null
test/cadet/jobs/autograder/lambda_worker_test.exs
chownces/cadet
0d8b264e4fad1c9aaab7ef3f037ac4e07a4c9b22
[ "Apache-2.0" ]
10
2022-02-24T17:57:38.000Z
2022-03-31T07:43:05.000Z
test/cadet/jobs/autograder/lambda_worker_test.exs
chownces/cadet
0d8b264e4fad1c9aaab7ef3f037ac4e07a4c9b22
[ "Apache-2.0" ]
1
2019-07-17T15:51:58.000Z
2019-07-17T15:51:58.000Z
defmodule Cadet.Autograder.LambdaWorkerTest do use Cadet.DataCase use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney import Mock import ExUnit.CaptureLog alias Cadet.Assessments.{Answer, Question} alias Cadet.Autograder.{LambdaWorker, ResultStoreWorker} setup_all do # This essentially does :application.ensure_all_started(:hackney) HTTPoison.start() end setup do question = insert( :programming_question, %{ question: build(:programming_question_content, %{ public: [ %{"score" => 1, "answer" => "1", "program" => "f(1);"} ], private: [ %{"score" => 1, "answer" => "45", "program" => "f(10);"} ] }) } ) submission = insert(:submission, %{ student: insert(:user, %{role: :student}), assessment: question.assessment }) answer = insert(:answer, %{ submission: submission, question: question, answer: %{code: "const f = i => i === 0 ? 0 : i < 3 ? 1 : f(i-1) + f(i-2);"} }) %{question: question, answer: answer} end describe "#perform" do test "success", %{question: question, answer: answer} do use_cassette "autograder/success#1", custom: true do with_mock Que, add: fn _, _ -> nil end do LambdaWorker.perform(%{ question: Repo.get(Question, question.id), answer: Repo.get(Answer, answer.id) }) assert_called( Que.add(ResultStoreWorker, %{ answer_id: answer.id, result: %{ result: [ %{"resultType" => "pass", "score" => 1}, %{"resultType" => "pass", "score" => 1} ], grade: 2, status: :success } }) ) end end end test "submission errors", %{question: question, answer: answer} do use_cassette "autograder/errors#1", custom: true do with_mock Que, add: fn _, _ -> nil end do LambdaWorker.perform(%{ question: Repo.get(Question, question.id), answer: Repo.get(Answer, answer.id) }) assert_called( Que.add(ResultStoreWorker, %{ answer_id: answer.id, result: %{ result: [ %{ "resultType" => "error", "errors" => [ %{ "errorType" => "syntax", "line" => 1, "location" => "student", "errorLine" => "consst f = i => i === 0 ? 0 : i < 3 ? 1 : f(i-1) + f(i-2);", "errorExplanation" => "SyntaxError: Unexpected token (2:7)" } ] }, %{ "resultType" => "error", "errors" => [ %{ "errorType" => "syntax", "line" => 1, "location" => "student", "errorLine" => "consst f = i => i === 0 ? 0 : i < 3 ? 1 : f(i-1) + f(i-2);", "errorExplanation" => "SyntaxError: Unexpected token (2:7)" } ] } ], grade: 0, status: :success } }) ) end end end test "lambda errors", %{question: question, answer: answer} do use_cassette "autograder/errors#2", custom: true do with_mock Que, add: fn _, _ -> nil end do LambdaWorker.perform(%{ question: Repo.get(Question, question.id), answer: Repo.get(Answer, answer.id) }) assert_called( Que.add(ResultStoreWorker, %{ answer_id: answer.id, result: %{ grade: 0, status: :failed, result: [ %{ "resultType" => "error", "errors" => [ %{ "errorType" => "systemError", "errorMessage" => "2019-05-18T05:26:11.299Z 21606396-02e0-4fd5-a294-963bb7994e75 Task timed out after 10.01 seconds" } ] } ] } }) ) end end end test "should not run with no testcases", %{answer: answer} do question = insert( :programming_question, %{ question: build(:programming_question_content, %{ public: [], private: [] }) } ) log = capture_log(fn -> LambdaWorker.perform(%{ question: Repo.get(Question, question.id), answer: Repo.get(Answer, answer.id) }) end) assert log =~ "No testcases found. Skipping autograding for answer_id: #{answer.id}" end end describe "on_failure" do test "it stores error message", %{question: question, answer: answer} do with_mock Que, add: fn _, _ -> nil end do error = %{"errorMessage" => "Task timed out after 1.00 seconds"} log = capture_log(fn -> LambdaWorker.on_failure( %{question: question, answer: answer}, inspect(error) ) end) assert log =~ "Failed to get autograder result." assert log =~ "answer_id: #{answer.id}" assert log =~ "Task timed out after 1.00 seconds" assert_called( Que.add( ResultStoreWorker, %{ answer_id: answer.id, result: %{ grade: 0, status: :failed, result: [ %{ "resultType" => "error", "errors" => [ %{ "errorType" => "systemError", "errorMessage" => "Autograder runtime error. Please contact a system administrator" } ] } ] } } ) ) end end end describe "#build_request_params" do test "it should build correct params", %{question: question, answer: answer} do expected = %{ prependProgram: question.question.prepend, postpendProgram: question.question.postpend, testcases: question.question.public ++ question.question.private, studentProgram: answer.answer.code, library: %{ chapter: question.grading_library.chapter, external: %{ name: question.grading_library.external.name |> String.upcase(), symbols: question.grading_library.external.symbols }, globals: Enum.map(question.grading_library.globals, fn {k, v} -> [k, v] end) } } assert LambdaWorker.build_request_params(%{ question: Repo.get(Question, question.id), answer: Repo.get(Answer, answer.id) }) == expected end end end
30.051793
124
0.442132
03537d128544b1c3575e90c7154cd43a5ed055c9
840
exs
Elixir
priv/repo/migrations/20190226213046_article_full_text_search.exs
ruhlio/athel
c06a317f38ef7fa28dcb8b1f23889a01c4aa6538
[ "Apache-2.0" ]
14
2016-09-12T02:45:12.000Z
2021-02-08T04:13:29.000Z
priv/repo/migrations/20190226213046_article_full_text_search.exs
ruhlio/athel
c06a317f38ef7fa28dcb8b1f23889a01c4aa6538
[ "Apache-2.0" ]
3
2016-09-12T05:17:35.000Z
2016-09-14T16:35:04.000Z
priv/repo/migrations/20190226213046_article_full_text_search.exs
ruhlio/athel
c06a317f38ef7fa28dcb8b1f23889a01c4aa6538
[ "Apache-2.0" ]
1
2018-02-12T04:30:52.000Z
2018-02-12T04:30:52.000Z
defmodule Athel.Repo.Migrations.ArticleFullTextSearch do use Ecto.Migration def up do alter table(:articles) do add :language, :string, null: false, default: "english" end execute """ CREATE MATERIALIZED VIEW article_search_index AS SELECT message_id, parent_message_id, "from", subject, date, status, language, setweight(to_tsvector(language::regconfig, subject), 'A') || setweight(to_tsvector(language::regconfig, body), 'B') AS document FROM articles """ execute "CREATE INDEX index_search_articles ON article_search_index USING GIN(document)" end def down do execute "DROP INDEX index_search_articles" execute "DROP MATERIALIZED VIEW article_search_index" alter table(:articles) do remove :language end end end
25.454545
136
0.684524
0353cd05c9ff032ab3d831d56634620e15dd2737
1,137
exs
Elixir
config/config.exs
Byzanteam-Labs/arc_aliyun_oss
a633d0c386e8af7c09ef65a8851b668a1fa3cd8d
[ "MIT" ]
null
null
null
config/config.exs
Byzanteam-Labs/arc_aliyun_oss
a633d0c386e8af7c09ef65a8851b668a1fa3cd8d
[ "MIT" ]
null
null
null
config/config.exs
Byzanteam-Labs/arc_aliyun_oss
a633d0c386e8af7c09ef65a8851b668a1fa3cd8d
[ "MIT" ]
1
2019-01-18T05:35:37.000Z
2019-01-18T05:35:37.000Z
# This file is responsible for configuring your application # and its dependencies with the aid of the Mix.Config module. use Mix.Config # This configuration is loaded before any dependency and is restricted # to this project. If another project depends on this project, this # file won't be loaded nor affect the parent project. For this reason, # if you want to provide default values for your application for # 3rd-party users, it should be done in your "mix.exs" file. # You can configure your application as: # # config :arc_aliyun_oss, key: :value # # and access this configuration in your application as: # # Application.get_env(:arc_aliyun_oss, :key) # # You can also configure a 3rd-party app: # # config :logger, level: :info # # It is also possible to import configuration files, relative to this # directory. For example, you can emulate configuration per environment # by uncommenting the line below and defining dev.exs, test.exs and such. # Configuration from the imported file will override the ones defined # here (which is why it is important to import them last). # # import_config "#{Mix.env}.exs"
36.677419
73
0.754617
0353dbf40d2f60f378e6d0da6f918344c56e82f9
59
ex
Elixir
examples/example-phx-1_2/web/views/page_view.ex
devshane/thesis-phoenix
afe22a25542f91e15cfffb1e93ff8d833a64c25b
[ "MIT" ]
681
2016-06-21T20:49:21.000Z
2022-02-19T04:08:38.000Z
examples/example-phx-1_2/web/views/page_view.ex
devshane/thesis-phoenix
afe22a25542f91e15cfffb1e93ff8d833a64c25b
[ "MIT" ]
125
2016-06-21T21:14:49.000Z
2020-12-12T20:15:48.000Z
examples/example-phx-1_2/web/views/page_view.ex
devshane/thesis-phoenix
afe22a25542f91e15cfffb1e93ff8d833a64c25b
[ "MIT" ]
76
2016-09-06T03:40:55.000Z
2022-01-20T21:29:22.000Z
defmodule Example.PageView do use Example.Web, :view end
14.75
29
0.779661
0353e269195c3e01a00a12aee98568921a66b4cb
888
ex
Elixir
debian/prerm.ex
qiuzhiqian/wallpaper
9bb347acb78d583336d127016c7da96164d8fa7e
[ "MIT" ]
9
2020-03-04T02:42:12.000Z
2021-11-17T08:23:58.000Z
debian/prerm.ex
qiuzhiqian/wallpaper
9bb347acb78d583336d127016c7da96164d8fa7e
[ "MIT" ]
null
null
null
debian/prerm.ex
qiuzhiqian/wallpaper
9bb347acb78d583336d127016c7da96164d8fa7e
[ "MIT" ]
null
null
null
#!/bin/sh # prerm script for wallpaper-toolbox # # see: dh_installdeb(1) set -e # summary of how this script can be called: # * <prerm> `remove' # * <old-prerm> `upgrade' <new-version> # * <new-prerm> `failed-upgrade' <old-version> # * <conflictor's-prerm> `remove' `in-favour' <package> <new-version> # * <deconfigured's-prerm> `deconfigure' `in-favour' # <package-being-installed> <version> `removing' # <conflicting-package> <version> # for details, see https://www.debian.org/doc/debian-policy/ or # the debian-policy package case "$1" in remove|upgrade|deconfigure) ;; failed-upgrade) ;; *) echo "prerm called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0
22.769231
76
0.629505
03541825b9454fa3b61041ffcc09bc420dc9a113
1,885
exs
Elixir
test/commodity_api/iam/user/address/invalidation/invalidation_test.exs
akdilsiz/commodity-cloud
08c366c9fc95fbb3565131672db4cc52f8b870c9
[ "Apache-2.0" ]
7
2019-04-11T21:12:49.000Z
2021-04-14T12:56:42.000Z
test/commodity_api/iam/user/address/invalidation/invalidation_test.exs
akdilsiz/commodity-cloud
08c366c9fc95fbb3565131672db4cc52f8b870c9
[ "Apache-2.0" ]
null
null
null
test/commodity_api/iam/user/address/invalidation/invalidation_test.exs
akdilsiz/commodity-cloud
08c366c9fc95fbb3565131672db4cc52f8b870c9
[ "Apache-2.0" ]
2
2019-06-06T18:05:33.000Z
2019-07-16T08:49:45.000Z
## # Copyright 2018 Abdulkadir DILSIZ # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ## defmodule Commodity.Api.Iam.User.Address.InvalidationTest do use Commodity.DataCase alias Commodity.Api.Iam.User.Address.Invalidation alias Commodity.Factory test "changeset with valid params" do changeset = Invalidation.changeset(%Invalidation{}, %{address_id: 1, source_user_id: 1}) assert changeset.valid? end test "changeset with invalid params" do changeset = Invalidation.changeset(%Invalidation{}, %{address_id: "id", source_user_id: "id"}) refute changeset.valid? end test "changeset without address_id param" do changeset = Invalidation.changeset(%Invalidation{}, %{source_user_id: 1}) refute changeset.valid? end test "changeset without source_user_id param" do changeset = Invalidation.changeset(%Invalidation{}, %{address_id: 1}) refute changeset.valid? end test "changeset with invalid address_id param if not unique" do address = Factory.insert(:user_address) Factory.insert(:user_address_invalidation, address: address) changeset = Invalidation.changeset(%Invalidation{}, %{address_id: address.id, source_user_id: address.user.id}) assert {:error, changeset} = Repo.insert(changeset) refute changeset.valid? assert ["has already been taken"] == errors_on(changeset).address_id end end
30.403226
77
0.744828
035438825ba00bb12fb31d2ce6d9e253e0cee17c
3,755
ex
Elixir
lib/cadet/accounts/accounts.ex
geshuming/cadet
783cc84173b8f4b504db3d3b1ca91037d51b5c8e
[ "MIT" ]
null
null
null
lib/cadet/accounts/accounts.ex
geshuming/cadet
783cc84173b8f4b504db3d3b1ca91037d51b5c8e
[ "MIT" ]
null
null
null
lib/cadet/accounts/accounts.ex
geshuming/cadet
783cc84173b8f4b504db3d3b1ca91037d51b5c8e
[ "MIT" ]
null
null
null
defmodule Cadet.Accounts do @moduledoc """ Accounts context contains domain logic for User management and Authentication """ use Cadet, :context import Ecto.Query alias Cadet.Accounts.Form.Registration alias Cadet.Accounts.{Authorization, Luminus, Query, User} @doc """ Register new User entity using Cadet.Accounts.Form.Registration Returns {:ok, user} on success, otherwise {:error, changeset} """ def register(attrs = %{nusnet_id: nusnet_id}, role) when is_binary(nusnet_id) do changeset = Registration.changeset(%Registration{}, attrs) if changeset.valid? do registration = apply_changes(changeset) Repo.transaction(fn -> attrs_with_role = Map.put(attrs, :role, role) {:ok, user} = insert_or_update_user(attrs_with_role) {:ok, _} = create_authorization( %{ provider: :nusnet_id, uid: registration.nusnet_id }, user ) user end) else {:error, changeset} end end @doc """ Creates Authorization entity with specified attributes. """ def create_authorization(attrs = %{}, user = %User{}) do %Authorization{} |> Authorization.changeset(attrs) |> put_assoc(:user, user) |> Repo.insert() end @doc """ Creates User entity with specified attributes. """ def create_user(attrs \\ %{}) do %User{} |> User.changeset(attrs) |> Repo.insert() end @doc """ Updates User entity with specified attributes. If the User does not exist yet, create one. """ @spec insert_or_update_user(map()) :: {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()} def insert_or_update_user(attrs = %{nusnet_id: nusnet_id}) when is_binary(nusnet_id) do User |> where(nusnet_id: ^nusnet_id) |> Repo.one() |> case do nil -> User.changeset(%User{}, attrs) user -> User.changeset(user, attrs) end |> Repo.insert_or_update() end @doc """ Get the User entity with specified primary key. """ def get_user(id) when is_ecto_id(id) do Repo.get(User, id) end @doc """ Associate NUSTNET_ID with an existing `%User{}` """ def add_nusnet_id(user = %User{}, nusnet_id) do changeset = %Authorization{} |> Authorization.changeset(%{ provider: :nusnet_id, uid: nusnet_id }) |> put_assoc(:user, user) Repo.insert(changeset) end @doc """ Associate a NUSNET_ID to an existing `%User{}` """ def set_nusnet_id(user = %User{}, nusnet_id) do Repo.transaction(fn -> authorizations = Repo.all(Query.user_nusnet_ids(user.id)) for authorization <- authorizations do authorization |> change(%{nusnet_id: nusnet_id}) |> Repo.update!() end end) end @doc """ Sign in using given NUSNET_ID """ def sign_in(nusnet_id, name, token) do auth = Repo.one(Query.nusnet_id(nusnet_id)) if auth do auth = Repo.preload(auth, :user) {:ok, auth.user} else # user is not registered in our database with {:ok, role} <- Luminus.fetch_role(token), {:ok, _} <- register(%{name: name, nusnet_id: nusnet_id}, role) do sign_in(nusnet_id, name, token) else {:error, :forbidden} -> # Luminus.fetch_role/1 responds with :forbidden if student does not read CS1101S {:error, :forbidden} {:error, :bad_request} -> # Luminus.fetch_role/1 responds with :bad_request if token is invalid {:error, :bad_request} {:error, _} -> # register/2 returns {:error, changeset} if changeset is invalid {:error, :internal_server_error} end end end end
25.371622
93
0.613049
035459273a52fd0e987cf93b76fdf378289aa187
1,475
ex
Elixir
lib/stubbex_web/views/error_helpers.ex
yawaramin/stubbex
5de6a0b5a7fd05229278673a032f59b6bb4aa06f
[ "MIT" ]
9
2018-10-24T22:56:46.000Z
2020-07-15T20:34:50.000Z
lib/stubbex_web/views/error_helpers.ex
yawaramin/stubbex
5de6a0b5a7fd05229278673a032f59b6bb4aa06f
[ "MIT" ]
10
2018-10-21T02:01:21.000Z
2019-11-14T17:03:32.000Z
lib/stubbex_web/views/error_helpers.ex
yawaramin/stubbex
5de6a0b5a7fd05229278673a032f59b6bb4aa06f
[ "MIT" ]
1
2018-11-12T12:51:19.000Z
2018-11-12T12:51:19.000Z
defmodule StubbexWeb.ErrorHelpers do @moduledoc """ Conveniences for translating and building error messages. """ use Phoenix.HTML @doc """ Generates tag for inlined form input errors. """ def error_tag(form, field) do Enum.map(Keyword.get_values(form.errors, field), fn error -> content_tag(:span, translate_error(error), class: "help-block") end) end @doc """ Translates an error message using gettext. """ def translate_error({msg, opts}) do # When using gettext, we typically pass the strings we want # to translate as a static argument: # # # Translate "is invalid" in the "errors" domain # dgettext "errors", "is invalid" # # # Translate the number of files with plural rules # dngettext "errors", "1 file", "%{count} files", count # # Because the error messages we show in our forms and APIs # are defined inside Ecto, we need to translate them dynamically. # This requires us to call the Gettext module passing our gettext # backend as first argument. # # Note we use the "errors" domain, which means translations # should be written to the errors.po file. The :count option is # set by Ecto and indicates we should also apply plural rules. if count = opts[:count] do Gettext.dngettext(StubbexWeb.Gettext, "errors", msg, msg, count, opts) else Gettext.dgettext(StubbexWeb.Gettext, "errors", msg, opts) end end end
32.777778
76
0.671186
0354617909d31d1306fa78f43f6e248c0bcfd2dd
1,908
exs
Elixir
clients/admin/mix.exs
kyleVsteger/elixir-google-api
3a0dd498af066a4361b5b0fd66ffc04a57539488
[ "Apache-2.0" ]
null
null
null
clients/admin/mix.exs
kyleVsteger/elixir-google-api
3a0dd498af066a4361b5b0fd66ffc04a57539488
[ "Apache-2.0" ]
null
null
null
clients/admin/mix.exs
kyleVsteger/elixir-google-api
3a0dd498af066a4361b5b0fd66ffc04a57539488
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.Admin.Mixfile do use Mix.Project @version "0.33.1" def project() do [ app: :google_api_admin, version: @version, elixir: "~> 1.6", build_embedded: Mix.env == :prod, start_permanent: Mix.env == :prod, description: description(), package: package(), deps: deps(), source_url: "https://github.com/googleapis/elixir-google-api/tree/master/clients/admin" ] end def application() do [extra_applications: [:logger]] end defp deps() do [ {:google_gax, "~> 0.4"}, {:ex_doc, "~> 0.16", only: :dev} ] end defp description() do """ Admin SDK API client library. Admin SDK lets administrators of enterprise domains to view and manage resources like user, groups etc. It also provides audit and usage reports of domain. """ end defp package() do [ files: ["lib", "mix.exs", "README*", "LICENSE"], maintainers: ["Jeff Ching", "Daniel Azuma"], licenses: ["Apache 2.0"], links: %{ "GitHub" => "https://github.com/googleapis/elixir-google-api/tree/master/clients/admin", "Homepage" => "http://developers.google.com/admin-sdk/" } ] end end
28.477612
189
0.658805
03549dd3e41a6557413c0ace3c7fddd4d5db67c1
551
ex
Elixir
metaprogramming/controlflow.ex
hectorip/ErlangExercises
4a1aa5de0504da1bfe5a6c31c1d20277524ab363
[ "MIT" ]
4
2016-09-22T03:47:56.000Z
2017-02-02T17:42:57.000Z
metaprogramming/controlflow.ex
hectorip/ErlangExercises
4a1aa5de0504da1bfe5a6c31c1d20277524ab363
[ "MIT" ]
null
null
null
metaprogramming/controlflow.ex
hectorip/ErlangExercises
4a1aa5de0504da1bfe5a6c31c1d20277524ab363
[ "MIT" ]
null
null
null
# 'quote' and 'unquote' are like string interpolation in AST # 'unquote' is like delaying code execution and injecting the # values from the external context into an AST # 'quote' is requesting the internal representation of the code # inside the do clause defmodule ControlFlow do defmacro unless(expression, do: block) do quote do if !unquote(expression), do: unquote(block) end end end defmodule UsingUnless do require ControlFlow def try_unless do ControlFlow.unless false do IO.puts("works") end end end
22.958333
63
0.731397
0354a6521d3e2dce0b7657f97b325023212750ad
3,973
ex
Elixir
lib/ring_logger/server.ex
se-apc/ring_logger
3b5c59dbfd985e7c1d1aab9fe8ec11e7dbd5dccf
[ "Apache-2.0" ]
null
null
null
lib/ring_logger/server.ex
se-apc/ring_logger
3b5c59dbfd985e7c1d1aab9fe8ec11e7dbd5dccf
[ "Apache-2.0" ]
1
2019-01-09T21:42:35.000Z
2019-01-09T21:42:35.000Z
lib/ring_logger/server.ex
se-apc/ring_logger
3b5c59dbfd985e7c1d1aab9fe8ec11e7dbd5dccf
[ "Apache-2.0" ]
null
null
null
defmodule RingLogger.Server do use GenServer alias RingLogger.Client @opts [:max_size, :module_levels] defmodule State do @moduledoc false @default_max_size 100 defstruct clients: [], buffer: :queue.new(), size: 0, max_size: @default_max_size, index: 0, module_levels: nil end def start_link(opts \\ []) do GenServer.start_link(__MODULE__, opts, name: __MODULE__) end def stop() do GenServer.stop(__MODULE__) end def configure(opts) do GenServer.call(__MODULE__, {:configure, opts}) end def attach_client(client_pid) do GenServer.call(__MODULE__, {:attach, client_pid}) end def detach_client(client_pid) do GenServer.call(__MODULE__, {:detach, client_pid}) end @spec get(non_neg_integer()) :: [RingLogger.entry()] def get(start_index \\ 0) do GenServer.call(__MODULE__, {:get, start_index}) end def log({level, {Logger, _, _, md}} = msg, module_levels) do module = md[:module] if RingLogger.Configuration.meet_level?(module_levels, module, level) do GenServer.cast(__MODULE__, {:log, msg}) end end def init(opts) do {:ok, merge_opts(opts, %State{})} end def handle_call({:configure, opts}, _from, state) do state = merge_opts(opts, state) {:reply, state.module_levels, state} end def handle_call({:attach, client_pid}, _from, state) do {:reply, :ok, attach_client(client_pid, state)} end def handle_call({:detach, pid}, _from, state) do {:reply, :ok, detach_client(pid, state)} end def handle_call({:get, start_index}, _from, state) do resp = cond do start_index <= state.index -> :queue.to_list(state.buffer) start_index >= state.index + state.size -> [] true -> {_, buffer_range} = :queue.split(start_index - state.index, state.buffer) :queue.to_list(buffer_range) end {:reply, resp, state} end def handle_cast({:log, msg}, state) do {:noreply, push(msg, state)} end def handle_info({:DOWN, _ref, _, pid, _reason}, state) do {:noreply, detach_client(pid, state)} end def terminate(_reason, state) do Enum.each(state.clients, fn {client_pid, _ref} -> Client.stop(client_pid) end) :ok end defp attach_client(client_pid, state) do if !client_info(client_pid, state) do ref = Process.monitor(client_pid) %{state | clients: [{client_pid, ref} | state.clients]} else state end end defp detach_client(client_pid, state) do case client_info(client_pid, state) do {_client_pid, ref} -> Process.demonitor(ref) remaining_clients = List.keydelete(state.clients, client_pid, 0) %{state | clients: remaining_clients} nil -> state end end defp client_info(client_pid, state) do List.keyfind(state.clients, client_pid, 0) end defp merge_opts(opts, state) do opts = opts |> Keyword.take(@opts) |> Enum.into(%{}) state |> Map.merge(opts) |> trim end defp trim(%{max_size: max_size, size: size, buffer: buffer} = state) when size > max_size do trim = max_size - size buffer = Enum.reduce(1..trim, buffer, fn _, buf -> :queue.drop(buf) end) %{state | buffer: buffer, size: size} end defp trim(state), do: state defp push({level, {mod, msg, ts, md}}, state) do index = state.index + state.size msg = {level, {mod, msg, ts, Keyword.put(md, :index, index)}} state = if state.size == state.max_size do buffer = :queue.drop(state.buffer) %{state | buffer: buffer, index: state.index + 1} else %{state | size: state.size + 1} end Enum.each(state.clients, &send_log(&1, msg)) %{state | buffer: :queue.in(msg, state.buffer)} end defp send_log({client_pid, _ref}, msg) do send(client_pid, {:log, msg}) end end
23.508876
83
0.623458
0354bfdbdf793a48a1c0433407e9cc962e7e1198
689
exs
Elixir
test/store_test.exs
jerodsanto/plug_ets_cache
3fdcf2652a8e5b9d78dc572aec6345b5755355e4
[ "MIT" ]
null
null
null
test/store_test.exs
jerodsanto/plug_ets_cache
3fdcf2652a8e5b9d78dc572aec6345b5755355e4
[ "MIT" ]
null
null
null
test/store_test.exs
jerodsanto/plug_ets_cache
3fdcf2652a8e5b9d78dc572aec6345b5755355e4
[ "MIT" ]
null
null
null
defmodule PlugEtsCache.StoreTest do use ExUnit.Case, async: true test "sets and gets values from cache" do conn = %Plug.Conn{request_path: "/test", query_string: ""} PlugEtsCache.Store.set(conn, "text/plain", "Hello cache") cache = PlugEtsCache.Store.get(conn) assert cache.value == "Hello cache" assert cache.type == "text/plain" end test "sets and gets values from cache with ttl provided" do conn = %Plug.Conn{request_path: "/test", query_string: ""} PlugEtsCache.Store.set(conn, "text/plain", "Hello cache", 1000) cache = PlugEtsCache.Store.get(conn) assert cache.value == "Hello cache" assert cache.type == "text/plain" end end
28.708333
67
0.682148
0354fbd46b956e73ffbf1b243b62416a15964da1
25,950
ex
Elixir
clients/compute/lib/google_api/compute/v1/api/target_https_proxies.ex
mocknen/elixir-google-api
dac4877b5da2694eca6a0b07b3bd0e179e5f3b70
[ "Apache-2.0" ]
null
null
null
clients/compute/lib/google_api/compute/v1/api/target_https_proxies.ex
mocknen/elixir-google-api
dac4877b5da2694eca6a0b07b3bd0e179e5f3b70
[ "Apache-2.0" ]
null
null
null
clients/compute/lib/google_api/compute/v1/api/target_https_proxies.ex
mocknen/elixir-google-api
dac4877b5da2694eca6a0b07b3bd0e179e5f3b70
[ "Apache-2.0" ]
null
null
null
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an &quot;AS IS&quot; BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This class is auto generated by the swagger code generator program. # https://github.com/swagger-api/swagger-codegen.git # Do not edit the class manually. defmodule GoogleApi.Compute.V1.Api.TargetHttpsProxies do @moduledoc """ API calls for all endpoints tagged `TargetHttpsProxies`. """ alias GoogleApi.Compute.V1.Connection alias GoogleApi.Gax.{Request, Response} @doc """ Deletes the specified TargetHttpsProxy resource. ## Parameters - connection (GoogleApi.Compute.V1.Connection): Connection to server - project (String.t): Project ID for this request. - target_https_proxy (String.t): Name of the TargetHttpsProxy resource to delete. - optional_params (KeywordList): [optional] Optional parameters - :alt (String.t): Data format for the response. - :fields (String.t): Selector specifying which fields to include in a partial response. - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - :oauth_token (String.t): OAuth 2.0 token for the current user. - :prettyPrint (boolean()): Returns response with indentations and line breaks. - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - :userIp (String.t): Deprecated. Please use quotaUser instead. - :requestId (String.t): An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). ## Returns {:ok, %GoogleApi.Compute.V1.Model.Operation{}} on success {:error, info} on failure """ @spec compute_target_https_proxies_delete(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, GoogleApi.Compute.V1.Model.Operation.t()} | {:error, Tesla.Env.t()} def compute_target_https_proxies_delete( connection, project, target_https_proxy, optional_params \\ [], opts \\ [] ) do optional_params_config = %{ :alt => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :userIp => :query, :requestId => :query } request = Request.new() |> Request.method(:delete) |> Request.url("/{project}/global/targetHttpsProxies/{targetHttpsProxy}", %{ "project" => URI.encode_www_form(project), "targetHttpsProxy" => URI.encode_www_form(target_https_proxy) }) |> Request.add_optional_params(optional_params_config, optional_params) connection |> Connection.execute(request) |> Response.decode(opts ++ [struct: %GoogleApi.Compute.V1.Model.Operation{}]) end @doc """ Returns the specified TargetHttpsProxy resource. Gets a list of available target HTTPS proxies by making a list() request. ## Parameters - connection (GoogleApi.Compute.V1.Connection): Connection to server - project (String.t): Project ID for this request. - target_https_proxy (String.t): Name of the TargetHttpsProxy resource to return. - optional_params (KeywordList): [optional] Optional parameters - :alt (String.t): Data format for the response. - :fields (String.t): Selector specifying which fields to include in a partial response. - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - :oauth_token (String.t): OAuth 2.0 token for the current user. - :prettyPrint (boolean()): Returns response with indentations and line breaks. - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - :userIp (String.t): Deprecated. Please use quotaUser instead. ## Returns {:ok, %GoogleApi.Compute.V1.Model.TargetHttpsProxy{}} on success {:error, info} on failure """ @spec compute_target_https_proxies_get(Tesla.Env.client(), String.t(), String.t(), keyword()) :: {:ok, GoogleApi.Compute.V1.Model.TargetHttpsProxy.t()} | {:error, Tesla.Env.t()} def compute_target_https_proxies_get( connection, project, target_https_proxy, optional_params \\ [], opts \\ [] ) do optional_params_config = %{ :alt => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :userIp => :query } request = Request.new() |> Request.method(:get) |> Request.url("/{project}/global/targetHttpsProxies/{targetHttpsProxy}", %{ "project" => URI.encode_www_form(project), "targetHttpsProxy" => URI.encode_www_form(target_https_proxy) }) |> Request.add_optional_params(optional_params_config, optional_params) connection |> Connection.execute(request) |> Response.decode(opts ++ [struct: %GoogleApi.Compute.V1.Model.TargetHttpsProxy{}]) end @doc """ Creates a TargetHttpsProxy resource in the specified project using the data included in the request. ## Parameters - connection (GoogleApi.Compute.V1.Connection): Connection to server - project (String.t): Project ID for this request. - optional_params (KeywordList): [optional] Optional parameters - :alt (String.t): Data format for the response. - :fields (String.t): Selector specifying which fields to include in a partial response. - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - :oauth_token (String.t): OAuth 2.0 token for the current user. - :prettyPrint (boolean()): Returns response with indentations and line breaks. - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - :userIp (String.t): Deprecated. Please use quotaUser instead. - :requestId (String.t): An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - :body (TargetHttpsProxy): ## Returns {:ok, %GoogleApi.Compute.V1.Model.Operation{}} on success {:error, info} on failure """ @spec compute_target_https_proxies_insert(Tesla.Env.client(), String.t(), keyword()) :: {:ok, GoogleApi.Compute.V1.Model.Operation.t()} | {:error, Tesla.Env.t()} def compute_target_https_proxies_insert(connection, project, optional_params \\ [], opts \\ []) do optional_params_config = %{ :alt => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :userIp => :query, :requestId => :query, :body => :body } request = Request.new() |> Request.method(:post) |> Request.url("/{project}/global/targetHttpsProxies", %{ "project" => URI.encode_www_form(project) }) |> Request.add_optional_params(optional_params_config, optional_params) connection |> Connection.execute(request) |> Response.decode(opts ++ [struct: %GoogleApi.Compute.V1.Model.Operation{}]) end @doc """ Retrieves the list of TargetHttpsProxy resources available to the specified project. ## Parameters - connection (GoogleApi.Compute.V1.Connection): Connection to server - project (String.t): Project ID for this request. - optional_params (KeywordList): [optional] Optional parameters - :alt (String.t): Data format for the response. - :fields (String.t): Selector specifying which fields to include in a partial response. - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - :oauth_token (String.t): OAuth 2.0 token for the current user. - :prettyPrint (boolean()): Returns response with indentations and line breaks. - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - :userIp (String.t): Deprecated. Please use quotaUser instead. - :filter (String.t): A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either &#x3D;, !&#x3D;, &gt;, or &lt;. For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name !&#x3D; example-instance. You can also filter nested fields. For example, you could specify scheduling.automaticRestart &#x3D; false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart &#x3D; true) (cpuPlatform &#x3D; \&quot;Intel Skylake\&quot;). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform &#x3D; \&quot;Intel Skylake\&quot;) OR (cpuPlatform &#x3D; \&quot;Intel Broadwell\&quot;) AND (scheduling.automaticRestart &#x3D; true). - :maxResults (integer()): The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - :orderBy (String.t): Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using orderBy&#x3D;\&quot;creationTimestamp desc\&quot;. This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by name or creationTimestamp desc is supported. - :pageToken (String.t): Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. ## Returns {:ok, %GoogleApi.Compute.V1.Model.TargetHttpsProxyList{}} on success {:error, info} on failure """ @spec compute_target_https_proxies_list(Tesla.Env.client(), String.t(), keyword()) :: {:ok, GoogleApi.Compute.V1.Model.TargetHttpsProxyList.t()} | {:error, Tesla.Env.t()} def compute_target_https_proxies_list(connection, project, optional_params \\ [], opts \\ []) do optional_params_config = %{ :alt => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :userIp => :query, :filter => :query, :maxResults => :query, :orderBy => :query, :pageToken => :query } request = Request.new() |> Request.method(:get) |> Request.url("/{project}/global/targetHttpsProxies", %{ "project" => URI.encode_www_form(project) }) |> Request.add_optional_params(optional_params_config, optional_params) connection |> Connection.execute(request) |> Response.decode(opts ++ [struct: %GoogleApi.Compute.V1.Model.TargetHttpsProxyList{}]) end @doc """ Sets the QUIC override policy for TargetHttpsProxy. ## Parameters - connection (GoogleApi.Compute.V1.Connection): Connection to server - project (String.t): Project ID for this request. - target_https_proxy (String.t): Name of the TargetHttpsProxy resource to set the QUIC override policy for. The name should conform to RFC1035. - optional_params (KeywordList): [optional] Optional parameters - :alt (String.t): Data format for the response. - :fields (String.t): Selector specifying which fields to include in a partial response. - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - :oauth_token (String.t): OAuth 2.0 token for the current user. - :prettyPrint (boolean()): Returns response with indentations and line breaks. - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - :userIp (String.t): Deprecated. Please use quotaUser instead. - :requestId (String.t): An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - :body (TargetHttpsProxiesSetQuicOverrideRequest): ## Returns {:ok, %GoogleApi.Compute.V1.Model.Operation{}} on success {:error, info} on failure """ @spec compute_target_https_proxies_set_quic_override( Tesla.Env.client(), String.t(), String.t(), keyword() ) :: {:ok, GoogleApi.Compute.V1.Model.Operation.t()} | {:error, Tesla.Env.t()} def compute_target_https_proxies_set_quic_override( connection, project, target_https_proxy, optional_params \\ [], opts \\ [] ) do optional_params_config = %{ :alt => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :userIp => :query, :requestId => :query, :body => :body } request = Request.new() |> Request.method(:post) |> Request.url("/{project}/global/targetHttpsProxies/{targetHttpsProxy}/setQuicOverride", %{ "project" => URI.encode_www_form(project), "targetHttpsProxy" => URI.encode_www_form(target_https_proxy) }) |> Request.add_optional_params(optional_params_config, optional_params) connection |> Connection.execute(request) |> Response.decode(opts ++ [struct: %GoogleApi.Compute.V1.Model.Operation{}]) end @doc """ Replaces SslCertificates for TargetHttpsProxy. ## Parameters - connection (GoogleApi.Compute.V1.Connection): Connection to server - project (String.t): Project ID for this request. - target_https_proxy (String.t): Name of the TargetHttpsProxy resource to set an SslCertificates resource for. - optional_params (KeywordList): [optional] Optional parameters - :alt (String.t): Data format for the response. - :fields (String.t): Selector specifying which fields to include in a partial response. - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - :oauth_token (String.t): OAuth 2.0 token for the current user. - :prettyPrint (boolean()): Returns response with indentations and line breaks. - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - :userIp (String.t): Deprecated. Please use quotaUser instead. - :requestId (String.t): An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - :body (TargetHttpsProxiesSetSslCertificatesRequest): ## Returns {:ok, %GoogleApi.Compute.V1.Model.Operation{}} on success {:error, info} on failure """ @spec compute_target_https_proxies_set_ssl_certificates( Tesla.Env.client(), String.t(), String.t(), keyword() ) :: {:ok, GoogleApi.Compute.V1.Model.Operation.t()} | {:error, Tesla.Env.t()} def compute_target_https_proxies_set_ssl_certificates( connection, project, target_https_proxy, optional_params \\ [], opts \\ [] ) do optional_params_config = %{ :alt => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :userIp => :query, :requestId => :query, :body => :body } request = Request.new() |> Request.method(:post) |> Request.url("/{project}/targetHttpsProxies/{targetHttpsProxy}/setSslCertificates", %{ "project" => URI.encode_www_form(project), "targetHttpsProxy" => URI.encode_www_form(target_https_proxy) }) |> Request.add_optional_params(optional_params_config, optional_params) connection |> Connection.execute(request) |> Response.decode(opts ++ [struct: %GoogleApi.Compute.V1.Model.Operation{}]) end @doc """ Sets the SSL policy for TargetHttpsProxy. The SSL policy specifies the server-side support for SSL features. This affects connections between clients and the HTTPS proxy load balancer. They do not affect the connection between the load balancer and the backends. ## Parameters - connection (GoogleApi.Compute.V1.Connection): Connection to server - project (String.t): Project ID for this request. - target_https_proxy (String.t): Name of the TargetHttpsProxy resource whose SSL policy is to be set. The name must be 1-63 characters long, and comply with RFC1035. - optional_params (KeywordList): [optional] Optional parameters - :alt (String.t): Data format for the response. - :fields (String.t): Selector specifying which fields to include in a partial response. - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - :oauth_token (String.t): OAuth 2.0 token for the current user. - :prettyPrint (boolean()): Returns response with indentations and line breaks. - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - :userIp (String.t): Deprecated. Please use quotaUser instead. - :requestId (String.t): An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - :body (SslPolicyReference): ## Returns {:ok, %GoogleApi.Compute.V1.Model.Operation{}} on success {:error, info} on failure """ @spec compute_target_https_proxies_set_ssl_policy( Tesla.Env.client(), String.t(), String.t(), keyword() ) :: {:ok, GoogleApi.Compute.V1.Model.Operation.t()} | {:error, Tesla.Env.t()} def compute_target_https_proxies_set_ssl_policy( connection, project, target_https_proxy, optional_params \\ [], opts \\ [] ) do optional_params_config = %{ :alt => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :userIp => :query, :requestId => :query, :body => :body } request = Request.new() |> Request.method(:post) |> Request.url("/{project}/global/targetHttpsProxies/{targetHttpsProxy}/setSslPolicy", %{ "project" => URI.encode_www_form(project), "targetHttpsProxy" => URI.encode_www_form(target_https_proxy) }) |> Request.add_optional_params(optional_params_config, optional_params) connection |> Connection.execute(request) |> Response.decode(opts ++ [struct: %GoogleApi.Compute.V1.Model.Operation{}]) end @doc """ Changes the URL map for TargetHttpsProxy. ## Parameters - connection (GoogleApi.Compute.V1.Connection): Connection to server - project (String.t): Project ID for this request. - target_https_proxy (String.t): Name of the TargetHttpsProxy resource whose URL map is to be set. - optional_params (KeywordList): [optional] Optional parameters - :alt (String.t): Data format for the response. - :fields (String.t): Selector specifying which fields to include in a partial response. - :key (String.t): API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - :oauth_token (String.t): OAuth 2.0 token for the current user. - :prettyPrint (boolean()): Returns response with indentations and line breaks. - :quotaUser (String.t): An opaque string that represents a user for quota purposes. Must not exceed 40 characters. - :userIp (String.t): Deprecated. Please use quotaUser instead. - :requestId (String.t): An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - :body (UrlMapReference): ## Returns {:ok, %GoogleApi.Compute.V1.Model.Operation{}} on success {:error, info} on failure """ @spec compute_target_https_proxies_set_url_map( Tesla.Env.client(), String.t(), String.t(), keyword() ) :: {:ok, GoogleApi.Compute.V1.Model.Operation.t()} | {:error, Tesla.Env.t()} def compute_target_https_proxies_set_url_map( connection, project, target_https_proxy, optional_params \\ [], opts \\ [] ) do optional_params_config = %{ :alt => :query, :fields => :query, :key => :query, :oauth_token => :query, :prettyPrint => :query, :quotaUser => :query, :userIp => :query, :requestId => :query, :body => :body } request = Request.new() |> Request.method(:post) |> Request.url("/{project}/targetHttpsProxies/{targetHttpsProxy}/setUrlMap", %{ "project" => URI.encode_www_form(project), "targetHttpsProxy" => URI.encode_www_form(target_https_proxy) }) |> Request.add_optional_params(optional_params_config, optional_params) connection |> Connection.execute(request) |> Response.decode(opts ++ [struct: %GoogleApi.Compute.V1.Model.Operation{}]) end end
52.21328
1,213
0.701734
035505af969e8964ca3c938f6bc51b66d3d29518
10,448
exs
Elixir
lib/elixir/test/elixir/macro_test.exs
Nicd/elixir
e62ef92a4be1b562033d35b2d822cc9d6c661077
[ "Apache-2.0" ]
4
2016-04-05T05:51:36.000Z
2019-10-31T06:46:35.000Z
lib/elixir/test/elixir/macro_test.exs
Nicd/elixir
e62ef92a4be1b562033d35b2d822cc9d6c661077
[ "Apache-2.0" ]
null
null
null
lib/elixir/test/elixir/macro_test.exs
Nicd/elixir
e62ef92a4be1b562033d35b2d822cc9d6c661077
[ "Apache-2.0" ]
5
2015-02-01T06:01:19.000Z
2019-08-29T09:02:35.000Z
Code.require_file "test_helper.exs", __DIR__ defmodule Macro.ExternalTest do defmacro external do 18 = __CALLER__.line __FILE__ = __CALLER__.file 18 = __CALLER__.location[:line] __FILE__ = __CALLER__.location[:file] end end defmodule MacroTest do use ExUnit.Case, async: true # Changing the lines above will make compilation # fail since we are assertnig on the caller lines require Macro.ExternalTest Macro.ExternalTest.external() ## Escape test :escape_handle_tuples_with_size_different_than_two do assert { :{}, [], [:a] } == Macro.escape({ :a }) assert { :{}, [], [:a, :b, :c] } == Macro.escape({ :a, :b, :c }) end test :escape_simply_returns_tuples_with_size_equal_to_two do assert { :a, :b } == Macro.escape({ :a, :b }) end test :escape_simply_returns_any_other_structure do assert [1,2,3] == Macro.escape([1,2,3]) end test :escape_works_recursively do assert [1,{:{}, [], [:a,:b,:c]},3] == Macro.escape([1, { :a, :b, :c },3]) end test :escape_with_unquote do contents = quote unquote: false, do: unquote(1) assert Macro.escape_quoted(contents) == 1 contents = quote unquote: false, do: unquote(x) assert Macro.escape_quoted(contents) == { :x, [], MacroTest } end defp eval_escaped(contents) do { eval, [] } = Code.eval_quoted(Macro.escape_quoted(contents)) eval end test :escape_with_remote_unquote do contents = quote unquote: false, do: Kernel.unquote(:is_atom)(:ok) assert eval_escaped(contents) == quote(do: Kernel.is_atom(:ok)) end test :escape_with_nested_unquote do contents = quote do quote do: unquote(x) end assert eval_escaped(contents) == quote do: (quote do: unquote(x)) end test :escape_with_alias_or_no_args_remote_unquote do contents = quote unquote: false, do: Kernel.unquote(:self) assert eval_escaped(contents) == quote(do: Kernel.self()) contents = quote unquote: false, do: x.unquote(Foo) assert eval_escaped(contents) == quote(do: x.unquote(Foo)) end test :escape_with_splicing do contents = quote unquote: false, do: [1,2,3,4,5] assert Macro.escape_quoted(contents) == [1,2,3,4,5] contents = quote unquote: false, do: [1,2,unquote_splicing([3,4,5])] assert eval_escaped(contents) == [1,2,3,4,5] contents = quote unquote: false, do: [unquote_splicing([1,2,3]), 4, 5] assert eval_escaped(contents) == [1,2,3,4,5] contents = quote unquote: false, do: [unquote_splicing([1,2,3]), unquote_splicing([4, 5])] assert eval_escaped(contents) == [1,2,3,4,5] contents = quote unquote: false, do: [1, unquote_splicing([2]), 3, unquote_splicing([4]), 5] assert eval_escaped(contents) == [1,2,3,4,5] contents = quote unquote: false, do: [1, unquote_splicing([2]), 3, unquote_splicing([4])|[5]] assert eval_escaped(contents) == [1,2,3,4,5] end ## Expand aliases test :expand_with_raw_atom do assert Macro.expand(quote(do: :foo), __ENV__) == :foo end test :expand_with_current_module do assert Macro.expand(quote(do: __MODULE__), __ENV__) == __MODULE__ end test :expand_with_main do assert Macro.expand(quote(do: Elixir), __ENV__) == Elixir end test :expand_with_simple_alias do assert Macro.expand(quote(do: Foo), __ENV__) == Foo end test :expand_with_current_module_plus_alias do assert Macro.expand(quote(do: __MODULE__.Foo), __ENV__) == __MODULE__.Foo end test :expand_with_main_plus_alias do assert Macro.expand(quote(do: Elixir.Foo), __ENV__) == Foo end test :expand_with_custom_alias do alias Foo, as: Bar assert Macro.expand(quote(do: Bar.Baz), __ENV__) == Foo.Baz end test :expand_with_main_plus_custom_alias do alias Foo, as: Bar assert Macro.expand(quote(do: Elixir.Bar.Baz), __ENV__) == Elixir.Bar.Baz end test :expand_with_op do assert Macro.expand(quote(do: Foo.bar.Baz), __ENV__) == (quote do Foo.bar.Baz end) end test :expand_with_erlang do assert Macro.expand(quote(do: :foo), __ENV__) == :foo end defmacro local_macro do :local_macro end test :expand_local_macro do assert Macro.expand(quote(do: local_macro), __ENV__) == :local_macro end test :expand_with_imported_macro do assert Macro.expand(quote(do: 1 || false), __ENV__) == (quote context: Kernel do case 1 do oror in [false, nil] -> false oror -> oror end end) end test :expand_with_require_macro do assert Macro.expand(quote(do: Kernel.||(1, false)), __ENV__) == (quote context: Kernel do case 1 do oror in [false, nil] -> false oror -> oror end end) end test :expand_with_not_expandable_expression do expr = quote(do: other(1,2,3)) assert Macro.expand(expr, __ENV__) == expr end @foo 1 @bar Macro.expand(quote(do: @foo), __ENV__) test :expand_with_module_at do assert @bar == 1 end ## to_binary test :var_to_binary do assert Macro.to_binary(quote do: foo) == "foo" end test :local_call_to_binary do assert Macro.to_binary(quote do: foo(1, 2, 3)) == "foo(1, 2, 3)" assert Macro.to_binary(quote do: foo([1, 2, 3])) == "foo([1, 2, 3])" end test :remote_call_to_binary do assert Macro.to_binary(quote do: foo.bar(1, 2, 3)) == "foo.bar(1, 2, 3)" assert Macro.to_binary(quote do: foo.bar([1, 2, 3])) == "foo.bar([1, 2, 3])" end test :low_atom_remote_call_to_binary do assert Macro.to_binary(quote do: :foo.bar(1, 2, 3)) == ":foo.bar(1, 2, 3)" end test :big_atom_remote_call_to_binary do assert Macro.to_binary(quote do: Foo.Bar.bar(1, 2, 3)) == "Foo.Bar.bar(1, 2, 3)" end test :remote_and_fun_call_to_binary do assert Macro.to_binary(quote do: foo.bar.(1, 2, 3)) == "foo.bar().(1, 2, 3)" assert Macro.to_binary(quote do: foo.bar.([1, 2, 3])) == "foo.bar().([1, 2, 3])" end test :atom_call_to_binary do assert Macro.to_binary(quote do: :foo.(1, 2, 3)) == ":foo.(1, 2, 3)" end test :aliases_call_to_binary do assert Macro.to_binary(quote do: Foo.Bar.baz(1, 2, 3)) == "Foo.Bar.baz(1, 2, 3)" assert Macro.to_binary(quote do: Foo.Bar.baz([1, 2, 3])) == "Foo.Bar.baz([1, 2, 3])" end test :arrow_to_binary do assert Macro.to_binary(quote do: foo(1, (2 -> 3))) == "foo(1, (2 -> 3))" end test :blocks_to_binary do assert Macro.to_binary(quote do: (1; 2; (:foo; :bar); 3)) <> "\n" == """ ( 1 2 ( :foo :bar ) 3 ) """ end test :if_else_to_binary do assert Macro.to_binary(quote do: (if foo, do: bar, else: baz)) <> "\n" == """ if(foo) do bar else baz end """ end test :case_to_binary do assert Macro.to_binary(quote do: (case foo do true -> 0; false -> (1; 2) end)) <> "\n" == """ case(foo) do true -> 0 false -> 1 2 end """ end test :fn_to_binary do assert Macro.to_binary(quote do: (() -> x)) == "(() -> x)" assert Macro.to_binary(quote do: (fn -> 1 + 2 end)) == "fn -> 1 + 2 end" assert Macro.to_binary(quote do: (fn(x) -> x + 1 end)) == "fn x -> x + 1 end" assert Macro.to_binary(quote do: (fn(x) -> y = x + 1; y end)) <> "\n" == """ fn x -> y = (x + 1) y end """ assert Macro.to_binary(quote do: (fn(x) -> y = x + 1; y; (z) -> z end)) <> "\n" == """ fn x -> y = (x + 1) y z -> z end """ end test :partial_to_binary do assert Macro.to_binary(quote do: identity(&1)) == "identity(&1)" end test :nested_to_binary do assert Macro.to_binary(quote do: (defmodule Foo do def foo do 1 + 1 end end)) <> "\n" == """ defmodule(Foo) do def(foo) do 1 + 1 end end """ end test :op_precedence_to_binary do assert Macro.to_binary(quote do: (1 + 2) * (3 - 4)) == "(1 + 2) * (3 - 4)" assert Macro.to_binary(quote do: ((1 + 2) * 3) - 4) == "((1 + 2) * 3) - 4" end test :containers_to_binary do assert Macro.to_binary(quote do: { 1, 2, 3 }) == "{1, 2, 3}" assert Macro.to_binary(quote do: [ 1, 2, 3 ]) == "[1, 2, 3]" assert Macro.to_binary(quote do: << 1, 2, 3 >>) == "<<1, 2, 3>>" end test :binary_ops_to_binary do assert Macro.to_binary(quote do: 1 + 2) == "1 + 2" assert Macro.to_binary(quote do: [ 1, 2 | 3 ]) == "[1, 2 | 3]" assert Macro.to_binary(quote do: [h|t] = [1,2,3]) == "[h | t] = [1, 2, 3]" end test :unary_ops_to_binary do assert Macro.to_binary(quote do: not 1) == "not 1" assert Macro.to_binary(quote do: not foo) == "not foo" assert Macro.to_binary(quote do: -1) == "-1" assert Macro.to_binary(quote do: @foo(bar)) == "@foo(bar)" end ## safe_term test :safe_terms do assert Macro.safe_term(quote do: 1) == :ok assert Macro.safe_term(quote do: 1.1) == :ok assert Macro.safe_term(quote do: -1) == :ok assert Macro.safe_term(quote do: +1) == :ok assert Macro.safe_term(quote do: []) == :ok assert Macro.safe_term(quote do: [1,2,3]) == :ok assert Macro.safe_term(quote do: "") == :ok assert Macro.safe_term(quote do: {}) == :ok assert Macro.safe_term(quote do: {1,2}) == :ok assert Macro.safe_term(quote do: {1,2,3}) == :ok assert Macro.safe_term(quote do: {1,2,3,4}) == :ok assert Macro.safe_term(quote do: Alias) == :ok end test :unsafe_terms do assert Macro.safe_term(quote do: 1+1) == { :unsafe, quote do: 1 + 1 } assert Macro.safe_term(quote do: [1+1]) == { :unsafe, quote do: 1 + 1 } assert Macro.safe_term(quote do: {1+1}) == { :unsafe, quote do: 1 + 1 } end ## extract_args test :extract_args do assert Macro.extract_args(quote do: foo) == { :foo, [] } assert Macro.extract_args(quote do: foo()) == { :foo, [] } assert Macro.extract_args(quote do: :foo.()) == { :foo, [] } assert Macro.extract_args(quote do: foo(1,2,3)) == { :foo, [1,2,3] } assert Macro.extract_args(quote do: 1.(1,2,3)) == :error end ## env test :env_stacktrace do env = __ENV__.file("foo").line(12) assert env.stacktrace == [{ __MODULE__, :test_env_stacktrace, 1, [file: "foo", line: 12] }] env = env.function(nil) assert env.stacktrace == [{ __MODULE__, :__MODULE__, 0, [file: "foo", line: 12] }] env = env.module(nil) assert env.stacktrace == [{ :elixir_compiler, :__FILE__, 2, [file: "foo", line: 12] }] end end
29.184358
97
0.613706
03553d2cecf353386c98c5eba1df9cd47d1c99f6
344
exs
Elixir
priv/repo/migrations/20190930150509_remove_unique_constaint_source_slug.exs
sitedata/sanbase2
8da5e44a343288fbc41b68668c6c80ae8547d557
[ "MIT" ]
81
2017-11-20T01:20:22.000Z
2022-03-05T12:04:25.000Z
priv/repo/migrations/20190930150509_remove_unique_constaint_source_slug.exs
rmoorman/sanbase2
226784ab43a24219e7332c49156b198d09a6dd85
[ "MIT" ]
359
2017-10-15T14:40:53.000Z
2022-01-25T13:34:20.000Z
priv/repo/migrations/20190930150509_remove_unique_constaint_source_slug.exs
sitedata/sanbase2
8da5e44a343288fbc41b68668c6c80ae8547d557
[ "MIT" ]
16
2017-11-19T13:57:40.000Z
2022-02-07T08:13:02.000Z
defmodule Sanbase.Repo.Migrations.RemoveUniqueConstaintSourceSlug do use Ecto.Migration @table "source_slug_mappings" def up do drop(unique_index(@table, [:source, :slug], name: :source_slug_unique_combination)) end def down do create(unique_index(@table, [:source, :slug], name: :source_slug_unique_combination)) end end
26.461538
89
0.758721
035551d9dd2c077b094bbcf682407f0ff2b96089
253
ex
Elixir
lib/phone/nanp/us/nv.ex
net/phone
18e1356d2f8d32fe3f95638c3c44bceab0164fb2
[ "Apache-2.0" ]
null
null
null
lib/phone/nanp/us/nv.ex
net/phone
18e1356d2f8d32fe3f95638c3c44bceab0164fb2
[ "Apache-2.0" ]
null
null
null
lib/phone/nanp/us/nv.ex
net/phone
18e1356d2f8d32fe3f95638c3c44bceab0164fb2
[ "Apache-2.0" ]
null
null
null
defmodule Phone.NANP.US.NV do @moduledoc false use Helper.Area def regex, do: ~r/^(1)(702|7[2|7]5)([2-9].{6})$/ def area_name, do: "Nevada" def area_type, do: "state" def area_abbreviation, do: "NV" matcher ["1702", "1725", "1775"] end
19.461538
50
0.624506
03555aaeb73987bd1d7b8323c3a0122eb88c9d96
2,598
ex
Elixir
apps/ewallet_db/lib/ewallet_db/blockchain_wallet.ex
AndonMitev/EWallet
898cde38933d6f134734528b3e594eedf5fa50f3
[ "Apache-2.0" ]
322
2018-02-28T07:38:44.000Z
2020-05-27T23:09:55.000Z
apps/ewallet_db/lib/ewallet_db/blockchain_wallet.ex
AndonMitev/EWallet
898cde38933d6f134734528b3e594eedf5fa50f3
[ "Apache-2.0" ]
643
2018-02-28T12:05:20.000Z
2020-05-22T08:34:38.000Z
apps/ewallet_db/lib/ewallet_db/blockchain_wallet.ex
AndonMitev/EWallet
898cde38933d6f134734528b3e594eedf5fa50f3
[ "Apache-2.0" ]
63
2018-02-28T10:57:06.000Z
2020-05-27T23:10:38.000Z
# Copyright 2018-2019 OmiseGO Pte Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. defmodule EWalletDB.BlockchainWallet do @moduledoc """ Ecto Schema representing a blockchain wallet. """ use Ecto.Schema use ActivityLogger.ActivityLogging import Ecto.Changeset import EWalletDB.Validator import EWalletDB.Helpers.Preloader alias Ecto.UUID alias EWalletDB.{Repo, BlockchainWallet} @primary_key {:uuid, UUID, autogenerate: true} @timestamps_opts [type: :naive_datetime_usec] @hot "hot" @cold "cold" @wallet_types [@hot, @cold] schema "blockchain_wallet" do # Blockchain wallets don't have an external ID. Use `address` instead. field(:address, :string) field(:name, :string) field(:public_key, :string) field(:type, :string) activity_logging() timestamps() end defp changeset(%BlockchainWallet{} = wallet, attrs) do wallet |> cast_and_validate_required_for_activity_log( attrs, cast: [ :uuid, :address, :public_key, :name, :type ], required: [:address, :name, :public_key, :type] ) |> unique_constraint(:address) |> unique_constraint(:name) |> unique_constraint(:public_key) |> validate_immutable(:address) |> validate_immutable(:public_key) |> validate_inclusion(:type, @wallet_types) |> validate_length(:address, count: :bytes, max: 255) |> validate_length(:name, count: :bytes, max: 255) |> validate_length(:public_key, count: :bytes, max: 255) end @doc """ Retrieves a blockchain wallet using one or more fields. """ @spec get_by(fields :: map() | keyword(), opts :: keyword()) :: %BlockchainWallet{} | nil | no_return() def get_by(fields, opts \\ []) do BlockchainWallet |> Repo.get_by(fields) |> preload_option(opts) end @doc """ Create a new blockchain wallet with the passed attributes. """ @spec insert(map()) :: {:ok, %__MODULE__{}} def insert(attrs) do %BlockchainWallet{} |> changeset(attrs) |> Repo.insert_record_with_activity_log() end end
28.549451
74
0.680908
03556106097d501526b479049d8f7b56689f3394
1,066
ex
Elixir
issues/deps/earmark/lib/earmark/cli.ex
vronic/programming-elixir
4465a81cc07b31a4c03bd277520e1127dda773b2
[ "MIT" ]
null
null
null
issues/deps/earmark/lib/earmark/cli.ex
vronic/programming-elixir
4465a81cc07b31a4c03bd277520e1127dda773b2
[ "MIT" ]
null
null
null
issues/deps/earmark/lib/earmark/cli.ex
vronic/programming-elixir
4465a81cc07b31a4c03bd277520e1127dda773b2
[ "MIT" ]
null
null
null
defmodule Earmark.CLI do def main(argv) do argv |> parse_args |> process end @args """ usage: earmark [ <file> ] convert file from Markdown to HTML. """ defp parse_args(argv) do parse = OptionParser.parse(argv, switches: [ help: :boolean], aliases: [ h: :help ]) case parse do { [ help: true ], _, _ } -> :help { _, [ filename ], _ } -> open_file(filename) { _, [ ], _ } -> :stdio _ -> :help end end defp process(:help) do IO.puts(:stderr, @args) exit(2) end defp process(io_device) do content = IO.stream(io_device, :line) |> Enum.to_list Earmark.to_html(content, %Earmark.Options{}) |> IO.puts end defp open_file(filename), do: io_device(File.open(filename, [:utf8]), filename) defp io_device({:ok, io_device}, _), do: io_device defp io_device({:error, reason}, filename) do IO.puts(:stderr, "#{filename}: #{:file.format_error(reason)}") exit(1) end end
20.5
81
0.546904
03557a7a85ac8380193426685591b038cbe70bbf
7,384
exs
Elixir
test/workflows/status_test.exs
mathiaHT/ex_step_flow
6496e9511239de64f00119428476338dfcde9dea
[ "MIT" ]
4
2019-12-07T05:18:26.000Z
2020-11-06T23:28:43.000Z
test/workflows/status_test.exs
mathiaHT/ex_step_flow
6496e9511239de64f00119428476338dfcde9dea
[ "MIT" ]
53
2020-01-06T11:23:09.000Z
2021-06-25T15:30:07.000Z
test/workflows/status_test.exs
mathiaHT/ex_step_flow
6496e9511239de64f00119428476338dfcde9dea
[ "MIT" ]
3
2020-01-30T15:37:40.000Z
2020-10-27T14:10:02.000Z
defmodule StepFlow.Workflows.StatusTest do use ExUnit.Case use Plug.Test alias Ecto alias Ecto.Adapters.SQL.Sandbox alias StepFlow.Jobs alias StepFlow.Step alias StepFlow.Workflows alias StepFlow.Workflows.Status require Logger doctest StepFlow setup do # Explicitly get a connection before each test :ok = Sandbox.checkout(StepFlow.Repo) # Setting the shared mode Sandbox.mode(StepFlow.Repo, {:shared, self()}) {_conn, channel} = StepFlow.HelpersTest.get_amqp_connection() on_exit(fn -> StepFlow.HelpersTest.consume_messages(channel, "job_test", 3) end) :ok end describe "workflows" do @valid_attrs %{ schema_version: "1.8", identifier: "id", version_major: 6, version_minor: 5, version_micro: 4, reference: "some id", steps: [ %{ id: 0, name: "job_test", icon: "step_icon", label: "My first step", parameters: [ %{ id: "source_paths", type: "array_of_strings", value: ["coucou.mov"] } ] }, %{ id: 1, required_to_start: [0], parent_ids: [0], name: "job_test", icon: "step_icon", label: "First parallel step", parameters: [] }, %{ id: 2, required_to_start: [0], parent_ids: [0], name: "job_test", icon: "step_icon", label: "Second parallel step", parameters: [] } ], rights: [ %{ action: "view", groups: ["user_view"] } ] } def workflow_fixture(attrs \\ %{}) do {:ok, workflow} = attrs |> Enum.into(@valid_attrs) |> Workflows.create_workflow() workflow end test "set_workflow_status with no job_status_id" do workflow = workflow_fixture() {:ok, status} = Status.set_workflow_status(workflow.id, :completed) assert status.state == :completed end test "set_workflow_status with existing job_status_id" do workflow = workflow_fixture() {:ok, "started"} = Step.start_next(workflow) [job | _] = StepFlow.HelpersTest.complete_jobs(workflow.id, 0) %{status: [job_status | _]} = Jobs.get_job_with_status!(job.id) {:ok, status} = Status.set_workflow_status(workflow.id, :completed, job_status.id) assert status.state == :completed end test "set_workflow_status with non existing job_status_id " do workflow = workflow_fixture() message = ~r/constraint error when attempting to insert struct/ assert_raise Ecto.ConstraintError, message, fn -> Status.set_workflow_status(workflow.id, :completed, 1) end end test "get_last_workflow_status" do workflow = workflow_fixture() {:ok, _status} = Status.set_workflow_status(workflow.id, :pending) status = Status.get_last_workflow_status(workflow.id) assert status.state == :pending {:ok, _status} = Status.set_workflow_status(workflow.id, :completed) status = Status.get_last_workflow_status(workflow.id) assert status.state == :completed end test "get_last_jobs_status" do workflow = workflow_fixture() {:ok, _status} = Status.define_workflow_status(workflow.id, :created_workflow) {:ok, "started"} = Step.start_next(workflow) {:ok, job_status} = StepFlow.HelpersTest.change_job_status(workflow, 0, "completed") Status.set_workflow_status(workflow.id, :pending, job_status.id) {:ok, "started"} = Step.start_next(workflow) {:ok, job_status} = StepFlow.HelpersTest.change_job_status(workflow, 1, "error") Status.set_workflow_status(workflow.id, :error, job_status.id) before_retry = Status.get_last_jobs_status(workflow.id) assert Enum.at(before_retry, 0).state == :completed assert Enum.at(before_retry, 1).state == :error {:ok, job_status} = StepFlow.HelpersTest.change_job_status(workflow, 1, "retrying") Status.set_workflow_status(workflow.id, :processing, job_status.id) after_retry = Status.get_last_jobs_status(workflow.id) assert Enum.at(after_retry, 0).state == :completed assert Enum.at(after_retry, 1).state == :retrying assert Enum.at(before_retry, 0).job_id == Enum.at(after_retry, 0).job_id assert Enum.at(before_retry, 1).job_id == Enum.at(after_retry, 1).job_id end test "define_workflow_status" do workflow = workflow_fixture() {:ok, status} = Status.define_workflow_status(workflow.id, :created_workflow) assert status.state == :pending {:ok, "started"} = Step.start_next(workflow) {:ok, progression} = StepFlow.HelpersTest.create_progression(workflow, 0, 0) {:ok, status} = Status.define_workflow_status(workflow.id, :job_progression, progression) assert status.state == :processing {:ok, progression} = StepFlow.HelpersTest.create_progression(workflow, 0, 50) assert Status.define_workflow_status(workflow.id, :job_progression, progression) == nil {:ok, job_status} = StepFlow.HelpersTest.change_job_status(workflow, 0, "error") {:ok, status} = Status.define_workflow_status(workflow.id, :job_error, job_status) assert status.state == :error {:ok, job_status} = StepFlow.HelpersTest.change_job_status(workflow, 0, "retrying") {:ok, status} = Status.define_workflow_status(workflow.id, :job_retrying, job_status) assert status.state == :processing {:ok, job_status} = StepFlow.HelpersTest.change_job_status(workflow, 0, "completed") {:ok, status} = Status.define_workflow_status(workflow.id, :job_completed, job_status) assert status.state == :pending {:ok, "started"} = Step.start_next(workflow) {:ok, job_status} = StepFlow.HelpersTest.change_job_status(workflow, 1, "error") {:ok, status} = Status.define_workflow_status(workflow.id, :queue_not_found, job_status) assert status.state == :error {:ok, job_status} = StepFlow.HelpersTest.change_job_status(workflow, 2, "error") {:ok, status} = Status.define_workflow_status(workflow.id, :job_error, job_status) assert status.state == :error {:ok, job_status} = StepFlow.HelpersTest.change_job_status(workflow, 1, "retrying") {:ok, status} = Status.define_workflow_status(workflow.id, :job_retrying, job_status) assert status.state == :error {:ok, job_status} = StepFlow.HelpersTest.change_job_status(workflow, 2, "retrying") {:ok, status} = Status.define_workflow_status(workflow.id, :job_retrying, job_status) assert status.state == :processing {:ok, job_status} = StepFlow.HelpersTest.change_job_status(workflow, 1, "completed") {:ok, status} = Status.define_workflow_status(workflow.id, :job_completed, job_status) assert status.state == :processing {:ok, job_status} = StepFlow.HelpersTest.change_job_status(workflow, 2, "completed") {:ok, status} = Status.define_workflow_status(workflow.id, :job_completed, job_status) assert status.state == :pending {:ok, status} = Status.define_workflow_status(workflow.id, :completed_workflow) assert status.state == :completed end end end
32.817778
95
0.654252
035580e664c8d621f4199b9a3f1a3595d56fb274
4,941
ex
Elixir
clients/content/lib/google_api/content/v21/model/repricing_product_report.ex
kyleVsteger/elixir-google-api
3a0dd498af066a4361b5b0fd66ffc04a57539488
[ "Apache-2.0" ]
1
2021-10-01T09:20:41.000Z
2021-10-01T09:20:41.000Z
clients/content/lib/google_api/content/v21/model/repricing_product_report.ex
kyleVsteger/elixir-google-api
3a0dd498af066a4361b5b0fd66ffc04a57539488
[ "Apache-2.0" ]
null
null
null
clients/content/lib/google_api/content/v21/model/repricing_product_report.ex
kyleVsteger/elixir-google-api
3a0dd498af066a4361b5b0fd66ffc04a57539488
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.Content.V21.Model.RepricingProductReport do @moduledoc """ Resource that represents a daily Repricing product report. Each report contains stats for a single type of Repricing rule for a single product on a given day. If there are multiple rules of the same type for the product on that day, the report lists all the rules by rule ids, combines the stats, and paginates the results by date. To retrieve the stats of a particular rule, provide the rule_id in the request. ## Attributes * `applicationCount` (*type:* `String.t`, *default:* `nil`) - Total count of Repricer applications. This value captures how many times the rule of this type was applied to this product during this reporting period. * `buyboxWinningProductStats` (*type:* `GoogleApi.Content.V21.Model.RepricingProductReportBuyboxWinningProductStats.t`, *default:* `nil`) - Stats specific to buybox winning rules for product report. * `date` (*type:* `GoogleApi.Content.V21.Model.Date.t`, *default:* `nil`) - Date of the stats in this report. The report starts and ends according to the merchant's timezone. * `highWatermark` (*type:* `GoogleApi.Content.V21.Model.PriceAmount.t`, *default:* `nil`) - Maximum displayed price after repriced during this reporting period. * `inapplicabilityDetails` (*type:* `list(GoogleApi.Content.V21.Model.InapplicabilityDetails.t)`, *default:* `nil`) - List of all reasons the rule did not apply to the product during the specified reporting period. * `lowWatermark` (*type:* `GoogleApi.Content.V21.Model.PriceAmount.t`, *default:* `nil`) - Minimum displayed price after repriced during this reporting period. * `orderItemCount` (*type:* `integer()`, *default:* `nil`) - Total unit count of impacted products ordered while the rule was active on the date of the report. This count includes all orders that were started while the rule was active, even if the rule was no longer active when the order was completed. * `ruleIds` (*type:* `list(String.t)`, *default:* `nil`) - Ids of the Repricing rule for this report. * `totalGmv` (*type:* `GoogleApi.Content.V21.Model.PriceAmount.t`, *default:* `nil`) - Total GMV generated by impacted products while the rule was active on the date of the report. This value includes all orders that were started while the rule was active, even if the rule was no longer active when the order was completed. * `type` (*type:* `String.t`, *default:* `nil`) - Type of the rule. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :applicationCount => String.t() | nil, :buyboxWinningProductStats => GoogleApi.Content.V21.Model.RepricingProductReportBuyboxWinningProductStats.t() | nil, :date => GoogleApi.Content.V21.Model.Date.t() | nil, :highWatermark => GoogleApi.Content.V21.Model.PriceAmount.t() | nil, :inapplicabilityDetails => list(GoogleApi.Content.V21.Model.InapplicabilityDetails.t()) | nil, :lowWatermark => GoogleApi.Content.V21.Model.PriceAmount.t() | nil, :orderItemCount => integer() | nil, :ruleIds => list(String.t()) | nil, :totalGmv => GoogleApi.Content.V21.Model.PriceAmount.t() | nil, :type => String.t() | nil } field(:applicationCount) field(:buyboxWinningProductStats, as: GoogleApi.Content.V21.Model.RepricingProductReportBuyboxWinningProductStats ) field(:date, as: GoogleApi.Content.V21.Model.Date) field(:highWatermark, as: GoogleApi.Content.V21.Model.PriceAmount) field(:inapplicabilityDetails, as: GoogleApi.Content.V21.Model.InapplicabilityDetails, type: :list ) field(:lowWatermark, as: GoogleApi.Content.V21.Model.PriceAmount) field(:orderItemCount) field(:ruleIds, type: :list) field(:totalGmv, as: GoogleApi.Content.V21.Model.PriceAmount) field(:type) end defimpl Poison.Decoder, for: GoogleApi.Content.V21.Model.RepricingProductReport do def decode(value, options) do GoogleApi.Content.V21.Model.RepricingProductReport.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.Content.V21.Model.RepricingProductReport do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
58.129412
413
0.731633
03558a8b92eea71e9b1243e87c0dda0996c58ca4
93
exs
Elixir
test/test_helper.exs
GPrimola/posexional
ea4e24388ffba0568a9a7b9aeaf236b81965fb24
[ "MIT" ]
10
2017-02-21T20:59:18.000Z
2021-01-28T13:44:41.000Z
test/test_helper.exs
GPrimola/posexional
ea4e24388ffba0568a9a7b9aeaf236b81965fb24
[ "MIT" ]
13
2016-10-16T15:45:51.000Z
2021-02-12T09:38:28.000Z
test/test_helper.exs
GPrimola/posexional
ea4e24388ffba0568a9a7b9aeaf236b81965fb24
[ "MIT" ]
8
2016-10-16T12:43:03.000Z
2021-01-28T20:47:51.000Z
# ExCheck.start Application.ensure_all_started(:timex) ExUnit.start(exclude: [:experiments])
23.25
38
0.806452
0355a5260d3a240367cbe026bdbfcfed3a219f4f
744
ex
Elixir
lib/matic.ex
zimmydev/matic
3d79ad0c6999c9984249950fb63e80047686e9ea
[ "MIT" ]
4
2021-09-23T10:06:38.000Z
2021-09-30T18:50:50.000Z
lib/matic.ex
zimmydev/matic
3d79ad0c6999c9984249950fb63e80047686e9ea
[ "MIT" ]
null
null
null
lib/matic.ex
zimmydev/matic
3d79ad0c6999c9984249950fb63e80047686e9ea
[ "MIT" ]
null
null
null
# Copyright (c) 2021 Brandon Zimmerman # # This software is released under the MIT License. # https://opensource.org/licenses/MIT defmodule Matic do @moduledoc """ This module houses core `matic` functionality. """ alias Matic.Filesystem @checksum_method Application.compile_env!(:matic, :checksum_method) ## Filesystem Setup ## @spec setup() :: :ok def setup do Filesystem.require_main_dir() Filesystem.require_plugins_dir() Filesystem.require_data_dir() end ## Application Functions ## @spec version() :: String.t() def version do Application.spec(:matic, :vsn) |> List.to_string() end ## Utility Functions ## def checksum(binary), do: :crypto.hash(@checksum_method, binary) end
20.108108
69
0.694892
0355ab7045de83045c9506195e86a0d0f3b78fa2
990
ex
Elixir
clients/games_management/lib/google_api/games_management/v1management/deserializer.ex
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
null
null
null
clients/games_management/lib/google_api/games_management/v1management/deserializer.ex
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
null
null
null
clients/games_management/lib/google_api/games_management/v1management/deserializer.ex
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
1
2020-11-10T16:58:27.000Z
2020-11-10T16:58:27.000Z
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an &quot;AS IS&quot; BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This class is auto generated by the swagger code generator program. # https://github.com/swagger-api/swagger-codegen.git # Do not edit the class manually. defmodule GoogleApi.GamesManagement.V1management.Deserializer do @moduledoc """ Helper functions for deserializing responses into models. This module is no longer used. Please use GoogleApi.Gax.ModelBase instead. """ end
38.076923
77
0.769697
0355bb6ff992dad17c5c7ba48bfd646a8fd1820b
13,984
exs
Elixir
test/sanbase_web/graphql/projects/project_api_token_top_transfers_test.exs
rmoorman/sanbase2
226784ab43a24219e7332c49156b198d09a6dd85
[ "MIT" ]
1
2022-01-30T19:51:39.000Z
2022-01-30T19:51:39.000Z
test/sanbase_web/graphql/projects/project_api_token_top_transfers_test.exs
rmoorman/sanbase2
226784ab43a24219e7332c49156b198d09a6dd85
[ "MIT" ]
null
null
null
test/sanbase_web/graphql/projects/project_api_token_top_transfers_test.exs
rmoorman/sanbase2
226784ab43a24219e7332c49156b198d09a6dd85
[ "MIT" ]
null
null
null
defmodule SanbaseWeb.Graphql.ProjectApiTokenTopTransactionsTest do use SanbaseWeb.ConnCase, async: false import Sanbase.Factory import SanbaseWeb.Graphql.TestHelpers require Sanbase.Utils.Config setup do %{ project: insert(:random_erc20_project), project_no_contract: insert(:random_erc20_project, contract_addresses: []) } end test "top token transactons for a project", %{conn: conn, project: project} do Sanbase.Mock.prepare_mock2( &Sanbase.Transfers.Erc20Transfers.top_transfers/7, transfers() ) |> Sanbase.Mock.prepare_mock2(&Sanbase.ClickhouseRepo.query/2, {:ok, %{rows: labels_rows()}}) |> Sanbase.Mock.run_with_mocks(fn -> query = project_by_slug_query(project) result = conn |> post("/graphql", query_skeleton(query, "projectBySlug")) assert json_response(result, 200)["data"]["projectBySlug"] == transactons_map() end) end test "project with no contract address returns empty string", %{ conn: conn, project_no_contract: project_no_contract } do query = """ { projectBySlug( slug: "#{project_no_contract.slug}") { tokenTopTransactions( from: "#{DateTime.from_naive!(~N[2018-06-10 10:33:47], "Etc/UTC")}", to: "#{DateTime.from_naive!(~N[2018-06-18 12:33:47], "Etc/UTC")}") { datetime trxHash trxValue fromAddress{ address } toAddress{ address } } } } """ result = conn |> post("/graphql", query_skeleton(query, "projectBySlug")) assert json_response(result, 200)["data"]["projectBySlug"] == %{"tokenTopTransactions" => []} end test "cannot get top transfers by all projects query", %{conn: conn} do query = """ { allErc20Projects{ tokenTopTransactions( from: "#{DateTime.from_naive!(~N[2018-06-10 10:33:47], "Etc/UTC")}", to: "#{DateTime.from_naive!(~N[2018-06-18 12:33:47], "Etc/UTC")}" ) { datetime trxHash trxValue fromAddress{ address } toAddress{ address } } } } """ result = conn |> post("/graphql", query_skeleton(query, "allErc20Projects")) |> json_response(200) assert result == %{ "data" => %{"allErc20Projects" => nil}, "errors" => [ %{ "locations" => [%{"column" => 3, "line" => 2}], "message" => "Cannot query [\"tokenTopTransactions\"] on a query that returns more than 1 project.", "path" => ["allErc20Projects"] } ] } end # Private functions defp project_by_slug_query(project) do """ { projectBySlug( slug: "#{project.slug}") { tokenTopTransactions( from: "#{DateTime.from_naive!(~N[2018-06-10 10:33:47], "Etc/UTC")}", to: "#{DateTime.from_naive!(~N[2018-06-18 12:33:47], "Etc/UTC")}" ) { datetime trxHash trxValue fromAddress{ address labels { name metadata } } toAddress{ address labels { name metadata } } } } } """ end defp transfers() do {:ok, [ %{ block_number: 5_619_729, contract: "0x7c5a0ce9267ed19b22f8cae653f198e3e8daf098", datetime: DateTime.from_naive!(~N[2018-06-10 10:33:47], "Etc/UTC"), from_address: "0xf4b51b14b9ee30dc37ec970b50a486f37686e2a8", log_index: 0, to_address: "0x742d35cc6634c0532925a3b844bc454e4438f44e", trx_hash: "0x9a561c88bb59a1f6dfe63ed4fe036466b3a328d1d86d039377481ab7c4defe4e", trx_value: 4.5, trx_position: 2 }, %{ block_number: 5_769_021, contract: "0x7c5a0ce9267ed19b22f8cae653f198e3e8daf098", datetime: DateTime.from_naive!(~N[2018-06-10 12:33:47], "Etc/UTC"), from_address: "0x416eda5d6ed29cac3e6d97c102d61bc578c5db87", log_index: 2, to_address: "0xf9428b0e4959cb8d0e68d056a12dcd64ddef066e", trx_hash: "0xccbb803caabebd3665eec49673e23ef5cd08bd0be50a2b1f1506d77a523827ce", trx_value: 9.2, trx_position: 2 }, %{ block_number: 5_770_231, contract: "0x7c5a0ce9267ed19b22f8cae653f198e3e8daf098", datetime: DateTime.from_naive!(~N[2018-06-11 12:33:47], "Etc/UTC"), from_address: "0xf9428b0e4959cb8d0e68d056a12dcd64ddef066e", log_index: 7, to_address: "0x876eabf441b2ee5b5b0554fd502a8e0600950cfa", trx_hash: "0x923f8054bf571ecd56db56f8aaf7b71b97f03ac7cf63e5cac929869cdbdd3863", trx_value: 9.2, trx_position: 2 }, %{ block_number: 5_527_438, contract: "0x7c5a0ce9267ed19b22f8cae653f198e3e8daf098", datetime: DateTime.from_naive!(~N[2018-06-12 12:33:47], "Etc/UTC"), from_address: "0x17125b59ac51cee029e4bd78d7f5947d1ea49bb2", log_index: 56, to_address: "0x8f47cc86055f35ba939ff48e569105183fea64e8", trx_hash: "0xa891e1bbe292e546f40d23772b53a396ae2d37697665157bc6e019c647e9531a", trx_value: 2.5, trx_position: 2 }, %{ block_number: 5_527_472, contract: "0x7c5a0ce9267ed19b22f8cae653f198e3e8daf098", datetime: DateTime.from_naive!(~N[2018-06-13 12:33:47], "Etc/UTC"), from_address: "0x8f47cc86055f35ba939ff48e569105183fea64e8", log_index: 62, to_address: "0x876eabf441b2ee5b5b0554fd502a8e0600950cfa", trx_hash: "0xd4341953103d0d850d3284910213482dae5f7677c929f768d72f121e5a556fb3", trx_value: 2.5, trx_position: 2 }, %{ block_number: 5_569_693, contract: "0x7c5a0ce9267ed19b22f8cae653f198e3e8daf098", datetime: DateTime.from_naive!(~N[2018-06-14 12:33:47], "Etc/UTC"), from_address: "0x826d1ba25d5bf1485c755c8efecff3744f90d137", log_index: 4, to_address: "0x4976b5204c10a8de91cbc9224fb6d314454cf7d8", trx_hash: "0x398772430a2e39f5f1addfbba56b7db1e30e5417de52c15001e157e350c18e52", trx_value: 1.67, trx_position: 2 }, %{ block_number: 5_569_715, contract: "0x7c5a0ce9267ed19b22f8cae653f198e3e8daf098", datetime: DateTime.from_naive!(~N[2018-06-15 12:33:47], "Etc/UTC"), from_address: "0x4976b5204c10a8de91cbc9224fb6d314454cf7d8", log_index: 7, to_address: "0x876eabf441b2ee5b5b0554fd502a8e0600950cfa", trx_hash: "0x31a5d24e2fa078b88b49bd1180f6b29dfe145bb51b6f98543fe9bccf6e15bba2", trx_value: 1.67, trx_position: 2 }, %{ block_number: 5_527_047, contract: "0x7c5a0ce9267ed19b22f8cae653f198e3e8daf098", datetime: DateTime.from_naive!(~N[2018-06-16 12:33:47], "Etc/UTC"), from_address: "0x17125b59ac51cee029e4bd78d7f5947d1ea49bb2", log_index: 58, to_address: "0x0bd1b5cc4c63f99d00f4a3c5cad3619070c5c1c3", trx_hash: "0xa99da23a274c33d40d950fbc03bee7330e518ef6a9622ddd818cb9b967f9f520", trx_value: 1.0, trx_position: 2 }, %{ block_number: 5_528_483, contract: "0x7c5a0ce9267ed19b22f8cae653f198e3e8daf098", datetime: DateTime.from_naive!(~N[2018-06-17 12:33:47], "Etc/UTC"), from_address: "0x0bd1b5cc4c63f99d00f4a3c5cad3619070c5c1c3", log_index: 53, to_address: "0x5e575279bf9f4acf0a130c186861454247394c06", trx_hash: "0x2110456180d0990d1f58c375faab828bb85abc16fe5e56264e84f32864708f3b", trx_value: 1.0, trx_position: 2 }, %{ block_number: 5_812_594, contract: "0x7c5a0ce9267ed19b22f8cae653f198e3e8daf098", datetime: DateTime.from_naive!(~N[2018-06-18 12:33:47], "Etc/UTC"), from_address: "0x1f3df0b8390bb8e9e322972c5e75583e87608ec2", log_index: 14, to_address: "0x157dd308abb91ed2cd5a770bc1cf0fd458c7498c", trx_hash: "0x77ffc9c2ff1678d3f536357eb6e2a032981c98c46e541266ef152752f159187d", trx_value: 8.3, trx_position: 2 } ]} end defp labels_rows() do [ [ "0xf4b51b14b9ee30dc37ec970b50a486f37686e2a8", "centralized_exchange", ~s|{"comment":"Poloniex GNT","is_dex":false,"owner":"Poloniex","source":""}| ], [ "0xf4b51b14b9ee30dc37ec970b50a486f37686e2a8", "whale", ~s|{"rank": 58, "value": 1.1438690681177702e+24}| ] ] end defp transactons_map do %{ "tokenTopTransactions" => [ %{ "datetime" => "2018-06-10T10:33:47Z", "fromAddress" => %{ "address" => "0xf4b51b14b9ee30dc37ec970b50a486f37686e2a8", "labels" => [ %{ "name" => "centralized_exchange", "metadata" => ~s|{"comment":"Poloniex GNT","is_dex":false,"owner":"Poloniex","source":""}| }, %{ "name" => "whale", "metadata" => ~s|{"rank": 58, "value": 1.1438690681177702e+24}| } ] }, "toAddress" => %{ "address" => "0x742d35cc6634c0532925a3b844bc454e4438f44e", "labels" => [] }, "trxHash" => "0x9a561c88bb59a1f6dfe63ed4fe036466b3a328d1d86d039377481ab7c4defe4e", "trxValue" => 4.5 }, %{ "datetime" => "2018-06-10T12:33:47Z", "fromAddress" => %{ "address" => "0x416eda5d6ed29cac3e6d97c102d61bc578c5db87", "labels" => [] }, "toAddress" => %{ "address" => "0xf9428b0e4959cb8d0e68d056a12dcd64ddef066e", "labels" => [] }, "trxHash" => "0xccbb803caabebd3665eec49673e23ef5cd08bd0be50a2b1f1506d77a523827ce", "trxValue" => 9.2 }, %{ "datetime" => "2018-06-11T12:33:47Z", "fromAddress" => %{ "address" => "0xf9428b0e4959cb8d0e68d056a12dcd64ddef066e", "labels" => [] }, "toAddress" => %{ "address" => "0x876eabf441b2ee5b5b0554fd502a8e0600950cfa", "labels" => [] }, "trxHash" => "0x923f8054bf571ecd56db56f8aaf7b71b97f03ac7cf63e5cac929869cdbdd3863", "trxValue" => 9.2 }, %{ "datetime" => "2018-06-12T12:33:47Z", "fromAddress" => %{ "address" => "0x17125b59ac51cee029e4bd78d7f5947d1ea49bb2", "labels" => [] }, "toAddress" => %{ "address" => "0x8f47cc86055f35ba939ff48e569105183fea64e8", "labels" => [] }, "trxHash" => "0xa891e1bbe292e546f40d23772b53a396ae2d37697665157bc6e019c647e9531a", "trxValue" => 2.5 }, %{ "datetime" => "2018-06-13T12:33:47Z", "fromAddress" => %{ "address" => "0x8f47cc86055f35ba939ff48e569105183fea64e8", "labels" => [] }, "toAddress" => %{ "address" => "0x876eabf441b2ee5b5b0554fd502a8e0600950cfa", "labels" => [] }, "trxHash" => "0xd4341953103d0d850d3284910213482dae5f7677c929f768d72f121e5a556fb3", "trxValue" => 2.5 }, %{ "datetime" => "2018-06-14T12:33:47Z", "fromAddress" => %{ "address" => "0x826d1ba25d5bf1485c755c8efecff3744f90d137", "labels" => [] }, "toAddress" => %{ "address" => "0x4976b5204c10a8de91cbc9224fb6d314454cf7d8", "labels" => [] }, "trxHash" => "0x398772430a2e39f5f1addfbba56b7db1e30e5417de52c15001e157e350c18e52", "trxValue" => 1.67 }, %{ "datetime" => "2018-06-15T12:33:47Z", "fromAddress" => %{ "address" => "0x4976b5204c10a8de91cbc9224fb6d314454cf7d8", "labels" => [] }, "toAddress" => %{ "address" => "0x876eabf441b2ee5b5b0554fd502a8e0600950cfa", "labels" => [] }, "trxHash" => "0x31a5d24e2fa078b88b49bd1180f6b29dfe145bb51b6f98543fe9bccf6e15bba2", "trxValue" => 1.67 }, %{ "datetime" => "2018-06-16T12:33:47Z", "fromAddress" => %{ "address" => "0x17125b59ac51cee029e4bd78d7f5947d1ea49bb2", "labels" => [] }, "toAddress" => %{ "address" => "0x0bd1b5cc4c63f99d00f4a3c5cad3619070c5c1c3", "labels" => [] }, "trxHash" => "0xa99da23a274c33d40d950fbc03bee7330e518ef6a9622ddd818cb9b967f9f520", "trxValue" => 1.0 }, %{ "datetime" => "2018-06-17T12:33:47Z", "fromAddress" => %{ "address" => "0x0bd1b5cc4c63f99d00f4a3c5cad3619070c5c1c3", "labels" => [] }, "toAddress" => %{ "address" => "0x5e575279bf9f4acf0a130c186861454247394c06", "labels" => [] }, "trxHash" => "0x2110456180d0990d1f58c375faab828bb85abc16fe5e56264e84f32864708f3b", "trxValue" => 1.0 }, %{ "datetime" => "2018-06-18T12:33:47Z", "fromAddress" => %{ "address" => "0x1f3df0b8390bb8e9e322972c5e75583e87608ec2", "labels" => [] }, "toAddress" => %{ "address" => "0x157dd308abb91ed2cd5a770bc1cf0fd458c7498c", "labels" => [] }, "trxHash" => "0x77ffc9c2ff1678d3f536357eb6e2a032981c98c46e541266ef152752f159187d", "trxValue" => 8.3 } ] } end end
34.190709
106
0.567363
0355c7164daf8bcd918c69aa42daefb6b77c58cc
10,027
ex
Elixir
scripts/gen_resources.ex
beaver21/SquareUp
c9791d96ed9335926933403a966eba5076fbc15b
[ "MIT" ]
4
2020-10-21T18:34:50.000Z
2022-03-16T06:25:44.000Z
scripts/gen_resources.ex
beaver21/SquareUp
c9791d96ed9335926933403a966eba5076fbc15b
[ "MIT" ]
5
2020-10-21T23:16:32.000Z
2021-05-13T13:42:44.000Z
scripts/gen_resources.ex
beaver21/SquareUp
c9791d96ed9335926933403a966eba5076fbc15b
[ "MIT" ]
3
2020-10-21T21:20:36.000Z
2021-03-15T18:00:30.000Z
defmodule GenResources do use Mix.Task @shortdoc "generate modules from api.json" @api File.read!("api.json") |> Jason.decode!() @impl Mix.Task def run(_args) do rm_resources() write_resources() write_norm_schema_module() write_typespecs_module() write_response_schemas_module() Mix.Tasks.Format.run(~w(lib/square_up/resources/**/*.ex)) end defp rm_resources() do Path.wildcard("lib/square_up/resources/**/*.ex") |> Enum.each(&File.rm/1) end defp write_resources() do endpoints = Map.get(@api, "paths") |> Enum.flat_map(fn {path, methods} -> Enum.map(methods, fn {method, defn} -> {path, method, defn} end) end) |> filter_deprecated() Enum.map(endpoints, fn {path, method, defn} -> mod_fun = Map.get(defn, "operationId") |> name_to_function() {mod_fun, {path, method, defn}} end) |> Enum.group_by(fn {{module, _fun}, {path, _, _}} -> [_, version | _] = String.split(path, "/") {module, version} end) |> Enum.map(&write_module/1) end defp write_module({{module, version}, endpoints}) do contents = """ defmodule SquareUp.#{String.upcase(version)}.#{module} do import Norm import SquareUp.Client, only: [call: 2] #{Enum.map(endpoints, &write_function/1)} end """ File.mkdir_p("lib/square_up/resources/#{String.downcase(version)}") File.write!( "lib/square_up/resources/#{String.downcase(version)}/#{Macro.underscore(module)}.ex", contents ) end defp write_function({{_module, function}, {path, method, defn}}) do {path_params, other_params} = Map.get(defn, "parameters") |> Enum.split_with(fn %{"in" => "path"} -> true _ -> false end) {params, query_params} = other_params |> Enum.split_with(fn %{"in" => "body"} -> true _ -> false end) success_response = Map.get(defn, "responses") |> Map.get("200") |> Map.get("schema") """ @spec #{function}(SquareUp.Client.t(), #{params_to_typespec(path_params)}, #{ params_to_typespec(params)}, #{params_to_typespec(query_params) }) :: SquareUp.Client.response(#{params_to_typespec(success_response)}) def #{function}(client, path_params \\\\ %{}, params \\\\ %{}, query_params \\\\ %{}) do path_params_spec = #{params_to_norm(path_params)} params_spec = #{params_to_norm(params)} query_params_spec = #{params_to_norm(query_params)} response_spec = #{response_to_spec(success_response)} call(client, %{ method: :#{method}, path_params: path_params, params: params, query_params: query_params, path_params_spec: path_params_spec, params_spec: params_spec, query_params_spec: query_params_spec, response_spec: response_spec, path: "#{path}" }) end """ end defp write_norm_schema_module() do definitions = Map.get(@api, "definitions") contents = """ defmodule SquareUp.NormSchema do import Norm #{Enum.map(definitions, &write_norm_definition/1)} end """ File.write!("lib/square_up/resources/norm_schema.ex", contents) end defp write_norm_definition({function, defn}) do """ def #{Macro.underscore(function)} do #{params_to_norm(defn)} end """ end defp write_typespecs_module() do definitions = Map.get(@api, "definitions") contents = """ defmodule SquareUp.TypeSpecs do #{Enum.map(definitions, &write_typespec/1)} end """ File.write!("lib/square_up/resources/typespecs.ex", contents) end defp write_typespec({function, defn}) do """ @type #{Macro.underscore(function)} :: #{params_to_typespec(defn)} """ end defp write_response_schemas_module() do definitions = Map.get(@api, "definitions") contents = """ defmodule SquareUp.ResponseSchema do #{Enum.map(definitions, &write_response_schema/1)} end """ File.write!("lib/square_up/resources/response_schema.ex", contents) end defp write_response_schema({function, defn}) do """ def #{Macro.underscore(function)} do #{response_to_spec(defn)} end """ end defp params_to_norm([%{"name" => "body"} = body]) do Map.delete(body, "name") |> params_to_norm() end defp params_to_norm(list) when is_list(list) do "schema(%{#{Enum.map(list, &params_to_norm/1) |> Enum.join(",")}})" end defp params_to_norm(%{"properties" => props} = defn) do """ schema(%{#{Enum.map(props, &params_to_norm/1) |> Enum.join(",")}}) |> selection([#{ Map.get(defn, "required", []) |> Enum.map(fn string -> ":#{string}" end) |> Enum.join(", ") }]) """ end defp params_to_norm(%{"name" => name} = param) do ~s[#{name}: #{params_to_norm(Map.delete(param, "name"))}] end defp params_to_norm(%{"schema" => %{"$ref" => schema}}) do "#/definitions/" <> function = schema ~s[Norm.Delegate.delegate(&SquareUp.NormSchema.#{Macro.underscore(function)}/0)] end defp params_to_norm(%{"$ref" => schema}) do "#/definitions/" <> function = schema ~s[Norm.Delegate.delegate(&SquareUp.NormSchema.#{Macro.underscore(function)}/0)] end defp params_to_norm(%{"type" => "integer"}) do "spec(is_integer())" end defp params_to_norm(%{"type" => "boolean"}) do "spec(is_boolean())" end defp params_to_norm(%{"type" => "string"}) do "spec(is_binary())" end defp params_to_norm(%{"type" => "number"}) do "spec(is_number())" end defp params_to_norm(%{"type" => "object"}) do "schema(%{})" end defp params_to_norm(%{"items" => item, "type" => "array"}) do "spec(coll_of(#{params_to_norm(item)}))" end defp params_to_norm({name, param = %{}}) do params_to_norm(Map.put(param, "name", name)) end # params_to_typespec defp params_to_typespec([%{"name" => "body"} = body]) do Map.delete(body, "name") |> params_to_typespec() end defp params_to_typespec(list) when is_list(list) do "%{#{Enum.map(list, &params_to_typespec/1) |> Enum.join(",")}}" end defp params_to_typespec(%{"properties" => props} = defn) do required = Map.get(defn, "required", []) props = Enum.map(props, fn {key, val} = prop -> if key in required do {key, Map.put(val, "required", true)} else prop end end) """ %{#{Enum.map(props, &params_to_typespec/1) |> Enum.join(",")}} """ end defp params_to_typespec(%{"name" => name, "required" => true} = param) do ~s[required(:#{name}) => #{params_to_typespec(Map.delete(param, "name"))}] end defp params_to_typespec(%{"name" => name} = param) do ~s[optional(:#{name}) => #{params_to_typespec(Map.delete(param, "name"))}] end defp params_to_typespec(%{"schema" => %{"$ref" => schema}}) do "#/definitions/" <> function = schema ~s[SquareUp.TypeSpecs.#{Macro.underscore(function)}()] end defp params_to_typespec(%{"$ref" => schema}) do "#/definitions/" <> function = schema ~s[SquareUp.TypeSpecs.#{Macro.underscore(function)}()] end defp params_to_typespec(%{"type" => "integer"}), do: "integer()" defp params_to_typespec(%{"type" => "boolean"}), do: "boolean()" defp params_to_typespec(%{"type" => "string"}), do: "binary()" defp params_to_typespec(%{"type" => "number"}), do: "number()" defp params_to_typespec(%{"type" => "object"}), do: "map()" defp params_to_typespec(%{"items" => item, "type" => "array"}) do "[#{params_to_typespec(item)}]" end defp params_to_typespec({name, param = %{}}) do params_to_typespec(Map.put(param, "name", name)) end # response_to_spec defp response_to_spec([%{"name" => "body"} = body]) do Map.delete(body, "name") |> response_to_spec() end defp response_to_spec(list) when is_list(list) do "%{#{Enum.map(list, &response_to_spec/1) |> Enum.join(",")}}" end defp response_to_spec(%{"properties" => props}) do ~s[%{#{Enum.map(props, &response_to_spec/1) |> Enum.join(",")}}] end defp response_to_spec(%{"name" => name} = param) do ~s[#{name}: #{response_to_spec(Map.delete(param, "name"))}] end defp response_to_spec(%{"schema" => %{"$ref" => schema}}) do "#/definitions/" <> function = schema ~s[{:delegate, &SquareUp.ResponseSchema.#{Macro.underscore(function)}/0}] end defp response_to_spec(%{"$ref" => schema}) do "#/definitions/" <> function = schema ~s[{:delegate, &SquareUp.ResponseSchema.#{Macro.underscore(function)}/0}] end defp response_to_spec(%{"type" => "integer"}), do: ":value" defp response_to_spec(%{"type" => "boolean"}), do: ":value" defp response_to_spec(%{"type" => "string"}), do: ":value" defp response_to_spec(%{"type" => "number"}), do: ":value" defp response_to_spec(%{"type" => "object"}), do: ":value" defp response_to_spec(%{"items" => item, "type" => "array"}) do "[#{response_to_spec(item)}]" end defp response_to_spec({name, param = %{}}) do response_to_spec(Map.put(param, "name", name)) end defp name_to_function("BulkUpdate" <> module), do: {module, "bulk_update"} defp name_to_function("BatchDelete" <> module), do: {module, "batch_delete"} defp name_to_function("AddGroupTo" <> module), do: {module, "add_group"} defp name_to_function("RemoveGroupFrom" <> module), do: {module, "remove_group"} defp name_to_function("BatchRetrieve" <> module), do: {module, "batch_retrieve"} defp name_to_function("CancelPaymentByIdempotencyKey"), do: {"Payment", "cancel_by_idempotency_key"} defp name_to_function(name) do regex = ~r/^([A-Z][a-z]+)(.*)/ [_full, function, module] = Regex.run(regex, name) {module, Macro.underscore(function)} end defp filter_deprecated(endpoints) do Enum.filter(endpoints, fn {_, _, %{"x-is-deprecated" => true}} -> false _ -> true end) end end GenResources.run([])
28.648571
97
0.617932
0355d3ef3ff434096a8ef8bcb4b8729f3c8b24f8
347
exs
Elixir
priv/repo/seeds.exs
alex2chan/Phoenix-JWT-Auth-API
5313b41bb590db4c12bdc16f624c11a035d4d692
[ "MIT" ]
40
2018-05-20T21:30:30.000Z
2021-09-10T07:25:44.000Z
priv/repo/seeds.exs
alex2chan/Phoenix-JWT-Auth-API
5313b41bb590db4c12bdc16f624c11a035d4d692
[ "MIT" ]
3
2020-09-07T10:53:53.000Z
2022-02-12T21:45:34.000Z
priv/repo/seeds.exs
alex2chan/Phoenix-JWT-Auth-API
5313b41bb590db4c12bdc16f624c11a035d4d692
[ "MIT" ]
15
2018-06-07T08:16:20.000Z
2020-04-12T07:38:05.000Z
# Script for populating the database. You can run it as: # # mix run priv/repo/seeds.exs # # Inside the script, you can read and write to any of your # repositories directly: # # MyApi.Repo.insert!(%MyApi.SomeSchema{}) # # We recommend using the bang functions (`insert!`, `update!` # and so on) as they will fail if something goes wrong.
28.916667
61
0.70317
0355dbd21de16fd5c761b1226f303e05a30e57ea
1,131
exs
Elixir
config/config.exs
itsgreggreg/romanex
d50078fb6b91b7a7fe1d97f83354822407916e35
[ "Apache-2.0" ]
1
2021-03-10T23:30:03.000Z
2021-03-10T23:30:03.000Z
config/config.exs
itsgreggreg/romanex
d50078fb6b91b7a7fe1d97f83354822407916e35
[ "Apache-2.0" ]
null
null
null
config/config.exs
itsgreggreg/romanex
d50078fb6b91b7a7fe1d97f83354822407916e35
[ "Apache-2.0" ]
null
null
null
# This file is responsible for configuring your application # and its dependencies with the aid of the Mix.Config module. use Mix.Config # This configuration is loaded before any dependency and is restricted # to this project. If another project depends on this project, this # file won't be loaded nor affect the parent project. For this reason, # if you want to provide default values for your application for # 3rd-party users, it should be done in your "mix.exs" file. # You can configure for your application as: # # config :roman_numerals, key: :value # # And access this configuration in your application as: # # Application.get_env(:roman_numerals, :key) # # Or configure a 3rd-party app: # # config :logger, level: :info # # It is also possible to import configuration files, relative to this # directory. For example, you can emulate configuration per environment # by uncommenting the line below and defining dev.exs, test.exs and such. # Configuration from the imported file will override the ones defined # here (which is why it is important to import them last). # # import_config "#{Mix.env}.exs"
36.483871
73
0.7542
0355e0a4f3b8aa034a81e4bf73d92b6852d1d7ea
1,632
exs
Elixir
exercises/simple-cipher/simple_cipher.exs
jerith/elixir
9a3f2a2fbee26a7b6a6b3ad74a9e6d1ff2495ed4
[ "Apache-2.0" ]
2
2019-07-09T05:23:38.000Z
2019-07-29T01:39:59.000Z
exercises/simple-cipher/simple_cipher.exs
jerith/elixir
9a3f2a2fbee26a7b6a6b3ad74a9e6d1ff2495ed4
[ "Apache-2.0" ]
null
null
null
exercises/simple-cipher/simple_cipher.exs
jerith/elixir
9a3f2a2fbee26a7b6a6b3ad74a9e6d1ff2495ed4
[ "Apache-2.0" ]
1
2018-07-19T23:43:56.000Z
2018-07-19T23:43:56.000Z
defmodule SimpleCipher do @doc """ Given a `plaintext` and `key`, encode each character of the `plaintext` by shifting it by the corresponding letter in the alphabet shifted by the number of letters represented by the `key` character, repeating the `key` if it is shorter than the `plaintext`. For example, for the letter 'd', the alphabet is rotated to become: defghijklmnopqrstuvwxyzabc You would encode the `plaintext` by taking the current letter and mapping it to the letter in the same position in this rotated alphabet. abcdefghijklmnopqrstuvwxyz defghijklmnopqrstuvwxyzabc "a" becomes "d", "t" becomes "w", etc... Each letter in the `plaintext` will be encoded with the alphabet of the `key` character in the same position. If the `key` is shorter than the `plaintext`, repeat the `key`. Example: plaintext = "testing" key = "abc" The key should repeat to become the same length as the text, becoming "abcabca". If the key is longer than the text, only use as many letters of it as are necessary. """ def encode(plaintext, key) do end @doc """ Given a `ciphertext` and `key`, decode each character of the `ciphertext` by finding the corresponding letter in the alphabet shifted by the number of letters represented by the `key` character, repeating the `key` if it is shorter than the `ciphertext`. The same rules for key length and shifted alphabets apply as in `encode/2`, but you will go the opposite way, so "d" becomes "a", "w" becomes "t", etc..., depending on how much you shift the alphabet. """ def decode(ciphertext, key) do end end
33.306122
79
0.723652
03560fffa8a9549ee6b34093d71d2ebcd316ae8c
662
exs
Elixir
test/acceptance/html/hard_line_breaks_test.exs
manuel-rubio/earmark
d747d73d31e8b8fa39389b01fc67cc53d946b707
[ "Apache-1.1" ]
734
2015-01-05T19:08:00.000Z
2022-03-28T14:04:21.000Z
test/acceptance/html/hard_line_breaks_test.exs
manuel-rubio/earmark
d747d73d31e8b8fa39389b01fc67cc53d946b707
[ "Apache-1.1" ]
343
2015-01-01T04:56:57.000Z
2022-02-15T11:00:57.000Z
test/acceptance/html/hard_line_breaks_test.exs
manuel-rubio/earmark
d747d73d31e8b8fa39389b01fc67cc53d946b707
[ "Apache-1.1" ]
169
2015-02-26T15:18:05.000Z
2022-03-18T08:00:42.000Z
defmodule Acceptance.Html.HardLineBreaksTest do use Support.AcceptanceTestCase describe "gfm" do test "hard line breaks are enabled" do markdown = "line 1\nline 2\\\nline 3" html = "<p>\nline 1\nline 2 <br />\nline 3</p>\n" messages = [] assert as_html(markdown) == {:ok, html, messages} end end describe "no gfm" do test "hard line breaks are not enabled" do markdown = "line 1\nline 2\\\nline 3" html = "<p>\nline 1\nline 2\\\nline 3</p>\n" messages = [] assert as_html(markdown, gfm: false) == {:ok, html, messages} end end end # SPDX-License-Identifier: Apache-2.0
24.518519
67
0.607251
03561a55a6c2024fb494c6bcc397648d9c36f6ff
2,690
exs
Elixir
hello_phx/test/hello_phx_web/controllers/cms/page_controller_test.exs
benjohns1/phoenix-sandbox
58fa6650828882f684a37de7af48d9fb6bd39f59
[ "MIT" ]
null
null
null
hello_phx/test/hello_phx_web/controllers/cms/page_controller_test.exs
benjohns1/phoenix-sandbox
58fa6650828882f684a37de7af48d9fb6bd39f59
[ "MIT" ]
null
null
null
hello_phx/test/hello_phx_web/controllers/cms/page_controller_test.exs
benjohns1/phoenix-sandbox
58fa6650828882f684a37de7af48d9fb6bd39f59
[ "MIT" ]
null
null
null
defmodule HelloPhxWeb.CMS.PageControllerTest do use HelloPhxWeb.ConnCase alias HelloPhx.CMS @create_attrs %{body: "some body", title: "some title", views: 42} @update_attrs %{body: "some updated body", title: "some updated title", views: 43} @invalid_attrs %{body: nil, title: nil, views: nil} def fixture(:page) do {:ok, page} = CMS.create_page(@create_attrs) page end describe "index" do test "lists all pages", %{conn: conn} do conn = get conn, cms_page_path(conn, :index) assert html_response(conn, 200) =~ "Listing Pages" end end describe "new page" do test "renders form", %{conn: conn} do conn = get conn, cms_page_path(conn, :new) assert html_response(conn, 200) =~ "New Page" end end describe "create page" do test "redirects to show when data is valid", %{conn: conn} do conn = post conn, cms_page_path(conn, :create), page: @create_attrs assert %{id: id} = redirected_params(conn) assert redirected_to(conn) == cms_page_path(conn, :show, id) conn = get conn, cms_page_path(conn, :show, id) assert html_response(conn, 200) =~ "Show Page" end test "renders errors when data is invalid", %{conn: conn} do conn = post conn, cms_page_path(conn, :create), page: @invalid_attrs assert html_response(conn, 200) =~ "New Page" end end describe "edit page" do setup [:create_page] test "renders form for editing chosen page", %{conn: conn, page: page} do conn = get conn, cms_page_path(conn, :edit, page) assert html_response(conn, 200) =~ "Edit Page" end end describe "update page" do setup [:create_page] test "redirects when data is valid", %{conn: conn, page: page} do conn = put conn, cms_page_path(conn, :update, page), page: @update_attrs assert redirected_to(conn) == cms_page_path(conn, :show, page) conn = get conn, cms_page_path(conn, :show, page) assert html_response(conn, 200) =~ "some updated body" end test "renders errors when data is invalid", %{conn: conn, page: page} do conn = put conn, cms_page_path(conn, :update, page), page: @invalid_attrs assert html_response(conn, 200) =~ "Edit Page" end end describe "delete page" do setup [:create_page] test "deletes chosen page", %{conn: conn, page: page} do conn = delete conn, cms_page_path(conn, :delete, page) assert redirected_to(conn) == cms_page_path(conn, :index) assert_error_sent 404, fn -> get conn, cms_page_path(conn, :show, page) end end end defp create_page(_) do page = fixture(:page) {:ok, page: page} end end
30.224719
84
0.651301
03567cd98833596aed97e2dfda4bf27c4e5ab04e
498
exs
Elixir
phoenix_commerce/test/models/product_test.exs
enilsen16/elixir
b4d1d45858a25e4beb39e07de8685f3d93d6a520
[ "MIT" ]
null
null
null
phoenix_commerce/test/models/product_test.exs
enilsen16/elixir
b4d1d45858a25e4beb39e07de8685f3d93d6a520
[ "MIT" ]
null
null
null
phoenix_commerce/test/models/product_test.exs
enilsen16/elixir
b4d1d45858a25e4beb39e07de8685f3d93d6a520
[ "MIT" ]
null
null
null
defmodule PhoenixCommerce.ProductTest do use PhoenixCommerce.ModelCase alias PhoenixCommerce.Product @valid_attrs %{description: "some content", name: "some content", price: "120.5"} @invalid_attrs %{} test "changeset with valid attributes" do changeset = Product.changeset(%Product{}, @valid_attrs) assert changeset.valid? end test "changeset with invalid attributes" do changeset = Product.changeset(%Product{}, @invalid_attrs) refute changeset.valid? end end
26.210526
83
0.738956
03568daff09407507be00d51ebf772db6b4406a5
2,507
exs
Elixir
installer/templates/phx_single/config/dev.exs
seasharps/phoenix
95b9383c6a08be4ab1a0c8a7bbf6b6911d888ca1
[ "MIT" ]
null
null
null
installer/templates/phx_single/config/dev.exs
seasharps/phoenix
95b9383c6a08be4ab1a0c8a7bbf6b6911d888ca1
[ "MIT" ]
null
null
null
installer/templates/phx_single/config/dev.exs
seasharps/phoenix
95b9383c6a08be4ab1a0c8a7bbf6b6911d888ca1
[ "MIT" ]
null
null
null
import Config # For development, we disable any cache and enable # debugging and code reloading. # # The watchers configuration can be used to run external # watchers to your application. For example, we use it # with webpack to recompile .js and .css sources. config :<%= @app_name %>, <%= @endpoint_module %>, # Binding to loopback ipv4 address prevents access from other machines. # Change to `ip: {0, 0, 0, 0}` to allow access from other machines. http: [ip: {127, 0, 0, 1}, port: 4000], debug_errors: true, code_reloader: true, check_origin: false, watchers: <%= if @webpack do %>[ node: [ "node_modules/webpack/bin/webpack.js", "--mode", "development", "--watch", "--watch-options-stdin", cd: Path.expand("../assets", __DIR__) ] ]<% else %>[]<% end %> # ## SSL Support # # In order to use HTTPS in development, a self-signed # certificate can be generated by running the following # Mix task: # # mix phx.gen.cert # # Note that this task requires Erlang/OTP 20 or later. # Run `mix help phx.gen.cert` for more information. # # The `http:` config above can be replaced with: # # https: [ # port: 4001, # cipher_suite: :strong, # keyfile: "priv/cert/selfsigned_key.pem", # certfile: "priv/cert/selfsigned.pem" # ], # # If desired, both `http:` and `https:` keys can be # configured to run both http and https servers on # different ports.<%= if @html do %> # Watch static and templates for browser reloading. config :<%= @app_name %>, <%= @endpoint_module %>, live_reload: [ patterns: [ ~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",<%= if @gettext do %> ~r"priv/gettext/.*(po)$",<% end %> ~r"lib/<%= @lib_web_name %>/(live|views)/.*(ex)$", ~r"lib/<%= @lib_web_name %>/templates/.*(eex)$" ] ]<% end %><%= if @mailer do %> # By default, emails will not be sent in localhost. # Instead they are available at "/dev/mailbox". # Check the application router for details. config :<%= @app_name %>, <%= @web_namespace %>.Mailer, adapter: Swoosh.Adapters.Local<% end %> # Do not include metadata nor timestamps in development logs config :logger, :console, format: "[$level] $message\n" # Set a higher stacktrace during development. Avoid configuring such # in production as building large stacktraces may be expensive. config :phoenix, :stacktrace_depth, 20 # Initialize plugs at runtime for faster development compilation config :phoenix, :plug_init_mode, :runtime
32.558442
76
0.659354
0356d1637b24adbbc69316fba2ce8a02d45468b4
5,393
ex
Elixir
gen/envoy/config/filter/http/jwt_authn/v2alpha/config.pb.ex
aclemmensen/relay
4bce71ed7d8bd4936f96d62ed08d007729c4253d
[ "BSD-3-Clause" ]
5
2018-10-12T13:13:19.000Z
2020-10-03T17:51:37.000Z
gen/envoy/config/filter/http/jwt_authn/v2alpha/config.pb.ex
aclemmensen/relay
4bce71ed7d8bd4936f96d62ed08d007729c4253d
[ "BSD-3-Clause" ]
207
2018-02-09T14:24:14.000Z
2020-07-25T11:09:19.000Z
gen/envoy/config/filter/http/jwt_authn/v2alpha/config.pb.ex
aclemmensen/relay
4bce71ed7d8bd4936f96d62ed08d007729c4253d
[ "BSD-3-Clause" ]
1
2019-08-08T11:30:59.000Z
2019-08-08T11:30:59.000Z
defmodule Envoy.Config.Filter.Http.JwtAuthn.V2alpha.JwtProvider do @moduledoc false use Protobuf, syntax: :proto3 @type t :: %__MODULE__{ jwks_source_specifier: {atom, any}, issuer: String.t(), audiences: [String.t()], forward: boolean, from_headers: [Envoy.Config.Filter.Http.JwtAuthn.V2alpha.JwtHeader.t()], from_params: [String.t()], forward_payload_header: String.t() } defstruct [ :jwks_source_specifier, :issuer, :audiences, :forward, :from_headers, :from_params, :forward_payload_header ] oneof :jwks_source_specifier, 0 field :issuer, 1, type: :string field :audiences, 2, repeated: true, type: :string field :remote_jwks, 3, type: Envoy.Config.Filter.Http.JwtAuthn.V2alpha.RemoteJwks, oneof: 0 field :local_jwks, 4, type: Envoy.Api.V2.Core.DataSource, oneof: 0 field :forward, 5, type: :bool field :from_headers, 6, repeated: true, type: Envoy.Config.Filter.Http.JwtAuthn.V2alpha.JwtHeader field :from_params, 7, repeated: true, type: :string field :forward_payload_header, 8, type: :string end defmodule Envoy.Config.Filter.Http.JwtAuthn.V2alpha.RemoteJwks do @moduledoc false use Protobuf, syntax: :proto3 @type t :: %__MODULE__{ http_uri: Envoy.Api.V2.Core.HttpUri.t() | nil, cache_duration: Google.Protobuf.Duration.t() | nil } defstruct [:http_uri, :cache_duration] field :http_uri, 1, type: Envoy.Api.V2.Core.HttpUri field :cache_duration, 2, type: Google.Protobuf.Duration end defmodule Envoy.Config.Filter.Http.JwtAuthn.V2alpha.JwtHeader do @moduledoc false use Protobuf, syntax: :proto3 @type t :: %__MODULE__{ name: String.t(), value_prefix: String.t() } defstruct [:name, :value_prefix] field :name, 1, type: :string field :value_prefix, 2, type: :string end defmodule Envoy.Config.Filter.Http.JwtAuthn.V2alpha.ProviderWithAudiences do @moduledoc false use Protobuf, syntax: :proto3 @type t :: %__MODULE__{ provider_name: String.t(), audiences: [String.t()] } defstruct [:provider_name, :audiences] field :provider_name, 1, type: :string field :audiences, 2, repeated: true, type: :string end defmodule Envoy.Config.Filter.Http.JwtAuthn.V2alpha.JwtRequirement do @moduledoc false use Protobuf, syntax: :proto3 @type t :: %__MODULE__{ requires_type: {atom, any} } defstruct [:requires_type] oneof :requires_type, 0 field :provider_name, 1, type: :string, oneof: 0 field :provider_and_audiences, 2, type: Envoy.Config.Filter.Http.JwtAuthn.V2alpha.ProviderWithAudiences, oneof: 0 field :requires_any, 3, type: Envoy.Config.Filter.Http.JwtAuthn.V2alpha.JwtRequirementOrList, oneof: 0 field :requires_all, 4, type: Envoy.Config.Filter.Http.JwtAuthn.V2alpha.JwtRequirementAndList, oneof: 0 field :allow_missing_or_failed, 5, type: Google.Protobuf.Empty, oneof: 0 end defmodule Envoy.Config.Filter.Http.JwtAuthn.V2alpha.JwtRequirementOrList do @moduledoc false use Protobuf, syntax: :proto3 @type t :: %__MODULE__{ requirements: [Envoy.Config.Filter.Http.JwtAuthn.V2alpha.JwtRequirement.t()] } defstruct [:requirements] field :requirements, 1, repeated: true, type: Envoy.Config.Filter.Http.JwtAuthn.V2alpha.JwtRequirement end defmodule Envoy.Config.Filter.Http.JwtAuthn.V2alpha.JwtRequirementAndList do @moduledoc false use Protobuf, syntax: :proto3 @type t :: %__MODULE__{ requirements: [Envoy.Config.Filter.Http.JwtAuthn.V2alpha.JwtRequirement.t()] } defstruct [:requirements] field :requirements, 1, repeated: true, type: Envoy.Config.Filter.Http.JwtAuthn.V2alpha.JwtRequirement end defmodule Envoy.Config.Filter.Http.JwtAuthn.V2alpha.RequirementRule do @moduledoc false use Protobuf, syntax: :proto3 @type t :: %__MODULE__{ match: Envoy.Api.V2.Route.RouteMatch.t() | nil, requires: Envoy.Config.Filter.Http.JwtAuthn.V2alpha.JwtRequirement.t() | nil } defstruct [:match, :requires] field :match, 1, type: Envoy.Api.V2.Route.RouteMatch field :requires, 2, type: Envoy.Config.Filter.Http.JwtAuthn.V2alpha.JwtRequirement end defmodule Envoy.Config.Filter.Http.JwtAuthn.V2alpha.JwtAuthentication do @moduledoc false use Protobuf, syntax: :proto3 @type t :: %__MODULE__{ providers: %{ String.t() => Envoy.Config.Filter.Http.JwtAuthn.V2alpha.JwtProvider.t() | nil }, rules: [Envoy.Config.Filter.Http.JwtAuthn.V2alpha.RequirementRule.t()] } defstruct [:providers, :rules] field :providers, 1, repeated: true, type: Envoy.Config.Filter.Http.JwtAuthn.V2alpha.JwtAuthentication.ProvidersEntry, map: true field :rules, 2, repeated: true, type: Envoy.Config.Filter.Http.JwtAuthn.V2alpha.RequirementRule end defmodule Envoy.Config.Filter.Http.JwtAuthn.V2alpha.JwtAuthentication.ProvidersEntry do @moduledoc false use Protobuf, map: true, syntax: :proto3 @type t :: %__MODULE__{ key: String.t(), value: Envoy.Config.Filter.Http.JwtAuthn.V2alpha.JwtProvider.t() | nil } defstruct [:key, :value] field :key, 1, type: :string field :value, 2, type: Envoy.Config.Filter.Http.JwtAuthn.V2alpha.JwtProvider end
29.469945
98
0.696088
0356d7c612a61b58cf11392883c6ae3c504d58bc
2,718
ex
Elixir
clients/home_graph/lib/google_api/home_graph/v1/model/sync_response.ex
kolorahl/elixir-google-api
46bec1e092eb84c6a79d06c72016cb1a13777fa6
[ "Apache-2.0" ]
null
null
null
clients/home_graph/lib/google_api/home_graph/v1/model/sync_response.ex
kolorahl/elixir-google-api
46bec1e092eb84c6a79d06c72016cb1a13777fa6
[ "Apache-2.0" ]
null
null
null
clients/home_graph/lib/google_api/home_graph/v1/model/sync_response.ex
kolorahl/elixir-google-api
46bec1e092eb84c6a79d06c72016cb1a13777fa6
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.HomeGraph.V1.Model.SyncResponse do @moduledoc """ Response type for the [`Sync`](#google.home.graph.v1.HomeGraphApiService.Sync) call. This should follow the same format as the Google smart home `action.devices.SYNC` [response](https://developers.google.com/assistant/smarthome/reference/intent/sync). # Example ```json { "requestId": "ff36a3cc-ec34-11e6-b1a0-64510650abcf", "payload": { "agentUserId": "1836.15267389", "devices": [{ "id": "123", "type": "action.devices.types.OUTLET", "traits": [ "action.devices.traits.OnOff" ], "name": { "defaultNames": ["My Outlet 1234"], "name": "Night light", "nicknames": ["wall plug"] }, "willReportState": false, "deviceInfo": { "manufacturer": "lights-out-inc", "model": "hs1234", "hwVersion": "3.2", "swVersion": "11.4" }, "customData": { "fooValue": 74, "barValue": true, "bazValue": "foo" } }] } } ``` ## Attributes * `payload` (*type:* `GoogleApi.HomeGraph.V1.Model.SyncResponsePayload.t`, *default:* `nil`) - Devices associated with the third-party user. * `requestId` (*type:* `String.t`, *default:* `nil`) - Request ID used for debugging. Copied from the request. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :payload => GoogleApi.HomeGraph.V1.Model.SyncResponsePayload.t(), :requestId => String.t() } field(:payload, as: GoogleApi.HomeGraph.V1.Model.SyncResponsePayload) field(:requestId) end defimpl Poison.Decoder, for: GoogleApi.HomeGraph.V1.Model.SyncResponse do def decode(value, options) do GoogleApi.HomeGraph.V1.Model.SyncResponse.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.HomeGraph.V1.Model.SyncResponse do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
30.886364
144
0.650478
0356db4afa665454728a5ce856ffb7e5d6128911
1,870
ex
Elixir
clients/container_analysis/lib/google_api/container_analysis/v1alpha1/model/installation.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
1
2021-12-20T03:40:53.000Z
2021-12-20T03:40:53.000Z
clients/container_analysis/lib/google_api/container_analysis/v1alpha1/model/installation.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
1
2020-08-18T00:11:23.000Z
2020-08-18T00:44:16.000Z
clients/container_analysis/lib/google_api/container_analysis/v1alpha1/model/installation.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.ContainerAnalysis.V1alpha1.Model.Installation do @moduledoc """ This represents how a particular software package may be installed on a system. ## Attributes * `location` (*type:* `list(GoogleApi.ContainerAnalysis.V1alpha1.Model.Location.t)`, *default:* `nil`) - All of the places within the filesystem versions of this package have been found. * `name` (*type:* `String.t`, *default:* `nil`) - Output only. The name of the installed package. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :location => list(GoogleApi.ContainerAnalysis.V1alpha1.Model.Location.t()) | nil, :name => String.t() | nil } field(:location, as: GoogleApi.ContainerAnalysis.V1alpha1.Model.Location, type: :list) field(:name) end defimpl Poison.Decoder, for: GoogleApi.ContainerAnalysis.V1alpha1.Model.Installation do def decode(value, options) do GoogleApi.ContainerAnalysis.V1alpha1.Model.Installation.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.ContainerAnalysis.V1alpha1.Model.Installation do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
37.4
190
0.742246
0357017f0faf797a4b5e834bef37c9cfcdac32c6
1,749
ex
Elixir
clients/docs/lib/google_api/docs/v1/model/delete_header_request.ex
medikent/elixir-google-api
98a83d4f7bfaeac15b67b04548711bb7e49f9490
[ "Apache-2.0" ]
null
null
null
clients/docs/lib/google_api/docs/v1/model/delete_header_request.ex
medikent/elixir-google-api
98a83d4f7bfaeac15b67b04548711bb7e49f9490
[ "Apache-2.0" ]
null
null
null
clients/docs/lib/google_api/docs/v1/model/delete_header_request.ex
medikent/elixir-google-api
98a83d4f7bfaeac15b67b04548711bb7e49f9490
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.Docs.V1.Model.DeleteHeaderRequest do @moduledoc """ Deletes a Header from the document. ## Attributes * `headerId` (*type:* `String.t`, *default:* `nil`) - The id of the header to delete. If this header is defined on DocumentStyle, the reference to this header is removed, resulting in no header of that type for the first section of the document. If this header is defined on a SectionStyle, the reference to this header is removed and the header of that type is now continued from the previous section. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :headerId => String.t() } field(:headerId) end defimpl Poison.Decoder, for: GoogleApi.Docs.V1.Model.DeleteHeaderRequest do def decode(value, options) do GoogleApi.Docs.V1.Model.DeleteHeaderRequest.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.Docs.V1.Model.DeleteHeaderRequest do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
33
118
0.731847
03572556a3953c7b5f7b6b35ca252d1f31d05a1f
1,361
ex
Elixir
lib/sanbase/short_url/short_url.ex
santiment/sanbase2
9ef6e2dd1e377744a6d2bba570ea6bd477a1db31
[ "MIT" ]
81
2017-11-20T01:20:22.000Z
2022-03-05T12:04:25.000Z
lib/sanbase/short_url/short_url.ex
rmoorman/sanbase2
226784ab43a24219e7332c49156b198d09a6dd85
[ "MIT" ]
359
2017-10-15T14:40:53.000Z
2022-01-25T13:34:20.000Z
lib/sanbase/short_url/short_url.ex
rmoorman/sanbase2
226784ab43a24219e7332c49156b198d09a6dd85
[ "MIT" ]
16
2017-11-19T13:57:40.000Z
2022-02-07T08:13:02.000Z
defmodule Sanbase.ShortUrl do use Ecto.Schema import Ecto.Query import Ecto.Changeset alias Sanbase.Repo @short_url_length 8 schema "short_urls" do field(:short_url, :string) field(:full_url, :string) field(:data, :string) belongs_to(:user, Sanbase.Accounts.User) timestamps() end def changeset(%__MODULE__{} = url, attrs \\ %{}) do url |> cast(attrs, [:full_url, :short_url, :user_id, :data]) |> validate_required([:full_url, :short_url]) |> unique_constraint(:short_url) end def create(%{full_url: full_url} = args) when is_binary(full_url) do short_url = :crypto.strong_rand_bytes(@short_url_length) |> Base.url_encode64(padding: false) |> binary_part(0, @short_url_length) %__MODULE__{} |> changeset(Map.put(args, :short_url, short_url)) |> Repo.insert() end def update(user_id, short_url, params) do case get(short_url) do %__MODULE__{user_id: ^user_id} = struct -> struct |> changeset(params) |> Repo.update() _ -> {:error, "The Short URL #{short_url} does not exist or belongs to another user and cannot be updated"} end end def get(short_url) when is_binary(short_url) do from( url in __MODULE__, where: url.short_url == ^short_url ) |> Repo.one() end end
22.683333
102
0.637766
035745e117a9465b63aabbec684377e80ec7eed9
1,173
exs
Elixir
clients/cloud_debugger/mix.exs
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
null
null
null
clients/cloud_debugger/mix.exs
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
null
null
null
clients/cloud_debugger/mix.exs
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
1
2020-11-10T16:58:27.000Z
2020-11-10T16:58:27.000Z
defmodule GoogleApi.CloudDebugger.V2.Mixfile do use Mix.Project @version "0.1.0" def project() do [ app: :google_api_cloud_debugger, version: @version, elixir: "~> 1.4", build_embedded: Mix.env == :prod, start_permanent: Mix.env == :prod, description: description(), package: package(), deps: deps(), source_url: "https://github.com/GoogleCloudPlatform/elixir-google-api/tree/master/clients/cloud_debugger" ] end def application() do [extra_applications: [:logger]] end defp deps() do [ {:google_gax, "~> 0.1.0"}, {:ex_doc, "~> 0.16", only: :dev} ] end defp description() do """ Examines the call stack and variables of a running application without stopping or slowing it down. """ end defp package() do [ files: ["lib", "mix.exs", "README*", "LICENSE"], maintainers: ["Jeff Ching"], licenses: ["Apache 2.0"], links: %{ "GitHub" => "https://github.com/GoogleCloudPlatform/elixir-google-api/tree/master/clients/cloud_debugger", "Homepage" => "https://cloud.google.com/debugger/" } ] end end
23.938776
114
0.602728
03574861ef3fe6b40d12d80d20213bef5afd6be6
41
exs
Elixir
v02/ch09/capture2.edit1.exs
oiax/elixir-primer
c8b89a29f108cc335b8e1341b7a1e90ec12adc66
[ "MIT" ]
null
null
null
v02/ch09/capture2.edit1.exs
oiax/elixir-primer
c8b89a29f108cc335b8e1341b7a1e90ec12adc66
[ "MIT" ]
null
null
null
v02/ch09/capture2.edit1.exs
oiax/elixir-primer
c8b89a29f108cc335b8e1341b7a1e90ec12adc66
[ "MIT" ]
null
null
null
func = &(&1 * &3) x = func.(7) IO.puts x
10.25
17
0.463415
035759cb8cde49a2a11e6a3389e202330d125297
30
ex
Elixir
lib/vagabond_sqs.ex
marcelobelli/VagabondSQS
25df6cfa890769399c52d0fdc603521b4f3be27b
[ "MIT" ]
null
null
null
lib/vagabond_sqs.ex
marcelobelli/VagabondSQS
25df6cfa890769399c52d0fdc603521b4f3be27b
[ "MIT" ]
1
2018-07-20T15:33:59.000Z
2019-06-05T19:46:17.000Z
lib/vagabond_sqs.ex
marcelobelli/VagabondSQS
25df6cfa890769399c52d0fdc603521b4f3be27b
[ "MIT" ]
null
null
null
defmodule VagabondSqs do end
7.5
24
0.833333
0357a1b2815db5ee35ee87bc312a7ea43b47f16f
2,167
ex
Elixir
lib/operation/send_document.ex
mpichette/hippy
46d7140b6374426812b2c21e7369345fbdf67b17
[ "MIT" ]
null
null
null
lib/operation/send_document.ex
mpichette/hippy
46d7140b6374426812b2c21e7369345fbdf67b17
[ "MIT" ]
null
null
null
lib/operation/send_document.ex
mpichette/hippy
46d7140b6374426812b2c21e7369345fbdf67b17
[ "MIT" ]
null
null
null
defmodule Hippy.Operation.SendDocument do @moduledoc """ Represents a request to cancel a print job from the time it's created up to the time it's completed, canceled, or aborted. """ @def_charset "utf-8" @def_lang "en" @def_username "hippy" @def_mime_media_type "application/octet-stream" @enforce_keys [:printer_uri, :job_id, :document] defstruct printer_uri: nil, job_id: nil, document: nil, charset: @def_charset, language: @def_lang, username: @def_username, document_name: nil, mime_type: @def_mime_media_type, last_document: true def new(printer_uri, job_id, document, opts \\ []) do default_name = generate_name() %__MODULE__{ printer_uri: printer_uri, charset: Keyword.get(opts, :charset, @def_charset), language: Keyword.get(opts, :language, @def_lang), job_id: job_id, document: document, document_name: Keyword.get(opts, :document_name, "doc-" <> default_name), username: Keyword.get(opts, :username, @def_username), mime_type: Keyword.get(opts, :mime_type, @def_mime_media_type), last_document: Keyword.get(opts, :last_document, true) } end defp generate_name, do: DateTime.to_iso8601(DateTime.utc_now(), :basic) end defimpl Hippy.Operation, for: Hippy.Operation.SendDocument do def build_request(op) do target = String.replace(op.printer_uri, ~r/^http(s)?/, "ipp") %Hippy.Request{ request_id: System.unique_integer([:positive, :monotonic]), operation_id: Hippy.Protocol.Operation.cancel_job(), operation_attributes: [ {:charset, "attributes-charset", op.charset}, {:natural_language, "attributes-natural-language", op.language}, {:uri, "printer-uri", target}, {:integer, "job-id", op.job_id}, {:name_without_language, "document-name", op.document_name}, {:name_without_language, "requesting-user-name", op.username}, {:mime_media_type, "document-format", op.mime_type}, {:boolean, "last-document", op.last_document} ], data: op.document } end end
33.859375
86
0.65713
0357adcbce91199713fc9aab67a624f7778b6b61
72
exs
Elixir
test/1000/practice_1088_test.exs
penqen/yukicoder-elixir
4f3e9e4694a14434cc3700280e9205226434733b
[ "MIT" ]
null
null
null
test/1000/practice_1088_test.exs
penqen/yukicoder-elixir
4f3e9e4694a14434cc3700280e9205226434733b
[ "MIT" ]
null
null
null
test/1000/practice_1088_test.exs
penqen/yukicoder-elixir
4f3e9e4694a14434cc3700280e9205226434733b
[ "MIT" ]
null
null
null
defmodule Practice1088Test do use ExUnit.Case doctest Practice1088 end
18
29
0.861111
0357c3fd836ef6183cd8d1175065fb0c2e135885
311
ex
Elixir
lib/flipay/guardian.ex
neofelisho/flipay
71a03a3f4c859892536faf600b93ff35da82fb88
[ "MIT" ]
null
null
null
lib/flipay/guardian.ex
neofelisho/flipay
71a03a3f4c859892536faf600b93ff35da82fb88
[ "MIT" ]
null
null
null
lib/flipay/guardian.ex
neofelisho/flipay
71a03a3f4c859892536faf600b93ff35da82fb88
[ "MIT" ]
null
null
null
defmodule Flipay.Guardian do @moduledoc false use Guardian, otp_app: :flipay def subject_for_token(user, _claims) do sub = to_string(user.id) {:ok, sub} end def resource_from_claims(claims) do id = claims["sub"] resource = Flipay.Accounts.get_user!(id) {:ok, resource} end end
19.4375
44
0.681672
035800f9572e3ce385bd9bf68103d7c7e274ddb4
1,796
exs
Elixir
test/lib/presence_agent_test.exs
smpallen99/ucx_chat
0dd98d0eb5e0537521844520ea2ba63a08fd3f19
[ "MIT" ]
60
2017-05-09T19:08:26.000Z
2021-01-20T11:09:42.000Z
test/lib/presence_agent_test.exs
smpallen99/ucx_chat
0dd98d0eb5e0537521844520ea2ba63a08fd3f19
[ "MIT" ]
6
2017-05-10T15:43:16.000Z
2020-07-15T07:14:41.000Z
test/lib/presence_agent_test.exs
smpallen99/ucx_chat
0dd98d0eb5e0537521844520ea2ba63a08fd3f19
[ "MIT" ]
10
2017-05-10T04:13:54.000Z
2020-12-28T10:30:27.000Z
defmodule UcxChat.PresenceAgentTest do use UcxChat.ModelCase alias UcxChat.PresenceAgent, as: Agent import UcxChat.TestHelpers setup do Agent.clear {:ok, user: insert_user()} end test "load", %{user: user} do assert Agent.get(user.id) == "offline" Agent.load user.id assert Agent.get(user.id) == "online" end test "load overide" do user = insert_user(%{chat_status: "busy"}) Agent.load user.id assert Agent.get(user.id) == "busy" end test "unload", %{user: user} do Agent.load user.id assert Agent.get(user.id) == "online" Agent.unload user.id assert Agent.get(user.id) == "offline" Agent.load user.id assert Agent.get(user.id) == "online" end test "put", %{user: user} do Agent.load user.id assert Agent.get(user.id) == "online" Agent.put user.id, "away" assert Agent.get(user.id) == "away" Agent.unload user.id assert Agent.get(user.id) == "offline" Agent.load user.id assert Agent.get(user.id) == "away" end test "update_presence", %{user: user} do Agent.load user.id assert Agent.get(user.id) == "online" Agent.update_presence user.id, "away" assert Agent.get(user.id) == "away" Agent.update_presence user.id, "online" assert Agent.get(user.id) == "online" Agent.update_presence user.id, "busy" assert Agent.get(user.id) == "busy" Agent.update_presence user.id, "online" assert Agent.get(user.id) == "online" Agent.put user.id, "away" assert Agent.get(user.id) == "away" Agent.update_presence user.id, "online" assert Agent.get(user.id) == "away" Agent.put user.id, "online" assert Agent.get(user.id) == "online" Agent.update_presence user.id, "busy" assert Agent.get(user.id) == "busy" end end
27.630769
46
0.644766
035801d5b4b40fc236987141383200a8d5b1fc17
857
ex
Elixir
lib/level_web/controllers/session_controller.ex
cas27/level
70f4c7ab696e426c4be5cdc0b71bca1dcc0fe21a
[ "Apache-2.0" ]
null
null
null
lib/level_web/controllers/session_controller.ex
cas27/level
70f4c7ab696e426c4be5cdc0b71bca1dcc0fe21a
[ "Apache-2.0" ]
null
null
null
lib/level_web/controllers/session_controller.ex
cas27/level
70f4c7ab696e426c4be5cdc0b71bca1dcc0fe21a
[ "Apache-2.0" ]
null
null
null
defmodule LevelWeb.SessionController do @moduledoc false use LevelWeb, :controller plug :fetch_current_user_by_session plug :redirect_if_signed_in def new(conn, _params) do render conn, "new.html" end def create(conn, %{"session" => %{"email" => email, "password" => pass}}) do case LevelWeb.Auth.sign_in_with_credentials(conn, email, pass) do {:ok, conn} -> conn |> put_flash(:info, "Welcome back!") |> redirect(to: space_path(conn, :index)) {:error, _reason, conn} -> conn |> put_flash(:error, "Oops, those credentials are not correct") |> render("new.html") end end defp redirect_if_signed_in(conn, _opts) do if conn.assigns.current_user do conn |> redirect(to: space_path(conn, :index)) |> halt() else conn end end end
23.162162
78
0.621937
03581d2e223b0df7a9f34e145ceb33234634614b
46,430
exs
Elixir
test/ecto/changeset/has_assoc_test.exs
lafka/ecto
3e796615c7a2ebd6961f576fda5d75faf85799a1
[ "Apache-2.0" ]
2
2021-02-25T15:51:16.000Z
2021-02-25T18:42:35.000Z
test/ecto/changeset/has_assoc_test.exs
lafka/ecto
3e796615c7a2ebd6961f576fda5d75faf85799a1
[ "Apache-2.0" ]
1
2021-03-09T16:43:23.000Z
2021-03-09T16:43:23.000Z
test/ecto/changeset/has_assoc_test.exs
lafka/ecto
3e796615c7a2ebd6961f576fda5d75faf85799a1
[ "Apache-2.0" ]
1
2018-06-18T14:47:58.000Z
2018-06-18T14:47:58.000Z
defmodule Ecto.Changeset.HasAssocTest do use ExUnit.Case, async: true alias Ecto.Changeset alias Ecto.Changeset.Relation alias Ecto.TestRepo alias __MODULE__.Author alias __MODULE__.Post alias __MODULE__.Profile defmodule Post do use Ecto.Schema schema "posts" do field :title, :string belongs_to :author, Author end def changeset(schema, params) do Changeset.cast(schema, params, ~w(title author_id)a) |> Changeset.validate_required(:title) end def set_action(schema, params) do changeset(schema, params) |> Map.put(:action, Map.get(params, :action, :update)) end end defmodule Author do use Ecto.Schema schema "authors" do field :title, :string has_many :posts, Post, on_replace: :delete, defaults: [title: "default"] has_many :raise_posts, Post, on_replace: :raise has_many :nilify_posts, Post, on_replace: :nilify, defaults: {__MODULE__, :send_to_self, [:extra]} has_many :invalid_posts, Post, on_replace: :mark_as_invalid has_one :profile, {"users_profiles", Profile}, defaults: [name: "default"], on_replace: :delete has_one :raise_profile, Profile, on_replace: :raise has_one :nilify_profile, Profile, on_replace: :nilify has_one :invalid_profile, Profile, on_replace: :mark_as_invalid has_one :update_profile, Profile, on_replace: :update, defaults: {__MODULE__, :send_to_self, [:extra]} end def send_to_self(struct, owner, extra) do send(self(), {:defaults, struct, owner, extra}) %{struct | id: 13} end end defmodule Profile do use Ecto.Schema schema "profiles" do field :name belongs_to :author, Author end def changeset(schema, params) do Changeset.cast(schema, params, ~w(name id)a) |> Changeset.validate_required(:name) end def optional_changeset(schema, params) do Changeset.cast(schema, params, ~w(name)a) end def failing_changeset(schema, params, error_string) do Changeset.cast(schema, params, ~w(name)a) |> Changeset.add_error(:name, error_string) end def set_action(schema, params) do changeset(schema, params) |> Map.put(:action, Map.get(params, :action, :update)) end end defp cast(schema, params, assoc, opts \\ []) do schema |> Changeset.cast(params, ~w()) |> Changeset.cast_assoc(assoc, opts) end ## cast has_one test "cast has_one with valid params" do changeset = cast(%Author{}, %{"profile" => %{"name" => "michal"}}, :profile) profile = changeset.changes.profile assert profile.changes == %{name: "michal"} assert profile.errors == [] assert profile.action == :insert assert profile.valid? assert changeset.valid? end test "cast has_one with invalid params" do changeset = cast(%Author{}, %{"profile" => %{name: nil}}, :profile) assert changeset.changes.profile.changes == %{} assert changeset.changes.profile.errors == [name: {"can't be blank", [validation: :required]}] assert changeset.changes.profile.action == :insert refute changeset.changes.profile.valid? refute changeset.valid? changeset = cast(%Author{}, %{"profile" => "value"}, :profile) assert changeset.errors == [profile: {"is invalid", [validation: :assoc, type: :map]}] refute changeset.valid? end test "cast has_one with existing struct updating" do changeset = cast(%Author{profile: %Profile{name: "michal", id: 1}}, %{"profile" => %{"name" => "new", "id" => 1}}, :profile) profile = changeset.changes.profile assert profile.changes == %{name: "new"} assert profile.errors == [] assert profile.action == :update assert profile.valid? assert changeset.valid? end test "cast has_one with empty value" do assert cast(%Author{}, %{"profile" => nil}, :profile).changes == %{profile: nil} assert cast(%Author{profile: nil}, %{"profile" => nil}, :profile).changes == %{} assert cast(%Author{}, %{"profile" => ""}, :profile).changes == %{} assert cast(%Author{profile: nil}, %{"profile" => ""}, :profile).changes == %{} loaded = put_in %Author{}.__meta__.state, :loaded assert_raise RuntimeError, ~r"attempting to cast or change association `profile` .* that was not loaded", fn -> cast(loaded, %{"profile" => nil}, :profile) end assert_raise RuntimeError, ~r"attempting to cast or change association `profile` .* that was not loaded", fn -> cast(loaded, %{"profile" => ""}, :profile) end assert cast(loaded, %{}, :profile).changes == %{} end test "cast has_one with existing struct replacing" do changeset = cast(%Author{profile: %Profile{name: "michal", id: 1}}, %{"profile" => %{"name" => "new"}}, :profile) profile = changeset.changes.profile assert profile.changes == %{name: "new"} assert profile.errors == [] assert profile.action == :insert assert profile.valid? assert changeset.valid? changeset = cast(%Author{profile: %Profile{name: "michal", id: 2}}, %{"profile" => %{"name" => "new", "id" => 5}}, :profile) profile = changeset.changes.profile assert profile.changes == %{name: "new", id: 5} assert profile.errors == [] assert profile.action == :insert assert profile.valid? assert changeset.valid? assert_raise RuntimeError, ~r"cannot update related", fn -> cast(%Author{profile: %Profile{name: "michal", id: "michal"}}, %{"profile" => %{"name" => "new", "id" => "new"}}, :profile, with: &Profile.set_action/2) end end test "cast has_one with existing struct updating from atom params" do # Emulate atom params from nested associations changeset = Changeset.cast(%Author{profile: %Profile{name: "michal", id: 3}}, %{}, ~w()) changeset = put_in changeset.params, %{"profile" => %{name: "new", id: 3}} changeset = Changeset.cast_assoc(changeset, :profile, []) profile = changeset.changes.profile assert profile.changes == %{name: "new"} assert profile.errors == [] assert profile.action == :update assert profile.valid? assert changeset.valid? end test "cast has_one without changes skips" do changeset = cast(%Author{profile: %Profile{name: "michal", id: 1}}, %{"profile" => %{"id" => 1}}, :profile) assert changeset.changes == %{} assert changeset.errors == [] changeset = cast(%Author{profile: %Profile{name: "michal", id: 1}}, %{"profile" => %{"id" => "1"}}, :profile) assert changeset.changes == %{} assert changeset.errors == [] end test "cast has_one when required" do changeset = cast(%Author{}, %{}, :profile, required: true) assert changeset.required == [:profile] assert changeset.changes == %{} assert changeset.errors == [profile: {"can't be blank", [validation: :required]}] changeset = cast(%Author{}, %{}, :profile, required: true, required_message: "a custom message") assert changeset.required == [:profile] assert changeset.changes == %{} assert changeset.errors == [profile: {"a custom message", [validation: :required]}] changeset = cast(%Author{profile: nil}, %{}, :profile, required: true) assert changeset.required == [:profile] assert changeset.changes == %{} assert changeset.errors == [profile: {"can't be blank", [validation: :required]}] changeset = cast(%Author{profile: %Profile{}}, %{}, :profile, required: true) assert changeset.required == [:profile] assert changeset.changes == %{} assert changeset.errors == [] changeset = cast(%Author{profile: nil}, %{"profile" => nil}, :profile, required: true) assert changeset.required == [:profile] assert changeset.changes == %{} assert changeset.errors == [profile: {"can't be blank", [validation: :required]}] changeset = cast(%Author{profile: %Profile{}}, %{"profile" => nil}, :profile, required: true) assert changeset.required == [:profile] assert changeset.changes == %{profile: nil} assert changeset.errors == [profile: {"can't be blank", [validation: :required]}] end test "cast has_one with `:force_update_on_change` option" do changeset = cast(%Author{}, %{profile: %{name: "michal"}}, :profile, force_update_on_change: true) assert changeset.repo_opts[:force] changeset = cast(%Author{}, %{profile: %{name: "michal"}}, :profile, force_update_on_change: false) assert changeset.repo_opts == [] changeset = cast(%Author{profile: %{name: "michal"}}, %{name: "michal"}, :profile, force_update_on_change: true) assert changeset.repo_opts == [] end test "cast has_one with optional" do changeset = cast(%Author{profile: %Profile{id: "id"}}, %{"profile" => nil}, :profile) assert changeset.changes.profile == nil assert changeset.valid? end test "cast has_one with custom changeset" do changeset = cast(%Author{}, %{"profile" => %{}}, :profile, with: &Profile.optional_changeset/2) assert (changeset.types.profile |> elem(1)).on_cast == &Profile.optional_changeset/2 profile = changeset.changes.profile assert profile.data.__meta__.source == "users_profiles" assert profile.changes == %{} assert profile.errors == [] assert profile.action == :insert assert profile.valid? assert changeset.valid? end test "cast has_one with custom changeset specified with mfa" do changeset = cast(%Author{}, %{"profile" => %{}}, :profile, with: {Profile, :failing_changeset, ["test"]}) assert changeset.changes.profile.errors == [name: {"test", []}] refute changeset.valid? end test "cast has_one keeps appropriate action from changeset" do changeset = cast(%Author{profile: %Profile{id: "id"}}, %{"profile" => %{"name" => "michal", "id" => "id"}}, :profile, with: &Profile.set_action/2) assert changeset.changes.profile.action == :update assert_raise RuntimeError, ~r"cannot update related", fn -> cast(%Author{profile: %Profile{id: "old"}}, %{"profile" => %{"name" => "michal", "id" => "new"}}, :profile, with: &Profile.set_action/2) end end test "cast has_one discards changesets marked as ignore" do changeset = cast(%Author{}, %{"profile" => %{name: "michal", id: "id", action: :ignore}}, :profile, with: &Profile.set_action/2) assert changeset.changes == %{} end test "cast has_one with empty parameters" do changeset = cast(%Author{profile: nil}, %{}, :profile) assert changeset.changes == %{} changeset = cast(%Author{}, %{}, :profile, required: true) assert changeset.changes == %{} changeset = cast(%Author{profile: %Profile{}}, %{}, :profile, required: true) assert changeset.changes == %{} end test "cast has_one with on_replace: :raise" do schema = %Author{raise_profile: %Profile{id: 1}} params = %{"raise_profile" => %{"name" => "jose", "id" => "1"}} changeset = cast(schema, params, :raise_profile) assert changeset.changes.raise_profile.action == :update params = %{"raise_profile" => nil} assert_raise RuntimeError, ~r"you are attempting to change relation", fn -> cast(schema, params, :raise_profile) end params = %{"raise_profile" => %{"name" => "new", "id" => 2}} assert_raise RuntimeError, ~r"you are attempting to change relation", fn -> cast(schema, params, :raise_profile) end end test "cast has_one with on_replace: :mark_as_invalid" do schema = %Author{invalid_profile: %Profile{id: 1}} changeset = cast(schema, %{"invalid_profile" => nil}, :invalid_profile) assert changeset.changes == %{} assert changeset.errors == [invalid_profile: {"is invalid", [validation: :assoc, type: :map]}] refute changeset.valid? changeset = cast(schema, %{"invalid_profile" => %{"id" => 2}}, :invalid_profile) assert changeset.changes == %{} assert changeset.errors == [invalid_profile: {"is invalid", [validation: :assoc, type: :map]}] refute changeset.valid? changeset = cast(schema, %{"invalid_profile" => nil}, :invalid_profile, invalid_message: "a custom message") assert changeset.changes == %{} assert changeset.errors == [invalid_profile: {"a custom message", [validation: :assoc, type: :map]}] refute changeset.valid? end test "cast has_one with keyword defaults" do {:ok, schema} = TestRepo.insert(%Author{title: "Title", profile: nil}) changeset = cast(schema, %{"profile" => %{id: 2}}, :profile) assert changeset.changes.profile.data.name == "default" assert changeset.changes.profile.changes == %{id: 2} end test "cast has_one with MFA defaults" do {:ok, schema} = TestRepo.insert(%Author{title: "Title", update_profile: nil}) changeset = cast(schema, %{"update_profile" => %{name: "Jose"}}, :update_profile) assert_received {:defaults, %Profile{id: nil}, %Author{title: "Title"}, :extra} assert changeset.changes.update_profile.data.id == 13 assert changeset.changes.update_profile.changes == %{name: "Jose"} end test "cast has_one with on_replace: :update" do {:ok, schema} = TestRepo.insert(%Author{title: "Title", update_profile: %Profile{id: 1, name: "Enio"}}) changeset = cast(schema, %{"update_profile" => %{id: 2, name: "Jose"}}, :update_profile) assert changeset.changes.update_profile.changes == %{name: "Jose", id: 2} assert changeset.changes.update_profile.action == :update assert changeset.errors == [] assert changeset.valid? end test "raises when :update is used on has_many" do error_message = ~r"invalid `:on_replace` option for :tags. The only valid options are" assert_raise ArgumentError, error_message, fn -> defmodule Topic do use Ecto.Schema schema "topics" do has_many :tags, Tag, on_replace: :update end end end end test "cast has_one twice" do schema = %Author{} params = %{profile: %{name: "Bruce Wayne", id: 1}} schema = cast(schema, params, :profile) |> Changeset.apply_changes params = %{profile: %{name: "Batman", id: 1}} changeset = cast(schema, params, :profile) changeset = cast(changeset, params, :profile) assert changeset.valid? schema = %Author{} params = %{profile: %{name: "Bruce Wayne"}} changeset = cast(schema, params, :profile) changeset = cast(changeset, params, :profile) assert changeset.valid? end ## cast has_many test "cast has_many with only new schemas" do changeset = cast(%Author{}, %{"posts" => [%{"title" => "hello"}]}, :posts) [post_change] = changeset.changes.posts assert post_change.changes == %{title: "hello"} assert post_change.errors == [] assert post_change.action == :insert assert post_change.valid? assert changeset.valid? end test "cast has_many with map" do changeset = cast(%Author{}, %{"posts" => %{0 => %{"title" => "hello"}}}, :posts) [post_change] = changeset.changes.posts assert post_change.changes == %{title: "hello"} assert post_change.errors == [] assert post_change.action == :insert assert post_change.valid? assert changeset.valid? end test "cast has_many with empty posts" do assert cast(%Author{}, %{"posts" => []}, :posts).changes == %{posts: []} assert cast(%Author{posts: []}, %{"posts" => []}, :posts).changes == %{} loaded = put_in %Author{}.__meta__.state, :loaded assert_raise RuntimeError, ~r"attempting to cast or change association `posts` .* that was not loaded", fn -> cast(loaded, %{"posts" => []}, :posts) end assert cast(loaded, %{}, :posts).changes == %{} end # Please note the order is important in this test. test "cast has_many changing schemas" do posts = [%Post{title: "first", id: 1}, %Post{title: "second", id: 2}, %Post{title: "third", id: 3}] params = [%{"title" => "new"}, %{"id" => 2, "title" => nil}, %{"id" => 3, "title" => "new name"}] changeset = cast(%Author{posts: posts}, %{"posts" => params}, :posts) [first, new, second, third] = changeset.changes.posts assert first.data.id == 1 assert first.required == [] # Check for not running changeset function assert first.action == :replace assert first.valid? assert new.changes == %{title: "new"} assert new.action == :insert assert new.valid? assert second.data.id == 2 assert second.errors == [title: {"can't be blank", [validation: :required]}] assert second.action == :update refute second.valid? assert third.data.id == 3 assert third.action == :update assert third.valid? refute changeset.valid? end test "cast has_many with invalid operation" do params = %{"posts" => [%{"id" => 1, "title" => "new"}]} assert_raise RuntimeError, ~r"cannot update related", fn -> cast(%Author{posts: []}, params, :posts, with: &Post.set_action/2) end end test "cast has_many with invalid params" do changeset = cast(%Author{}, %{"posts" => "value"}, :posts) assert changeset.errors == [posts: {"is invalid", [validation: :assoc, type: {:array, :map}]}] refute changeset.valid? changeset = cast(%Author{}, %{"posts" => ["value"]}, :posts) assert changeset.errors == [posts: {"is invalid", [validation: :assoc, type: {:array, :map}]}] refute changeset.valid? changeset = cast(%Author{}, %{"posts" => nil}, :posts) assert changeset.errors == [posts: {"is invalid", [validation: :assoc, type: {:array, :map}]}] refute changeset.valid? changeset = cast(%Author{}, %{"posts" => %{"id" => "invalid"}}, :posts) assert changeset.errors == [posts: {"is invalid", [validation: :assoc, type: {:array, :map}]}] refute changeset.valid? end test "cast has_many without changes skips" do changeset = cast(%Author{posts: [%Post{title: "hello", id: 1}]}, %{"posts" => [%{"id" => 1}]}, :posts) assert changeset.changes == %{} end test "cast has_many discards changesets marked as ignore" do changeset = cast(%Author{}, %{"posts" => [%{title: "oops", action: :ignore}]}, :posts, with: &Post.set_action/2) assert changeset.changes == %{} posts = [ %{title: "hello", action: :insert}, %{title: "oops", action: :ignore}, %{title: "world", action: :insert} ] changeset = cast(%Author{}, %{"posts" => posts}, :posts, with: &Post.set_action/2) assert Enum.map(changeset.changes.posts, &Ecto.Changeset.get_change(&1, :title)) == ["hello", "world"] end test "cast has_many when required" do # Still no error because the loaded association is an empty list changeset = cast(%Author{}, %{posts: [%{title: "hello"}]}, :posts, required: true) assert changeset.required == [:posts] assert changeset.errors == [] changeset = cast(%Author{}, %{posts: []}, :posts, required: true) assert changeset.required == [:posts] assert changeset.changes == %{posts: []} assert changeset.errors == [posts: {"can't be blank", [validation: :required]}] changeset = cast(%Author{posts: [%Post{title: "hello", id: 1}]}, %{posts: []}, :posts, required: true) assert changeset.required == [:posts] assert changeset.errors == [posts: {"can't be blank", [validation: :required]}] changeset = cast(%Author{posts: []}, %{}, :posts, required: true) assert changeset.required == [:posts] assert changeset.changes == %{} assert changeset.errors == [posts: {"can't be blank", [validation: :required]}] changeset = cast(%Author{posts: [%Post{title: "hello", id: 1}]}, %{}, :posts, required: true) assert changeset.required == [:posts] assert changeset.changes == %{} assert changeset.errors == [] changeset = cast(%Author{posts: []}, %{"posts" => nil}, :posts, required: true) assert changeset.required == [:posts] assert changeset.changes == %{} assert changeset.errors == [posts: {"is invalid", [validation: :assoc, type: {:array, :map}]}] end test "cast has_many with `:force_update_on_change` option" do changeset = cast(%Author{}, %{posts: [%{title: "hello"}]}, :posts, force_update_on_change: true) assert changeset.repo_opts[:force] changeset = cast(%Author{}, %{posts: [%{title: "hello"}]}, :posts, force_update_on_change: false) assert changeset.repo_opts == [] changeset = cast(%Author{posts: [%Post{title: "hello"}]}, %{posts: [%{title: "hello"}]}, :posts, force_update_on_change: true) assert changeset.repo_opts == [] end test "cast has_many with empty parameters" do changeset = cast(%Author{posts: []}, %{}, :posts) assert changeset.changes == %{} changeset = cast(%Author{}, %{}, :posts) assert changeset.changes == %{} changeset = cast(%Author{posts: [%Post{}]}, %{}, :posts) assert changeset.changes == %{} end test "cast has_many with keyword defaults" do {:ok, schema} = TestRepo.insert(%Author{title: "Title", posts: []}) changeset = cast(schema, %{"posts" => [%{id: 2}]}, :posts) assert hd(changeset.changes.posts).data.title == "default" assert hd(changeset.changes.posts).changes == %{} end test "cast has_many with MFA defaults" do {:ok, schema} = TestRepo.insert(%Author{title: "Title", nilify_posts: []}) changeset = cast(schema, %{"nilify_posts" => [%{title: "Title"}]}, :nilify_posts) assert hd(changeset.changes.nilify_posts).data.id == 13 assert hd(changeset.changes.nilify_posts).changes == %{title: "Title"} end test "cast has_many with on_replace: :raise" do schema = %Author{raise_posts: [%Post{id: 1}]} assert_raise RuntimeError, ~r"you are attempting to change relation", fn -> cast(schema, %{"raise_posts" => []}, :raise_posts) end assert_raise RuntimeError, ~r"you are attempting to change relation", fn -> cast(schema, %{"raise_posts" => [%{"id" => 2}]}, :raise_posts) end end test "cast has_many with on_replace: :mark_as_invalid" do schema = %Author{invalid_posts: [%Post{id: 1}]} changeset = cast(schema, %{"invalid_posts" => []}, :invalid_posts) assert changeset.changes == %{} assert changeset.errors == [invalid_posts: {"is invalid", [validation: :assoc, type: {:array, :map}]}] refute changeset.valid? changeset = cast(schema, %{"invalid_posts" => [%{"id" => 2}]}, :invalid_posts) assert changeset.changes == %{} assert changeset.errors == [invalid_posts: {"is invalid", [validation: :assoc, type: {:array, :map}]}] refute changeset.valid? end test "cast has_many twice" do schema = %Author{} params = %{posts: [%{title: "hello", id: 1}]} schema = cast(schema, params, :posts) |> Changeset.apply_changes params = %{posts: []} changeset = cast(schema, params, :posts) changeset = cast(changeset, params, :posts) assert changeset.valid? schema = %Author{} params = %{posts: [%{title: "hello"}]} changeset = cast(schema, params, :posts) changeset = cast(changeset, params, :posts) assert changeset.valid? end ## Change test "change has_one" do assoc = Author.__schema__(:association, :profile) assert {:ok, nil, true} = Relation.change(assoc, nil, nil) assert {:ok, nil, true} = Relation.change(assoc, nil, %Profile{}) assoc_schema = %Profile{} assoc_schema_changeset = Changeset.change(assoc_schema, name: "michal") assert {:ok, changeset, true} = Relation.change(assoc, assoc_schema_changeset, nil) assert changeset.action == :insert assert changeset.changes == %{name: "michal"} assert {:ok, changeset, true} = Relation.change(assoc, assoc_schema_changeset, assoc_schema) assert changeset.action == :update assert changeset.changes == %{name: "michal"} assert :ignore = Relation.change(assoc, %{assoc_schema_changeset | action: :ignore}, nil) empty_changeset = Changeset.change(assoc_schema) assert :ignore = Relation.change(assoc, empty_changeset, assoc_schema) assoc_with_id = %Profile{id: 2} assert {:ok, _, true} = Relation.change(assoc, %Profile{id: 1}, assoc_with_id) end test "change has_one with attributes" do assoc = Author.__schema__(:association, :profile) assert {:ok, changeset, true} = Relation.change(assoc, %{name: "michal"}, nil) assert changeset.action == :insert assert changeset.changes == %{name: "michal"} profile = %Profile{name: "other"} |> Ecto.put_meta(state: :loaded) assert {:ok, changeset, true} = Relation.change(assoc, %{name: "michal"}, profile) assert changeset.action == :update assert changeset.changes == %{name: "michal"} assert {:ok, changeset, true} = Relation.change(assoc, [name: "michal"], profile) assert changeset.action == :update assert changeset.changes == %{name: "michal"} profile = %Profile{name: "other"} assert {:ok, changeset, true} = Relation.change(assoc, %{name: "michal"}, profile) assert changeset.action == :insert assert changeset.changes == %{name: "michal"} assert {:ok, changeset, true} = Relation.change(assoc, [name: "michal"], profile) assert changeset.action == :insert assert changeset.changes == %{name: "michal"} end test "change has_one with structs" do assoc = Author.__schema__(:association, :profile) profile = %Profile{name: "michal"} assert {:ok, changeset, true} = Relation.change(assoc, profile, nil) assert changeset.action == :insert assert {:ok, changeset, true} = Relation.change(assoc, Ecto.put_meta(profile, state: :loaded), nil) assert changeset.action == :update assert {:ok, changeset, true} = Relation.change(assoc, Ecto.put_meta(profile, state: :deleted), nil) assert changeset.action == :delete end test "change has_one with on_replace: :nilify" do # one case is handled inside repo profile = %Profile{id: 1, author_id: 5} changeset = cast(%Author{nilify_profile: profile}, %{"nilify_profile" => nil}, :nilify_profile) assert changeset.changes.nilify_profile == nil end test "change has_one keeps appropriate action from changeset" do assoc = Author.__schema__(:association, :profile) assoc_schema = %Profile{id: 1} # Adding changeset = %{Changeset.change(assoc_schema, name: "michal") | action: :insert} {:ok, changeset, _} = Relation.change(assoc, changeset, nil) assert changeset.action == :insert changeset = %{Changeset.change(assoc_schema) | action: :update} {:ok, changeset, _} = Relation.change(assoc, changeset, nil) assert changeset.action == :update changeset = %{Changeset.change(assoc_schema) | action: :delete} {:ok, changeset, _} = Relation.change(assoc, changeset, nil) assert changeset.action == :delete # Replacing changeset = %{Changeset.change(assoc_schema, name: "michal") | action: :insert} assert_raise RuntimeError, ~r/cannot insert related/, fn -> Relation.change(assoc, changeset, assoc_schema) end changeset = %{Changeset.change(assoc_schema) | action: :update} {:ok, changeset, _} = Relation.change(assoc, changeset, nil) assert changeset.action == :update changeset = %{Changeset.change(assoc_schema) | action: :delete} {:ok, changeset, _} = Relation.change(assoc, changeset, nil) assert changeset.action == :delete end test "change has_one with on_replace: :raise" do assoc_schema = %Profile{id: 1} base_changeset = Changeset.change(%Author{raise_profile: assoc_schema}) assert_raise RuntimeError, ~r"you are attempting to change relation", fn -> Changeset.put_assoc(base_changeset, :raise_profile, nil) end assert_raise RuntimeError, ~r"you are attempting to change relation", fn -> Changeset.put_assoc(base_changeset, :raise_profile, %Profile{id: 2}) end end test "change has_one with on_replace: :mark_as_invalid" do assoc_schema = %Profile{id: 1} base_changeset = Changeset.change(%Author{invalid_profile: assoc_schema}) changeset = Changeset.put_assoc(base_changeset, :invalid_profile, nil) assert changeset.changes == %{} assert changeset.errors == [invalid_profile: {"is invalid", [type: :map]}] refute changeset.valid? changeset = Changeset.put_assoc(base_changeset, :invalid_profile, %Profile{id: 2}) assert changeset.changes == %{} assert changeset.errors == [invalid_profile: {"is invalid", [type: :map]}] refute changeset.valid? end test "change has_many" do assoc = Author.__schema__(:association, :posts) assert {:ok, [], true} = Relation.change(assoc, [], []) assert {:ok, [old_changeset, new_changeset], true} = Relation.change(assoc, [%Post{id: 1}], [%Post{id: 2}]) assert old_changeset.action == :replace assert new_changeset.action == :insert assoc_schema_changeset = Changeset.change(%Post{}, title: "hello") assert {:ok, [changeset], true} = Relation.change(assoc, [assoc_schema_changeset], []) assert changeset.action == :insert assert changeset.changes == %{title: "hello"} assoc_schema = %Post{id: 1} assoc_schema_changeset = Changeset.change(assoc_schema, title: "hello") assert {:ok, [changeset], true} = Relation.change(assoc, [assoc_schema_changeset], [assoc_schema]) assert changeset.action == :update assert changeset.changes == %{title: "hello"} assert {:ok, [changeset], true} = Relation.change(assoc, [], [assoc_schema_changeset]) assert changeset.action == :replace assert :ignore = Relation.change(assoc, [%{assoc_schema_changeset | action: :ignore}], [assoc_schema]) assert :ignore = Relation.change(assoc, [%{assoc_schema_changeset | action: :ignore}], []) empty_changeset = Changeset.change(assoc_schema) assert :ignore = Relation.change(assoc, [empty_changeset], [assoc_schema]) end test "change has_many with attributes" do assoc = Author.__schema__(:association, :posts) assert {:ok, [changeset], true} = Relation.change(assoc, [%{title: "hello"}], []) assert changeset.action == :insert assert changeset.changes == %{title: "hello"} post = %Post{title: "other"} |> Ecto.put_meta(state: :loaded) assert {:ok, [changeset], true} = Relation.change(assoc, [%{title: "hello"}], [post]) assert changeset.action == :update assert changeset.changes == %{title: "hello"} assert {:ok, [changeset], true} = Relation.change(assoc, [[title: "hello"]], [post]) assert changeset.action == :update assert changeset.changes == %{title: "hello"} post = %Post{title: "other"} assert {:ok, [changeset], true} = Relation.change(assoc, [%{title: "hello"}], [post]) assert changeset.action == :insert assert changeset.changes == %{title: "hello"} assert {:ok, [changeset], true} = Relation.change(assoc, [[title: "hello"]], [post]) assert changeset.action == :insert assert changeset.changes == %{title: "hello"} end test "change has_many with structs" do assoc = Author.__schema__(:association, :posts) post = %Post{title: "hello"} assert {:ok, [changeset], true} = Relation.change(assoc, [post], []) assert changeset.action == :insert assert {:ok, [changeset], true} = Relation.change(assoc, [Ecto.put_meta(post, state: :loaded)], []) assert changeset.action == :update assert {:ok, [changeset], true} = Relation.change(assoc, [Ecto.put_meta(post, state: :deleted)], []) assert changeset.action == :delete end test "change has_many with on_replace: :nilify" do post = %Post{id: 1, author_id: 5} changeset = cast(%Author{nilify_posts: [post]}, %{"nilify_posts" => []}, :nilify_posts) [post_change] = changeset.changes.nilify_posts assert post_change.action == :replace assert post_change.changes == %{} end test "change has_many with on_replace: :raise" do assoc_schema = %Post{id: 1} base_changeset = Changeset.change(%Author{raise_posts: [assoc_schema]}) assert_raise RuntimeError, ~r"you are attempting to change relation", fn -> Changeset.put_assoc(base_changeset, :raise_posts, []) end assert_raise RuntimeError, ~r"you are attempting to change relation", fn -> Changeset.put_assoc(base_changeset, :raise_posts, [%Post{id: 2}]) end end test "change has_many with on_replace: :mark_as_invalid" do assoc_schema = %Post{id: 1} base_changeset = Changeset.change(%Author{invalid_posts: [assoc_schema]}) changeset = Changeset.put_assoc(base_changeset, :invalid_posts, []) assert changeset.changes == %{} assert changeset.errors == [invalid_posts: {"is invalid", [type: {:array, :map}]}] refute changeset.valid? changeset = Changeset.put_assoc(base_changeset, :invalid_posts, [%Post{id: 2}]) assert changeset.changes == %{} assert changeset.errors == [invalid_posts: {"is invalid", [type: {:array, :map}]}] refute changeset.valid? changeset = Changeset.put_assoc(base_changeset, :invalid_posts, []) assert changeset.changes == %{} assert changeset.errors == [invalid_posts: {"is invalid", [type: {:array, :map}]}] refute changeset.valid? changeset = Changeset.put_assoc(base_changeset, :invalid_posts, [%Post{id: 2}]) assert changeset.changes == %{} assert changeset.errors == [invalid_posts: {"is invalid", [type: {:array, :map}]}] refute changeset.valid? end ## Other test "put_assoc/4 with has_one" do base_changeset = Changeset.change(%Author{}) changeset = Changeset.put_assoc(base_changeset, :profile, %{name: "michal"}) assert %Ecto.Changeset{} = changeset.changes.profile assert changeset.changes.profile.action == :insert assert changeset.changes.profile.data.__meta__.source == "users_profiles" changeset = Changeset.put_assoc(base_changeset, :profile, [name: "michal"]) assert %Ecto.Changeset{} = changeset.changes.profile assert changeset.changes.profile.action == :insert assert changeset.changes.profile.data.__meta__.source == "users_profiles" changeset = Changeset.put_assoc(base_changeset, :profile, %Profile{name: "michal"}) assert %Ecto.Changeset{} = changeset.changes.profile assert changeset.changes.profile.action == :insert assert changeset.changes.profile.data.__meta__.source == "profiles" base_changeset = Changeset.change(%Author{profile: %Profile{name: "michal"}}) empty_update_changeset = Changeset.change(%Profile{name: "michal"}) changeset = Changeset.put_assoc(base_changeset, :profile, empty_update_changeset) refute Map.has_key?(changeset.changes, :profile) end test "put_assoc/4 with has_one and empty" do # On unloaded changeset = %Author{} |> Changeset.change() |> Changeset.put_assoc(:profile, nil) assert Map.has_key?(changeset.changes, :profile) # On empty changeset = %Author{profile: nil} |> Changeset.change() |> Changeset.put_assoc(:profile, nil) refute Map.has_key?(changeset.changes, :profile) end test "put_change/3 with has_one" do changeset = Changeset.change(%Author{}, profile: %{name: "michal"}) assert %Ecto.Changeset{} = changeset.changes.profile assert changeset.changes.profile.action == :insert base_changeset = Changeset.change(%Author{}) changeset = Changeset.put_change(base_changeset, :profile, [name: "michal"]) assert %Ecto.Changeset{} = changeset.changes.profile assert changeset.changes.profile.action == :insert changeset = Changeset.put_change(base_changeset, :profile, %Profile{name: "michal"}) assert %Ecto.Changeset{} = changeset.changes.profile assert changeset.changes.profile.action == :insert base_changeset = Changeset.change(%Author{profile: %Profile{name: "michal"}}) empty_update_changeset = Changeset.change(%Profile{name: "michal"}) changeset = Changeset.put_change(base_changeset, :profile, empty_update_changeset) refute Map.has_key?(changeset.changes, :profile) end test "put_assoc/4 with has_many" do base_changeset = Changeset.change(%Author{}) changeset = Changeset.put_assoc(base_changeset, :posts, [%{title: "hello"}]) assert [%Ecto.Changeset{}] = changeset.changes.posts assert hd(changeset.changes.posts).action == :insert changeset = Changeset.put_assoc(base_changeset, :posts, [[title: "hello"]]) assert [%Ecto.Changeset{}] = changeset.changes.posts assert hd(changeset.changes.posts).action == :insert changeset = Changeset.put_assoc(base_changeset, :posts, [%Post{title: "hello"}]) assert [%Ecto.Changeset{}] = changeset.changes.posts assert hd(changeset.changes.posts).action == :insert base_changeset = Changeset.change(%Author{posts: [%Post{title: "hello"}]}) empty_update_changeset = Changeset.change(%Post{title: "hello"}) changeset = Changeset.put_assoc(base_changeset, :posts, [empty_update_changeset]) refute Map.has_key?(changeset.changes, :posts) end test "put_assoc/4 with has_many and empty" do # On unloaded changeset = %Author{} |> Changeset.change() |> Changeset.put_assoc(:posts, []) assert Map.has_key?(changeset.changes, :posts) # On empty changeset = %Author{posts: []} |> Changeset.change() |> Changeset.put_assoc(:posts, []) refute Map.has_key?(changeset.changes, :posts) end test "put_change/3 with has_many" do changeset = Changeset.change(%Author{}, posts: [%{title: "hello"}]) assert [%Ecto.Changeset{}] = changeset.changes.posts assert hd(changeset.changes.posts).action == :insert base_changeset = Changeset.change(%Author{}) changeset = Changeset.put_change(base_changeset, :posts, [[title: "hello"]]) assert [%Ecto.Changeset{}] = changeset.changes.posts assert hd(changeset.changes.posts).action == :insert changeset = Changeset.put_change(base_changeset, :posts, [%Post{title: "hello"}]) assert [%Ecto.Changeset{}] = changeset.changes.posts assert hd(changeset.changes.posts).action == :insert base_changeset = Changeset.change(%Author{posts: [%Post{title: "hello"}]}) empty_update_changeset = Changeset.change(%Post{title: "hello"}) changeset = Changeset.put_change(base_changeset, :posts, [empty_update_changeset]) refute Map.has_key?(changeset.changes, :posts) end test "put_assoc/4 raises on invalid changeset" do assert_raise ArgumentError, ~r/expected changeset data to be a Elixir.Ecto.Changeset.HasAssocTest.Profile/, fn -> Changeset.change(%Author{}, profile: %Author{}) end assert_raise ArgumentError, ~r/expected changeset data to be a Elixir.Ecto.Changeset.HasAssocTest.Post/, fn -> Changeset.change(%Author{}, posts: [%Author{}]) end end test "put_assoc/4 when replacing" do profile = %Profile{id: 1, name: "michal"} |> Ecto.put_meta(state: :loaded) base_changeset = Changeset.change(%Author{profile: profile}) changeset = Changeset.put_assoc(base_changeset, :profile, %{name: "michal"}) assert %Ecto.Changeset{} = changeset.changes.profile assert changeset.changes.profile.action == :insert assert changeset.changes.profile.changes == %{name: "michal"} changeset = Changeset.put_assoc(base_changeset, :profile, %Profile{name: "michal"}) assert %Ecto.Changeset{} = changeset.changes.profile assert changeset.changes.profile.action == :insert assert changeset.changes.profile.changes == %{} changeset = Changeset.put_assoc(base_changeset, :profile, %{id: 1, name: "michal"}) refute Map.has_key?(changeset.changes, :profile) changeset = Changeset.put_assoc(base_changeset, :profile, %Profile{id: 1, name: "michal"}) refute Map.has_key?(changeset.changes, :profile) changeset = Changeset.put_assoc(base_changeset, :profile, %{id: 1, name: "jose"}) assert %Ecto.Changeset{} = changeset.changes.profile assert changeset.changes.profile.action == :update assert changeset.changes.profile.changes == %{name: "jose"} end test "get_field/3, fetch_field/2 with has one" do profile_changeset = Changeset.change(%Profile{}, name: "michal") profile = Changeset.apply_changes(profile_changeset) changeset = %Author{} |> Changeset.change |> Changeset.put_assoc(:profile, profile_changeset) assert Changeset.get_field(changeset, :profile) == profile assert Changeset.fetch_field(changeset, :profile) == {:changes, profile} changeset = Changeset.change(%Author{profile: profile}) assert Changeset.get_field(changeset, :profile) == profile assert Changeset.fetch_field(changeset, :profile) == {:data, profile} changeset = Changeset.change(%Author{}) assert Changeset.get_field(changeset, :profile) == nil assert Changeset.fetch_field(changeset, :profile) == {:data, nil} schema = put_in(%Author{}.__meta__.state, :loaded) changeset = Changeset.change(schema) assert_raise RuntimeError, ~r"Please preload", fn -> Changeset.get_field(changeset, :profile) end assert_raise RuntimeError, ~r"Please preload", fn -> Changeset.fetch_field(changeset, :profile) end end test "get_field/3, fetch_field/2 with has many" do post = %Post{id: 1} changeset = %Author{posts: [post]} |> Changeset.change assert Changeset.get_field(changeset, :posts) == [post] assert Changeset.fetch_field(changeset, :posts) == {:data, [post]} post_changeset = Changeset.change(post, title: "updated") changeset = %Author{posts: [post]} |> Changeset.change |> Changeset.put_assoc(:posts, [post_changeset]) assert Changeset.get_field(changeset, :posts) == [%{post | title: "updated"}] assert Changeset.fetch_field(changeset, :posts) == {:changes, [%{post | title: "updated"}]} post_changeset = %{Changeset.change(post) | action: :delete} changeset = %Author{posts: [post]} |> Changeset.change |> Changeset.put_assoc(:posts, [post_changeset]) assert Changeset.get_field(changeset, :posts) == [] assert Changeset.fetch_field(changeset, :posts) == {:changes, []} changeset = Changeset.change(%Author{}) assert Changeset.get_field(changeset, :posts) == [] assert Changeset.fetch_field(changeset, :posts) == {:data, []} schema = put_in(%Author{}.__meta__.state, :loaded) changeset = Changeset.change(schema) assert_raise RuntimeError, ~r"Please preload", fn -> Changeset.get_field(changeset, :posts) end assert_raise RuntimeError, ~r"Please preload", fn -> Changeset.fetch_field(changeset, :posts) end end test "apply_changes" do assoc = Author.__schema__(:association, :profile) changeset = Changeset.change(%Profile{}, name: "michal") schema = Relation.apply_changes(assoc, changeset) assert schema == %Profile{name: "michal"} changeset1 = Changeset.change(%Post{}, title: "hello") changeset2 = %{changeset1 | action: :delete} assert Relation.apply_changes(assoc, changeset2) == nil assoc = Author.__schema__(:association, :posts) [schema] = Relation.apply_changes(assoc, [changeset1, changeset2]) assert schema == %Post{title: "hello"} end ## traverse_errors test "traverses changeset errors with has_one when required" do changeset = cast(%Author{}, %{profile: %{}}, :profile, required: true) assert changeset.errors == [] assert Changeset.traverse_errors(changeset, &(&1)) == %{} changeset = cast(%Author{}, %{}, :profile, required: true) assert changeset.errors == [profile: {"can't be blank", [validation: :required]}] assert Changeset.traverse_errors(changeset, &(&1)) == %{profile: [{"can't be blank", [validation: :required]}]} changeset = cast(%Author{}, %{"profile" => nil}, :profile, required: true) assert changeset.errors == [profile: {"can't be blank", [validation: :required]}] assert Changeset.traverse_errors(changeset, &(&1)) == %{profile: [{"can't be blank", [validation: :required]}]} changeset = cast(%Author{}, %{}, :profile, required: true, required_message: "a custom message") assert changeset.errors == [profile: {"a custom message", [validation: :required]}] assert Changeset.traverse_errors(changeset, &(&1)) == %{profile: [{"a custom message", [validation: :required]}]} changeset = cast(%Author{}, %{"profile" => %{name: nil}}, :profile, required: true) assert changeset.errors == [] assert Changeset.traverse_errors(changeset, &(&1)) == %{profile: %{name: [{"can't be blank", [validation: :required]}]}} end test "traverses changeset errors with has_many when required" do changeset = cast(%Author{}, %{posts: [%{title: "hello"}]}, :posts, required: true) assert changeset.errors == [] assert Changeset.traverse_errors(changeset, &(&1)) == %{} changeset = cast(%Author{}, %{posts: [%{title: nil}]}, :posts, required: true) assert changeset.errors == [] assert Changeset.traverse_errors(changeset, &(&1)) == %{posts: [%{title: [{"can't be blank", [validation: :required]}]}]} changeset = cast(%Author{posts: []}, %{}, :posts, required: true) assert changeset.errors == [posts: {"can't be blank", [validation: :required]}] assert Changeset.traverse_errors(changeset, &(&1)) == %{posts: [{"can't be blank", [validation: :required]}]} changeset = cast(%Author{posts: []}, %{"posts" => nil}, :posts, required: true) assert changeset.errors == [posts: {"is invalid", [validation: :assoc, type: {:array, :map}]}] assert Changeset.traverse_errors(changeset, &(&1)) == %{posts: [{"is invalid", [validation: :assoc, type: {:array, :map}]}]} changeset = cast(%Author{}, %{posts: []}, :posts, required: true) assert changeset.errors == [posts: {"can't be blank", [validation: :required]}] assert Changeset.traverse_errors(changeset, &(&1)) == %{posts: [{"can't be blank", [validation: :required]}]} end end
38.886097
128
0.653134
0358272d8756e46a3a73cb9139c4739ded4d577e
3,636
ex
Elixir
clients/games/lib/google_api/games/v1/model/turn_based_match_participant.ex
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
null
null
null
clients/games/lib/google_api/games/v1/model/turn_based_match_participant.ex
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
null
null
null
clients/games/lib/google_api/games/v1/model/turn_based_match_participant.ex
leandrocp/elixir-google-api
a86e46907f396d40aeff8668c3bd81662f44c71e
[ "Apache-2.0" ]
1
2020-11-10T16:58:27.000Z
2020-11-10T16:58:27.000Z
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an &quot;AS IS&quot; BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This class is auto generated by the swagger code generator program. # https://github.com/swagger-api/swagger-codegen.git # Do not edit the class manually. defmodule GoogleApi.Games.V1.Model.TurnBasedMatchParticipant do @moduledoc """ This is a JSON template for a participant in a turn-based match. ## Attributes - autoMatched (boolean()): True if this participant was auto-matched with the requesting player. Defaults to: `null`. - autoMatchedPlayer (AnonymousPlayer): Information about a player that has been anonymously auto-matched against the requesting player. (Either player or autoMatchedPlayer will be set.) Defaults to: `null`. - id (String.t): An identifier for the participant in the scope of the match. Cannot be used to identify a player across matches or in other contexts. Defaults to: `null`. - kind (String.t): Uniquely identifies the type of this resource. Value is always the fixed string games#turnBasedMatchParticipant. Defaults to: `null`. - player (Player): Information about the player. Not populated if this player was anonymously auto-matched against the requesting player. (Either player or autoMatchedPlayer will be set.) Defaults to: `null`. - status (String.t): The status of the participant with respect to the match. Possible values are: - \&quot;PARTICIPANT_NOT_INVITED_YET\&quot; - The participant is slated to be invited to the match, but the invitation has not been sent; the invite will be sent when it becomes their turn. - \&quot;PARTICIPANT_INVITED\&quot; - The participant has been invited to join the match, but has not yet responded. - \&quot;PARTICIPANT_JOINED\&quot; - The participant has joined the match (either after creating it or accepting an invitation.) - \&quot;PARTICIPANT_DECLINED\&quot; - The participant declined an invitation to join the match. - \&quot;PARTICIPANT_LEFT\&quot; - The participant joined the match and then left it. - \&quot;PARTICIPANT_FINISHED\&quot; - The participant finished playing in the match. - \&quot;PARTICIPANT_UNRESPONSIVE\&quot; - The participant did not take their turn in the allotted time. Defaults to: `null`. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :autoMatched => any(), :autoMatchedPlayer => GoogleApi.Games.V1.Model.AnonymousPlayer.t(), :id => any(), :kind => any(), :player => GoogleApi.Games.V1.Model.Player.t(), :status => any() } field(:autoMatched) field(:autoMatchedPlayer, as: GoogleApi.Games.V1.Model.AnonymousPlayer) field(:id) field(:kind) field(:player, as: GoogleApi.Games.V1.Model.Player) field(:status) end defimpl Poison.Decoder, for: GoogleApi.Games.V1.Model.TurnBasedMatchParticipant do def decode(value, options) do GoogleApi.Games.V1.Model.TurnBasedMatchParticipant.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.Games.V1.Model.TurnBasedMatchParticipant do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
57.714286
939
0.746425
035828691899160ffa4e20a4c2e70189ebdef8a9
72
exs
Elixir
lab3/test/lab2_web/views/page_view_test.exs
TeeSeal/web-tech-labs
46596ae2eae68e05d4433506a210b003ee18a749
[ "MIT" ]
null
null
null
lab3/test/lab2_web/views/page_view_test.exs
TeeSeal/web-tech-labs
46596ae2eae68e05d4433506a210b003ee18a749
[ "MIT" ]
2
2018-02-12T07:41:50.000Z
2018-05-04T18:45:28.000Z
lab4/test/lab2_web/views/page_view_test.exs
TeeSeal/web-tech-labs
46596ae2eae68e05d4433506a210b003ee18a749
[ "MIT" ]
null
null
null
defmodule LabWeb.PageViewTest do use LabWeb.ConnCase, async: true end
18
34
0.805556
0358310238b63afdcbbee0f7d52a66dff1a53d09
2,239
ex
Elixir
lib/gettext/extractor_agent.ex
stephenmoloney/gettext
4b9a0fd71e6ebdfa3ae3fb63c657b67e8745faa1
[ "Apache-2.0" ]
null
null
null
lib/gettext/extractor_agent.ex
stephenmoloney/gettext
4b9a0fd71e6ebdfa3ae3fb63c657b67e8745faa1
[ "Apache-2.0" ]
null
null
null
lib/gettext/extractor_agent.ex
stephenmoloney/gettext
4b9a0fd71e6ebdfa3ae3fb63c657b67e8745faa1
[ "Apache-2.0" ]
null
null
null
defmodule Gettext.ExtractorAgent do @moduledoc false @name __MODULE__ # :translations is a map where keys are Gettext backends and values # are maps. In these maps, keys are domains and values are maps of # translation_id => translation. # :backends is just a list of backends that call `use Gettext`. @initial_state %{ translations: %{}, backends: [], extracting?: false, } def start_link() do Agent.start_link(fn -> @initial_state end, name: @name) end def enable() do Agent.update(@name, &put_in(&1.extracting?, true)) end def disable() do Agent.update(@name, &put_in(&1.extracting?, false)) end def extracting?() do Agent.get(@name, & &1.extracting?) end def add_translation(backend, domain, translation) do key = Gettext.PO.Translations.key(translation) Agent.cast(@name, fn state -> # Initialize the given backend to an empty map if it wasn't there. state = update_in(state.translations, &Map.put_new(&1, backend, %{})) update_in(state, [:translations, backend, domain], fn translations -> Map.update(translations || %{}, key, translation, &merge_translations(&1, translation)) end) end) end def add_backend(backend) do Agent.cast(@name, fn state -> update_in(state.backends, &[backend | &1]) end) end def stop() do Agent.stop(@name) end def pop_translations(backends) do Agent.get_and_update(@name, fn state -> get_and_update_in(state.translations, &Map.split(&1, backends)) end) end def pop_backends(app) do Agent.get_and_update(@name, fn state -> get_and_update_in(state.backends, fn backends -> enum_split_with(backends, &(&1.__gettext__(:otp_app) == app)) end) end) end defp merge_translations(t1, t2) do t1 |> Map.put(:references, t1.references ++ t2.references) |> Map.put(:extracted_comments, t1.extracted_comments ++ t2.extracted_comments) end # TODO: remove once we depend on Elixir 1.4 and on. Code.ensure_loaded(Enum) split_with = if function_exported?(Enum, :split_with, 2), do: :split_with, else: :partition defp enum_split_with(enum, fun), do: apply(Enum, unquote(split_with), [enum, fun]) end
27.641975
95
0.673068
03585525949df63ce4c4a5b6d323a9202e5fa6b3
22,875
ex
Elixir
lib/ex_aws/dynamo.ex
circles-learning-labs/ex_aws_ddb
192794566864605ed9543545554c763d062a44b4
[ "MIT", "Unlicense" ]
null
null
null
lib/ex_aws/dynamo.ex
circles-learning-labs/ex_aws_ddb
192794566864605ed9543545554c763d062a44b4
[ "MIT", "Unlicense" ]
null
null
null
lib/ex_aws/dynamo.ex
circles-learning-labs/ex_aws_ddb
192794566864605ed9543545554c763d062a44b4
[ "MIT", "Unlicense" ]
null
null
null
defmodule ExAws.Dynamo do @moduledoc """ Operations on the AWS Dynamo service. NOTE: When Mix.env in [:test, :dev] dynamo clients will run by default against Dynamodb local. ## Basic usage ```elixir defmodule User do @derive [ExAws.Dynamo.Encodable] defstruct [:email, :name, :age, :admin] end alias ExAws.Dynamo # Create a users table with a primary key of email [String] # and 1 unit of read and write capacity Dynamo.create_table("Users", "email", %{email: :string}, 1, 1) |> ExAws.request! user = %User{email: "bubba@foo.com", name: "Bubba", age: 23, admin: false} # Save the user Dynamo.put_item("Users", user) |> ExAws.request! # Retrieve the user by email and decode it as a User struct. result = Dynamo.get_item("Users", %{email: user.email}) |> ExAws.request! |> Dynamo.decode_item(as: User) assert user == result ``` ## General notes All options are handled as underscored atoms instead of camelcased binaries as specified in the Dynamo API. IE `IndexName` would be `:index_name`. Anywhere in the API that requires dynamo type annotation (`{"S":"mystring"}`) is handled for you automatically. IE ```elixir ExAws.Dynamo.scan("Users", expression_attribute_values: [api_key: "foo"]) ``` Transforms into a query of ```elixir %{"ExpressionAttributeValues" => %{api_key: %{"S" => "foo"}}, "TableName" => "Users"} ``` Consult the function documentation to see precisely which options are handled this way. If you wish to avoid this kind of automatic behaviour you are free to specify the types yourself. IE: ```elixir ExAws.Dynamo.scan("Users", expression_attribute_values: [api_key: %{"B" => "Treated as binary"}]) ``` Becomes: ```elixir %{"ExpressionAttributeValues" => %{api_key: %{"B" => "Treated as binary"}}, "TableName" => "Users"} ``` Alternatively, if what's being encoded is a struct, you're always free to implement ExAws.Dynamo.Encodable for that struct. http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Operations.html """ import ExAws.Utils, only: [camelize_keys: 1, camelize_keys: 2, upcase: 1] alias __MODULE__ @nested_opts [:exclusive_start_key, :expression_attribute_values, :expression_attribute_names] @upcase_opts [:return_values, :return_item_collection_metrics, :select, :total_segments] @special_opts @nested_opts ++ @upcase_opts @namespace "DynamoDB_20120810" ## Tables ###################### @type table_name :: binary @type primary_key :: [{atom, binary}] | %{atom => binary} @type exclusive_start_key_vals :: [{atom, binary}] | %{atom => binary} @type expression_attribute_names_vals :: %{binary => binary} @type expression_attribute_values_vals :: [{atom, binary}] | %{atom => binary} @type return_consumed_capacity_vals :: :none | :total | :indexes @type select_vals :: :all_attributes | :all_projected_attributes | :specific_attributes | :count @type return_values_vals :: :none | :all_old | :updated_old | :all_new | :updated_new @type return_item_collection_metrics_vals :: :size | :none @type dynamo_type_names :: :blob | :boolean | :blob_set | :list | :map | :number_set | :null | :number | :string | :string_set @type dynamo_billing_types :: :pay_per_request | :provisioned @type key_schema :: [{atom | binary, :hash | :range}, ...] @type key_definitions :: [{atom | binary, dynamo_type_names}, ...] @doc """ Decode an item returned from Dynamo. This will handle items wrapped in the ordinary `get_item` response map of `%{"Item" => item}`. ## Example ```elixir Dynamo.get_item("users", %{id: "asdf"}) |> ExAws.request! |> Dynamo.decode_item(as: User) ``` """ @spec decode_item(Map.t()) :: Map.t() @spec decode_item(Map.t(), as: atom) :: Map.t() def decode_item(item, opts \\ []) def decode_item(%{"Items" => items}, opts) do for item <- items, do: decode_item(item, opts) end def decode_item(%{"Item" => item}, opts) do decode_item(item, opts) end def decode_item(item, opts) do ExAws.Dynamo.Decoder.decode(item, opts) end @doc "List tables" @spec list_tables() :: ExAws.Operation.JSON.t() def list_tables() do request(:list_tables, %{}) end @doc """ Create table key_schema can be a simple binary or atom indicating a simple hash key """ @spec create_table( table_name :: binary, key_schema :: binary | atom | key_schema, key_definitions :: key_definitions, read_capacity :: pos_integer, write_capacity :: pos_integer ) :: ExAws.Operation.JSON.t() def create_table(name, primary_key, key_definitions, read_capacity, write_capacity) when is_atom(primary_key) or is_binary(primary_key) do create_table(name, [{primary_key, :hash}], key_definitions, read_capacity, write_capacity) end def create_table(name, key_schema, key_definitions, read_capacity, write_capacity) when is_list(key_schema) do create_table(name, key_schema, key_definitions, read_capacity, write_capacity, [], []) end @doc """ Create table with secondary indices Each index should follow the format outlined here: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_CreateTable.html For convenience, the keys in each index map are allowed to be atoms. IE: `"KeySchema"` in the aws docs can be `key_schema:` Note that both the `global_indexes` and `local_indexes` arguments expect a list of such indices. Examples ``` secondary_index = [%{ index_name: "my-global-index", key_schema: [%{ attribute_name: "email", key_type: "HASH", }], provisioned_throughput: %{ read_capacity_units: 1, write_capacity_units: 1, }, projection: %{ projection_type: "KEYS_ONLY", } }] create_table("TestUsers", [id: :hash], %{id: :string, email: :string}, 1, 1, secondary_index, []) ``` """ @spec create_table( table_name :: binary, key_schema :: key_schema, key_definitions :: key_definitions, read_capacity :: pos_integer, write_capacity :: pos_integer, global_indexes :: [Map.t()], local_indexes :: [Map.t()], ttl_attribute :: binary, enabled :: boolean, billing_mode :: dynamo_billing_types ) :: ExAws.ExAws.Operation.JSON.t() def create_table( name, key_schema, key_definitions, read_capacity, write_capacity, global_indexes, local_indexes, ttl_attribute \\ nil, enabled \\ false, billing_mode \\ :provisioned ) do data = build_billing_mode(read_capacity, write_capacity, billing_mode) |> Map.merge(build_time_to_live(ttl_attribute, enabled)) |> Map.merge( %{ "TableName" => name, "AttributeDefinitions" => key_definitions |> encode_key_definitions, "KeySchema" => key_schema |> build_key_schema, }) data = %{ "GlobalSecondaryIndexes" => global_indexes |> Enum.map(&camelize_keys(&1, deep: true)), "LocalSecondaryIndexes" => local_indexes |> Enum.map(&camelize_keys(&1, deep: true)) } |> Enum.reduce(data, fn {_, []}, data -> data {name, indices}, data -> Map.put(data, name, indices) end) request(:create_table, data) end defp build_key_schema(key_schema) do Enum.map(key_schema, fn {attr, type} -> %{ "AttributeName" => attr, "KeyType" => type |> upcase } end) end @spec build_billing_mode(read_capacity :: pos_integer, write_capacity :: pos_integer, billing_mode :: dynamo_billing_types) :: Map.t() defp build_billing_mode(read_capacity, write_capacity, :provisioned) do %{ "BillingMode" => "PROVISIONED", "ProvisionedThroughput" => %{ "ReadCapacityUnits" => read_capacity, "WriteCapacityUnits" => write_capacity } } end defp build_billing_mode(_read_capacity, _write_capacity, :pay_per_request) do %{"BillingMode" => "PAY_PER_REQUEST"} end @doc "Describe table" @spec describe_table(name :: binary) :: ExAws.Operation.JSON.t() def describe_table(name) do request(:describe_table, %{"TableName" => name}) end @doc "Update Table" @spec update_table(name :: binary, attributes :: Keyword.t()) :: ExAws.Operation.JSON.t() def update_table(name, attributes) do data = attributes |> camelize_keys(deep: true) |> Map.merge(%{"TableName" => name}) request(:update_table, data) end @doc "Delete Table" @spec delete_table(table :: binary) :: ExAws.Operation.JSON.t() def delete_table(table) do request(:delete_table, %{"TableName" => table}) end @doc "Update time to live" @spec update_time_to_live(table :: binary, ttl_attribute :: binary, enabled :: boolean) :: ExAws.Operation.JSON.t() def update_time_to_live(table, ttl_attribute, enabled) do data = build_time_to_live(ttl_attribute, enabled) |> Map.merge(%{"TableName" => table}) request(:update_time_to_live, data) end @spec build_time_to_live(ttl_attribute :: binary, enabled :: boolean) :: Map.t() defp build_time_to_live("", _enabled) do %{} end defp build_time_to_live(ttl_attribute, enabled) when ttl_attribute != nil do %{ "TimeToLiveSpecification" => %{ "AttributeName" => ttl_attribute, "Enabled" => enabled } } end defp build_time_to_live(_ttl_attribute, _enabled) do %{} end @doc "Describe time to live" @spec describe_time_to_live(table :: binary) :: ExAws.Operation.JSON.t() def describe_time_to_live(table) do request(:describe_time_to_live, %{"TableName" => table}) end ## Records ###################### @doc """ Scan table Please read http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html ``` Dynamo.scan("Users" limit: 1, expression_attribute_values: [desired_api_key: "adminkey"], expression_attribute_names: %{"#asdf" => "api_key"}, filter_expression: "#asdf = :desired_api_key") ``` Generally speaking you won't need to use `:expression_attribute_names`. It exists to alias a column name if one of the columns you want to search against is a reserved dynamo word, like `Percentile`. In this case it's totally unnecessary as `api_key` is not a reserved word. Parameters with keys that are automatically annotated with dynamo types are: `[:exclusive_start_key, :expression_attribute_names]` """ @type scan_opts :: [ {:exclusive_start_key, exclusive_start_key_vals} | {:expression_attribute_names, expression_attribute_names_vals} | {:expression_attribute_values, expression_attribute_values_vals} | {:filter_expression, binary} | {:index_name, binary} | {:limit, pos_integer} | {:projection_expression, binary} | {:return_consumed_capacity, return_consumed_capacity_vals} | {:segment, non_neg_integer} | {:select, select_vals} | {:total_segments, pos_integer} ] @spec scan(table_name :: table_name) :: ExAws.Operation.JSON.t() @spec scan(table_name :: table_name, opts :: scan_opts) :: ExAws.Operation.JSON.t() def scan(name, opts \\ []) do data = opts |> build_opts |> Map.merge(%{"TableName" => name}) request(:scan, data, %{stream_builder: &ExAws.Dynamo.Lazy.stream_scan(name, opts, &1)}) end @doc """ Query Table Please read: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html ``` Dynamo.query("Users", limit: 1, expression_attribute_values: [desired_api_key: "adminkey"], key_condition_expression: "api_key = :desired_api_key") ``` Parameters with keys that are automatically annotated with dynamo types are: `[:exclusive_start_key, :expression_attribute_names]` """ @type query_opts :: [ {:consistent_read, boolean} | {:exclusive_start_key, exclusive_start_key_vals} | {:expression_attribute_names, expression_attribute_names_vals} | {:expression_attribute_values, expression_attribute_values_vals} | {:filter_expression, binary} | {:index_name, binary} | {:key_condition_expression, binary} | {:limit, pos_integer} | {:projection_expression, binary} | {:return_consumed_capacity, return_consumed_capacity_vals} | {:scan_index_forward, boolean} | {:select, select_vals} ] @spec query(table_name :: table_name) :: ExAws.Operation.JSON.t() @spec query(table_name :: table_name, opts :: query_opts) :: ExAws.Operation.JSON.t() def query(name, opts \\ []) do data = opts |> build_opts |> Map.merge(%{"TableName" => name}) request(:query, data, %{stream_builder: &ExAws.Dynamo.Lazy.stream_query(name, opts, &1)}) end @doc """ Get up to 100 items (16mb) Map of table names to request parameter maps. http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchGetItem.html Parameters with keys that are automatically annotated with dynamo types are: `[:keys]` ```elixir Dynamo.batch_get_item(%{ "Users" => [ consistent_read: true, keys: [ [api_key: "key1"], [api_key: "api_key2"] ] ], "Subscriptions" => %{ keys: [ %{id: "id1"} ] } }) ``` As you see you're largely free to use either keyword args or maps in the body. A map is required for the argument itself because the table names are most often binaries, and I refuse to inflict proplists on anyone. """ @type batch_get_item_opts :: [ {:return_consumed_capacity, return_consumed_capacity_vals} ] @type get_item :: [ {:consistent_read, boolean} | {:keys, [primary_key]} ] @spec batch_get_item(%{table_name => get_item}) :: ExAws.Operation.JSON.t() @spec batch_get_item(%{table_name => get_item}, opts :: batch_get_item_opts) :: ExAws.Operation.JSON.t() def batch_get_item(data, opts \\ []) do request_items = data |> Enum.reduce(%{}, fn {table_name, table_query}, query -> keys = table_query[:keys] |> Enum.map(&encode_values/1) dynamized_table_query = table_query |> Map.new() |> Map.drop(@special_opts ++ [:keys]) |> camelize_keys |> build_expression_attribute_names(table_query) |> Map.put("Keys", keys) Map.put(query, table_name, dynamized_table_query) end) data = opts |> camelize_keys |> Map.merge(%{"RequestItems" => request_items}) request(:batch_get_item, data) end @doc "Put item in table" @type put_item_opts :: [ {:condition_expression, binary} | {:expression_attribute_names, expression_attribute_names_vals} | {:expression_attribute_values, expression_attribute_values_vals} | {:return_consumed_capacity, return_consumed_capacity_vals} | {:return_item_collection_metrics, return_item_collection_metrics_vals} | {:return_values, return_values_vals} ] @spec put_item(table_name :: table_name, record :: map()) :: ExAws.Operation.JSON.t() @spec put_item(table_name :: table_name, record :: map(), opts :: put_item_opts) :: ExAws.Operation.JSON.t() def put_item(name, record, opts \\ []) do data = opts |> build_opts |> Map.merge(%{ "TableName" => name, "Item" => Dynamo.Encoder.encode_root(record) }) request(:put_item, data) end @doc """ Put or delete up to 25 items (16mb) Map of table names to request parameter maps. http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchWriteItem.html Parameters with keys that are automatically annotated with dynamo types are: `[:keys]` """ @type write_item :: [ [delete_request: [key: primary_key]] | [put_request: [item: map()]] ] @type batch_write_item_opts :: [ {:return_consumed_capacity, return_consumed_capacity_vals} | {:return_item_collection_metrics, return_item_collection_metrics_vals} ] @spec batch_write_item(%{table_name => [write_item]}) :: ExAws.Operation.JSON.t() @spec batch_write_item(%{table_name => [write_item]}, opts :: batch_write_item_opts) :: ExAws.Operation.JSON.t() def batch_write_item(data, opts \\ []) do request_items = data |> Enum.reduce(%{}, fn {table_name, table_queries}, query -> queries = table_queries |> Enum.map(fn [delete_request: [key: primary_key]] -> %{"DeleteRequest" => %{"Key" => primary_key |> Dynamo.Encoder.encode_root()}} [put_request: [item: item]] -> %{"PutRequest" => %{"Item" => Dynamo.Encoder.encode_root(item)}} end) Map.put(query, table_name, queries) end) data = opts |> camelize_keys |> Map.merge(%{"RequestItems" => request_items}) request(:batch_write_item, data) end @doc "Get item from table" @type get_item_opts :: [ {:consistent_read, boolean} | {:expression_attribute_names, expression_attribute_names_vals} | {:projection_expression, binary} | {:return_consumed_capacity, return_consumed_capacity_vals} ] @spec get_item(table_name :: table_name, primary_key :: primary_key) :: ExAws.Operation.JSON.t() @spec get_item(table_name :: table_name, primary_key :: primary_key, opts :: get_item_opts) :: ExAws.Operation.JSON.t() def get_item(name, primary_key, opts \\ []) do data = opts |> build_opts |> Map.merge(%{ "TableName" => name, "Key" => primary_key |> Map.new() |> Dynamo.Encoder.encode_root() }) request(:get_item, data) end @doc """ Update item in table For update_args format see http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html """ @type update_item_opts :: [ {:condition_expression, binary} | {:expression_attribute_names, expression_attribute_names_vals} | {:expression_attribute_values, expression_attribute_values_vals} | {:return_consumed_capacity, return_consumed_capacity_vals} | {:return_item_collection_metrics, return_item_collection_metrics_vals} | {:return_values, return_values_vals} | {:update_expression, binary} ] @spec update_item( table_name :: table_name, primary_key :: primary_key, opts :: update_item_opts ) :: ExAws.Operation.JSON.t() def update_item(table_name, primary_key, update_opts) do data = update_opts |> build_opts |> Map.merge(%{ "TableName" => table_name, "Key" => primary_key |> Map.new() |> Dynamo.Encoder.encode_root() }) request(:update_item, data) end @doc "Delete item in table" @type delete_item_opts :: [ {:condition_expression, binary} | {:expression_attribute_names, expression_attribute_names_vals} | {:expression_attribute_values, expression_attribute_values_vals} | {:return_consumed_capacity, return_consumed_capacity_vals} | {:return_item_collection_metrics, return_item_collection_metrics_vals} | {:return_values, return_values_vals} ] @spec delete_item(table_name :: table_name, primary_key :: primary_key) :: ExAws.Operation.JSON.t() @spec delete_item( table_name :: table_name, primary_key :: primary_key, opts :: delete_item_opts ) :: ExAws.Operation.JSON.t() def delete_item(name, primary_key, opts \\ []) do data = opts |> build_opts |> Map.merge(%{ "TableName" => name, "Key" => primary_key |> Map.new() |> Dynamo.Encoder.encode_root() }) request(:delete_item, data) end ## Options builder ################### defp build_opts(opts) do opts = opts |> Map.new() opts |> Map.drop(@special_opts) |> add_upcased_opt(opts, :total_segments) |> add_upcased_opt(opts, :return_item_collection_metrics) |> add_upcased_opt(opts, :select) |> add_upcased_opt(opts, :return_values) |> add_upcased_opt(opts, :return_consumed_capacity) |> camelize_keys |> build_special_opts(opts) end ## Builders for special options ################################ defp build_special_opts(data, opts) do data |> build_exclusive_start_key(opts) |> build_expression_attribute_names(opts) |> build_expression_attribute_values(opts) end defp build_exclusive_start_key(data, %{exclusive_start_key: start_key}) do Map.put(data, "ExclusiveStartKey", start_key |> encode_values) end defp build_exclusive_start_key(data, _), do: data defp build_expression_attribute_names(data, %{expression_attribute_names: names}) do Map.put(data, "ExpressionAttributeNames", names |> Map.new()) end defp build_expression_attribute_names(data, _), do: data defp build_expression_attribute_values(data, %{expression_attribute_values: values}) do values = values |> encode_values |> Enum.reduce(%{}, fn {k, v}, map -> Map.put(map, ":#{k}", v) end) Map.put(data, "ExpressionAttributeValues", values) end defp build_expression_attribute_values(data, _), do: data ## Various other helpers ################ defp add_upcased_opt(data, opts, key) do case Map.fetch(opts, key) do :error -> data {:ok, nil} -> data {:ok, v} -> Map.put(data, key, v |> upcase) end end defp encode_values(dict) do Enum.reduce(dict, %{}, fn {attr, value}, attribute_values -> Map.put(attribute_values, attr, Dynamo.Encoder.encode(value)) end) end defp encode_key_definitions(attrs) do attrs |> Enum.map(fn {name, type} -> %{"AttributeName" => name, "AttributeType" => type |> Dynamo.Encoder.atom_to_dynamo_type()} end) end defp request(op, data, opts \\ %{}) do operation = op |> Atom.to_string() |> Macro.camelize() ExAws.Operation.JSON.new( :dynamodb, %{ data: data, headers: [ {"x-amz-target", "#{@namespace}.#{operation}"}, {"content-type", "application/x-amz-json-1.0"} ] } |> Map.merge(opts) ) end end
31.595304
136
0.638732
035867dc7ee5abb6353149dbf4562710dabbcbfa
273
exs
Elixir
priv/repo/migrations/20210607004103_create_users.exs
devandcoffee/movekr-be
bff1690e22daec9a545ca7b69495cb928d68c0a5
[ "MIT" ]
null
null
null
priv/repo/migrations/20210607004103_create_users.exs
devandcoffee/movekr-be
bff1690e22daec9a545ca7b69495cb928d68c0a5
[ "MIT" ]
null
null
null
priv/repo/migrations/20210607004103_create_users.exs
devandcoffee/movekr-be
bff1690e22daec9a545ca7b69495cb928d68c0a5
[ "MIT" ]
null
null
null
defmodule Movekr.Repo.Migrations.CreateUsers do use Ecto.Migration def change do create table(:users) do add :name, :string add :mail, :string add :password, :string timestamps() end create unique_index(:users, [:mail]) end end
17.0625
47
0.644689
035896276a3090800a27438ede4859286230b04f
1,433
ex
Elixir
lib/doctor_schedule/accounts/entities/user.ex
adrianomota/doctor_schedule
626eef47df8f1ff082c7a7d76342cb9c361c75a2
[ "MIT" ]
null
null
null
lib/doctor_schedule/accounts/entities/user.ex
adrianomota/doctor_schedule
626eef47df8f1ff082c7a7d76342cb9c361c75a2
[ "MIT" ]
null
null
null
lib/doctor_schedule/accounts/entities/user.ex
adrianomota/doctor_schedule
626eef47df8f1ff082c7a7d76342cb9c361c75a2
[ "MIT" ]
null
null
null
defmodule DoctorSchedule.Accounts.Entities.User do use Ecto.Schema import Ecto.Changeset @primary_key {:id, :binary_id, autogenerate: true} @foreign_key_type :binary_id schema "users" do field :avatar, :string field :email, :string, unique: true field :first_name, :string field :last_name, :string field :password_hash, :string field :password, :string, virtual: true field :password_confirmation, :string, virtual: true field :role, :string, default: "user" timestamps() end def changeset(attrs), do: changeset(%__MODULE__{}, attrs) @doc false def changeset(user, attrs) do user |> cast(attrs, [ :email, :avatar, :first_name, :last_name, :password, :password_confirmation, :role ]) |> validate_required([ :email, :avatar, :first_name, :last_name, :password, :password_confirmation, :role ]) |> unique_constraint(:email) |> validate_format(:email, ~r/@/) |> update_change(:email, &String.downcase/1) |> validate_length(:password, min: 6, max: 255) |> validate_confirmation(:password) |> hash_password() end defp hash_password(%Ecto.Changeset{valid?: true, changes: %{password: password}} = changeset) do changeset |> put_change(:password_hash, Bcrypt.hash_pwd_salt(password)) end defp hash_password(changeset), do: changeset end
25.140351
98
0.650384
0358b29b9663bc1eb92230f02623e7e674b876bf
1,119
exs
Elixir
mix.exs
mentels/mim_iot_rpi
084ea4b1e5d71d157938d56c53b961b9accad34b
[ "Apache-2.0" ]
null
null
null
mix.exs
mentels/mim_iot_rpi
084ea4b1e5d71d157938d56c53b961b9accad34b
[ "Apache-2.0" ]
null
null
null
mix.exs
mentels/mim_iot_rpi
084ea4b1e5d71d157938d56c53b961b9accad34b
[ "Apache-2.0" ]
null
null
null
defmodule MimIotRpi.Mixfile do use Mix.Project @version Path.join(__DIR__, "VERSION") |> File.read! |> String.strip def project do [app: :mim_iot_rpi, version: @version, elixir: "~> 1.3", compilers: Mix.compilers ++ [:nerves_package], description: description(), package: package(), deps: deps(), aliases: ["deps.precompile": ["nerves.env", "deps.precompile"]]] end def application do [] end defp deps do [{:nerves, "~> 0.5", runtime: false }, {:nerves_system_br, "~> 0.10.0", runtime: false }, {:nerves_toolchain_armv6_rpi_linux_gnueabi, "~> 0.10.0", runtime: false}] end defp description do """ Nerves System - Raspberry Pi A+ / B+ / B / Zero """ end defp package do [maintainers: ["Szymon Mentel"], files: ["LICENSE", "mix.exs", "nerves_defconfig", "nerves.exs", "README.md", "VERSION", "rootfs-additions", "fwup.conf", "cmdline.txt", "linux-4.4.defconfig", "config.txt", "post-createfs.sh"], licenses: ["Apache 2.0"], links: %{"Github" => "https://github.com/mentels/mim_iot_rpi"}] end end
26.642857
197
0.610366
0358cc4d401ea67a57dcdee9b85ea4657938b009
341
ex
Elixir
web/channels/user_socket.ex
Angarsk8/microscope.ex
dc4572ba8b9f1c7b7c94ee78f387e332ac0d936c
[ "MIT" ]
342
2017-01-10T16:13:45.000Z
2022-02-26T13:55:38.000Z
web/channels/user_socket.ex
Angarsk8/microscope.ex
dc4572ba8b9f1c7b7c94ee78f387e332ac0d936c
[ "MIT" ]
6
2017-01-14T17:59:48.000Z
2018-03-25T21:35:50.000Z
web/channels/user_socket.ex
Angarsk8/microscope.ex
dc4572ba8b9f1c7b7c94ee78f387e332ac0d936c
[ "MIT" ]
38
2017-01-11T00:18:21.000Z
2021-07-11T11:28:12.000Z
defmodule Microscope.UserSocket do use Phoenix.Socket ## Channels channel "users:*", Microscope.UserChannel channel "posts:lobby", Microscope.PostChannel ## Transports transport :websocket, Phoenix.Transports.WebSocket, timeout: 45_000 def connect(_params, socket) do {:ok, socket} end def id(_socket), do: nil end
20.058824
69
0.730205
0358f04ad8a68085b8754de16f873b02de6631ec
1,339
ex
Elixir
lib/ledemo_web/endpoint.ex
andyl/live_editable_demo
645d628d8717d706da207db9fe9f6f71ecfce303
[ "MIT" ]
null
null
null
lib/ledemo_web/endpoint.ex
andyl/live_editable_demo
645d628d8717d706da207db9fe9f6f71ecfce303
[ "MIT" ]
7
2021-05-10T15:57:48.000Z
2021-05-27T13:05:14.000Z
lib/ledemo_web/endpoint.ex
andyl/live_editable_demo
645d628d8717d706da207db9fe9f6f71ecfce303
[ "MIT" ]
null
null
null
defmodule LedemoWeb.Endpoint do use Phoenix.Endpoint, otp_app: :ledemo socket "/live", Phoenix.LiveView.Socket socket "/socket", LedemoWeb.UserSocket, websocket: true, longpoll: false # Serve at "/" the static files from "priv/static" directory. # # You should set gzip to true if you are running phx.digest # when deploying your static files in production. plug Plug.Static, at: "/", from: :ledemo, gzip: false, only: ~w(css fonts images js favicon.ico robots.txt) # Code reloading can be explicitly enabled under the # :code_reloader configuration of your endpoint. if code_reloading? do socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket plug Phoenix.LiveReloader plug Phoenix.CodeReloader end plug Plug.RequestId plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint] plug Plug.Parsers, parsers: [:urlencoded, :multipart, :json], pass: ["*/*"], json_decoder: Phoenix.json_library() plug Plug.MethodOverride plug Plug.Head # The session will be stored in the cookie and signed, # this means its contents can be read but not tampered with. # Set :encryption_salt if you would also like to encrypt it. plug Plug.Session, store: :cookie, key: "_ledemo_key", signing_salt: "GqTrmo8O" plug LedemoWeb.Router end
27.326531
69
0.709485
0359140194bfdd4020a77433a3104d7602f9b15a
3,998
exs
Elixir
test/tracer_integration/plug/router_test.exs
prosapient/spandex_phoenix
487a635f3334e9aa0a4c86c7abc656ac00a6acc8
[ "MIT" ]
69
2018-09-14T18:17:50.000Z
2022-01-11T01:20:55.000Z
test/tracer_integration/plug/router_test.exs
prosapient/spandex_phoenix
487a635f3334e9aa0a4c86c7abc656ac00a6acc8
[ "MIT" ]
49
2018-10-11T02:47:58.000Z
2022-03-17T09:10:07.000Z
test/tracer_integration/plug/router_test.exs
prosapient/spandex_phoenix
487a635f3334e9aa0a4c86c7abc656ac00a6acc8
[ "MIT" ]
27
2018-09-19T14:14:06.000Z
2022-03-07T21:16:33.000Z
defmodule TracerWithPlugRouterTest do use ExUnit.Case import RouterHelper defmodule Router do use Plug.Router use SpandexPhoenix plug(:match) plug(:dispatch) get "/hello" do send_resp(conn, 200, "world") end get "/hello/:name" do send_resp(conn, 200, name) end get "/exception" do raise "Test" send_resp(conn, 200, "Won't get here") end get "/exit" do exit("Test") send_resp(conn, 200, "Won't get here") end get "/throw" do throw("Test") send_resp(conn, 200, "Won't get here") end match _ do send_resp(conn, 404, "oops") end end describe "SpandexPhoenix used with Plug.Router" do test "traces successful requests" do call(Router, :get, "/hello") assert_receive { :sent_trace, %Spandex.Trace{ spans: [ %Spandex.Span{ http: http, name: "request", resource: "GET /hello", service: :spandex_phoenix, tags: [], type: :web } ] } } assert "GET" == Keyword.get(http, :method) assert 200 == Keyword.get(http, :status_code) assert "/hello" == Keyword.get(http, :url) end test "traces successful requests with path params" do call(Router, :get, "/hello/spandex") assert_receive { :sent_trace, %Spandex.Trace{ spans: [ %Spandex.Span{ http: http, name: "request", resource: "GET /hello/:name", service: :spandex_phoenix, tags: [], type: :web } ] } } assert "GET" == Keyword.get(http, :method) assert 200 == Keyword.get(http, :status_code) assert "/hello/spandex" == Keyword.get(http, :url) end test "sends an error trace when an exception is raised" do assert_raise RuntimeError, fn -> call(Router, :get, "/exception") end assert_receive { :sent_trace, %Spandex.Trace{ spans: [ %Spandex.Span{error: error, http: http, name: "request", resource: "GET /exception"} ] } } assert "GET" == Keyword.get(http, :method) assert nil == Keyword.get(http, :status_code) assert "/exception" == Keyword.get(http, :url) assert %RuntimeError{message: "Test"} = Keyword.get(error, :exception) assert is_list(Keyword.get(error, :stacktrace)) assert Keyword.get(error, :error?) end test "sends an error trace when the worker process exits" do assert catch_exit(call(Router, :get, "/exit")) == "Test" assert_receive { :sent_trace, %Spandex.Trace{ spans: [ %Spandex.Span{error: error, http: http, name: "request", resource: "GET /exit"} ] } } assert "GET" == Keyword.get(http, :method) assert nil == Keyword.get(http, :status_code) assert "/exit" == Keyword.get(http, :url) assert %RuntimeError{message: "** (exit) \"Test\""} = Keyword.get(error, :exception) assert is_list(Keyword.get(error, :stacktrace)) assert Keyword.get(error, :error?) end test "sends an error trace when an error is thrown and not caught" do assert catch_throw(call(Router, :get, "/throw")) == "Test" assert_receive { :sent_trace, %Spandex.Trace{ spans: [ %Spandex.Span{error: error, http: http, name: "request", resource: "GET /throw"} ] } } assert "GET" == Keyword.get(http, :method) assert nil == Keyword.get(http, :status_code) assert "/throw" == Keyword.get(http, :url) assert %RuntimeError{message: "** (throw) \"Test\""} = Keyword.get(error, :exception) assert is_list(Keyword.get(error, :stacktrace)) assert Keyword.get(error, :error?) end end end
26.130719
96
0.551776
035936126de3c5adfc0f2a10a88be90a1c9e8c85
558
exs
Elixir
test/views/error_view_test.exs
domix/xebex
e1c9e21245a1daf3c818ddd60433fdbc4d7611be
[ "Apache-2.0" ]
1
2015-10-13T02:11:26.000Z
2015-10-13T02:11:26.000Z
test/views/error_view_test.exs
domix/xebex
e1c9e21245a1daf3c818ddd60433fdbc4d7611be
[ "Apache-2.0" ]
null
null
null
test/views/error_view_test.exs
domix/xebex
e1c9e21245a1daf3c818ddd60433fdbc4d7611be
[ "Apache-2.0" ]
null
null
null
defmodule Xebex.ErrorViewTest do use Xebex.ConnCase, async: true # Bring render/3 and render_to_string/3 for testing custom views import Phoenix.View test "renders 404.html" do assert render_to_string(Xebex.ErrorView, "404.html", []) == "Page not found" end test "render 500.html" do assert render_to_string(Xebex.ErrorView, "500.html", []) == "Server internal error" end test "render any other" do assert render_to_string(Xebex.ErrorView, "505.html", []) == "Server internal error" end end
25.363636
66
0.670251
035936b67b66d14fac6be5853d565dfcd08f9512
605
ex
Elixir
lib/sparql_client/query/result_format.ex
kianmeng/sparql_client
f754bb042e865f54bd2f7be276f241434df902b3
[ "MIT" ]
18
2018-03-19T22:51:00.000Z
2020-05-17T12:51:03.000Z
lib/sparql_client/query/result_format.ex
kianmeng/sparql_client
f754bb042e865f54bd2f7be276f241434df902b3
[ "MIT" ]
3
2018-08-16T13:51:45.000Z
2020-05-17T15:18:16.000Z
lib/sparql_client/query/result_format.ex
kianmeng/sparql_client
f754bb042e865f54bd2f7be276f241434df902b3
[ "MIT" ]
2
2018-08-16T13:27:31.000Z
2020-05-01T11:13:37.000Z
defmodule SPARQL.Client.Query.ResultFormat do @moduledoc false def by_name(nil, _), do: nil def by_name(name, query_form) when query_form in ~w[select ask]a, do: SPARQL.result_format(name) def by_name(name, query_form) when query_form in ~w[construct describe]a, do: RDF.Serialization.format(name) def by_media_type(media_type, query_form) when query_form in ~w[select ask]a, do: SPARQL.result_format_by_media_type(media_type) def by_media_type(media_type, query_form) when query_form in ~w[construct describe]a, do: RDF.Serialization.format_by_media_type(media_type) end
33.611111
87
0.770248
035976cc7be3dcff8956e4d2911680960f5bc9b9
631
ex
Elixir
text_client/lib/text_client/prompter.ex
codebay/game_comps
1211fab75b2023f9afb32b7272c6f877aabb6f7e
[ "Apache-2.0" ]
null
null
null
text_client/lib/text_client/prompter.ex
codebay/game_comps
1211fab75b2023f9afb32b7272c6f877aabb6f7e
[ "Apache-2.0" ]
null
null
null
text_client/lib/text_client/prompter.ex
codebay/game_comps
1211fab75b2023f9afb32b7272c6f877aabb6f7e
[ "Apache-2.0" ]
null
null
null
defmodule TextClient.Prompter do alias TextClient.State def accept_move(game = %State{}) do IO.gets("Your guess: ") |> check_input(game) end defp check_input({:error, reason}, _) do IO.puts("Game ended: #{reason}") exit(:normal) end defp check_input(:eof, _) do IO.puts("Looks like you gave up...") exit(:normal) end defp check_input(input, game = %State{}) do input = String.trim(input) cond do input =~ ~r/\A[a-z]\z/ -> Map.put(game, :guess, input) true -> IO.puts "please enter a single lowercase letter" accept_move(game) end end end
21.758621
56
0.605388
0359bf995b5e6c947a6e2f3216e86bfe97709366
5,790
ex
Elixir
lib/elixir_sense/providers/suggestion.ex
msaraiva/elixir_sense
15bf8a5d4ea55ced2d76e5f41620c769cf125c82
[ "Unlicense", "MIT" ]
212
2017-03-29T09:08:08.000Z
2022-01-26T13:35:40.000Z
lib/elixir_sense/providers/suggestion.ex
msaraiva/elixir_sense
15bf8a5d4ea55ced2d76e5f41620c769cf125c82
[ "Unlicense", "MIT" ]
37
2017-04-11T04:13:18.000Z
2020-02-12T20:02:55.000Z
lib/elixir_sense/providers/suggestion.ex
msaraiva/elixir_sense
15bf8a5d4ea55ced2d76e5f41620c769cf125c82
[ "Unlicense", "MIT" ]
17
2017-04-11T17:46:15.000Z
2021-05-31T09:10:18.000Z
defmodule ElixirSense.Providers.Suggestion do @moduledoc """ Provider responsible for finding suggestions for auto-completing """ alias Alchemist.Helpers.Complete alias ElixirSense.Core.Introspection alias ElixirSense.Core.Source @type fun_arity :: {atom, non_neg_integer} @type scope :: module | fun_arity @type attribute :: %{ type: :attribute, name: String.t } @type variable :: %{ type: :var, name: String.t } @type field :: %{ type: :field, name: String.t, origin: String.t, } @type return :: %{ type: :return, description: String.t, spec: String.t, snippet: String.t, } @type callback :: %{ type: :callback, name: String.t, arity: non_neg_integer, args: String.t, origin: String.t, summary: String.t, spec: String.t } @type func :: %{ type: :function, name: String.t, arity: non_neg_integer, args: String.t, origin: String.t, summary: String.t, spec: String.t } @type mod :: %{ type: :module, name: String.t, subtype: String.t, summary: String.t } @type hint :: %{ type: :hint, value: String.t } @type suggestion :: attribute | variable | field | return | callback | func | mod | hint @doc """ Finds all suggestions for a hint based on context information. """ @spec find(String.t, [module], [{module, module}], module, [String.t], [String.t], [module], scope, String.t) :: [suggestion] def find(hint, imports, aliases, module, vars, attributes, behaviours, scope, text_before) do case find_struct_fields(hint, text_before, imports, aliases, module) do [] -> find_all_except_struct_fields(hint, imports, aliases, vars, attributes, behaviours, scope) fields -> [%{type: :hint, value: "#{hint}"} | fields] end end @spec find_all_except_struct_fields(String.t, [module], [{module, module}], [String.t], [String.t], [module], scope) :: [suggestion] defp find_all_except_struct_fields(hint, imports, aliases, vars, attributes, behaviours, scope) do vars = Enum.map(vars, fn v -> v.name end) %{hint: hint_suggestion, suggestions: mods_and_funcs} = find_hint_mods_funcs(hint, imports, aliases) callbacks_or_returns = case scope do {_f, _a} -> find_returns(behaviours, hint, scope) _mod -> find_callbacks(behaviours, hint) end [hint_suggestion] |> Kernel.++(callbacks_or_returns) |> Kernel.++(find_attributes(attributes, hint)) |> Kernel.++(find_vars(vars, hint)) |> Kernel.++(mods_and_funcs) |> Enum.uniq_by(&(&1)) end defp find_struct_fields(hint, text_before, imports, aliases, module) do with \ {mod, fields_so_far} <- Source.which_struct(text_before), {actual_mod, _} <- Introspection.actual_mod_fun({mod, nil}, imports, aliases, module), true <- Introspection.module_is_struct?(actual_mod) do actual_mod |> struct() |> Map.from_struct() |> Map.keys() |> Kernel.--(fields_so_far) |> Enum.filter(fn field -> String.starts_with?("#{field}", hint)end) |> Enum.map(fn field -> %{type: :field, name: field, origin: Introspection.module_to_string(actual_mod)} end) else _ -> [] end end @spec find_hint_mods_funcs(String.t, [module], [{module, module}]) :: %{hint: hint, suggestions: [mod | func]} defp find_hint_mods_funcs(hint, imports, aliases) do Application.put_env(:"alchemist.el", :aliases, aliases) list1 = Complete.run(hint, imports) list2 = Complete.run(hint) {hint_suggestion, suggestions} = case List.first(list2) do %{type: :hint} = sug -> {sug, list1 ++ List.delete_at(list2, 0)} _ -> {%{type: :hint, value: "#{hint}"}, list1 ++ list2} end %{hint: hint_suggestion, suggestions: suggestions} end @spec find_vars([String.t], String.t) :: [variable] defp find_vars(vars, hint) do for var <- vars, hint == "" or String.starts_with?("#{var}", hint) do %{type: :variable, name: var} end |> Enum.sort end @spec find_attributes([String.t], String.t) :: [attribute] defp find_attributes(attributes, hint) do for attribute <- attributes, hint in ["", "@"] or String.starts_with?("@#{attribute}", hint) do %{type: :attribute, name: "@#{attribute}"} end |> Enum.sort end @spec find_returns([module], String.t, scope) :: [return] defp find_returns(behaviours, "", {fun, arity}) do for mod <- behaviours, Introspection.define_callback?(mod, fun, arity) do for return <- Introspection.get_returns_from_callback(mod, fun, arity) do %{type: :return, description: return.description, spec: return.spec, snippet: return.snippet} end end |> List.flatten end defp find_returns(_behaviours, _hint, _module) do [] end @spec find_callbacks([module], String.t) :: [callback] defp find_callbacks(behaviours, hint) do behaviours |> Enum.flat_map(fn mod -> mod_name = mod |> Introspection.module_to_string for %{name: name, arity: arity, callback: spec, signature: signature, doc: doc} <- Introspection.get_callbacks_with_docs(mod), hint == "" or String.starts_with?("#{name}", hint) do desc = Introspection.extract_summary_from_docs(doc) [_, args_str] = Regex.run(Regex.recompile!(~r/.\((.*)\)/), signature) args = args_str |> String.replace(Regex.recompile!(~r/\s/), "") %{type: :callback, name: name, arity: arity, args: args, origin: mod_name, summary: desc, spec: spec} end end) |> Enum.sort end end
30.797872
134
0.617444
0359cd2703d5bd73835da3b1f78addf303c23e5b
1,751
ex
Elixir
server/apps/boardr_api/lib/boardr_api/utils/view_helpers.ex
AlphaHydrae/boardr
98eed02801f88c065a24bf13051c5cf96270a5f7
[ "MIT" ]
1
2021-04-08T17:26:27.000Z
2021-04-08T17:26:27.000Z
server/apps/boardr_api/lib/boardr_api/utils/view_helpers.ex
AlphaHydrae/boardr
98eed02801f88c065a24bf13051c5cf96270a5f7
[ "MIT" ]
1
2022-02-13T05:50:46.000Z
2022-02-13T05:50:46.000Z
server/apps/boardr_api/lib/boardr_api/utils/view_helpers.ex
AlphaHydrae/boardr
98eed02801f88c065a24bf13051c5cf96270a5f7
[ "MIT" ]
null
null
null
defmodule BoardrApi.ViewHelpers do alias BoardrApi.Endpoint, as: Endpoint alias BoardrApi.Router.Helpers, as: Routes import BoardrApi.HalDocument, only: [put_curie: 4, put_link: 4] def api_document(properties \\ %{}) when is_map(properties) do properties |> put_curie(:boardr, "#{Routes.api_root_url(Endpoint, :index)}/rels/{rel}", :templated) end def put_boardr_link(doc, rel, href, link_properties \\ %{}) def put_boardr_link(doc, rel, href, :templated) when is_map(doc) and is_binary(href) do put_link(doc, String.to_atom("boardr:#{rel}"), href, :templated) end def put_boardr_link(doc, rel, href, link_properties) when is_map(doc) and is_binary(href) and is_map(link_properties) do put_link(doc, String.to_atom("boardr:#{rel}"), href, link_properties) end def put_hal_curies_link(map) when is_map(map) do put_hal_links(map, %{ curies: [ %{ name: "boardr", href: "#{Routes.api_root_url(Endpoint, :index)}/rels/{rel}", templated: true } ] }) end def put_hal_links(map, links) when is_map(map) and is_map(links) do elem( Map.get_and_update( map, :_links, fn existing_links -> {existing_links || %{}, Map.merge(existing_links || %{}, links)} end ), 1 ) end def put_hal_self_link(map, url_helper, helper_args) when is_map(map) and is_atom(url_helper) and is_list(helper_args) do put_hal_links(map, %{ self: %{ href: apply(Routes, url_helper, [Endpoint | helper_args]) } }) end def omit_nil(map) do Enum.reduce(map, %{}, fn {key, value}, acc -> if is_nil(value), do: acc, else: Map.put(acc, key, value) end) end end
28.241935
97
0.63735
0359e3ca3343bb00c372dc4ff766bed8c6a93811
988
ex
Elixir
test/support/channel_case.ex
lucianosousa/gears
a59a93dd28ccd82e6cd1e3db809535a4dc10d007
[ "MIT" ]
null
null
null
test/support/channel_case.ex
lucianosousa/gears
a59a93dd28ccd82e6cd1e3db809535a4dc10d007
[ "MIT" ]
null
null
null
test/support/channel_case.ex
lucianosousa/gears
a59a93dd28ccd82e6cd1e3db809535a4dc10d007
[ "MIT" ]
null
null
null
defmodule Gears.ChannelCase do @moduledoc """ This module defines the test case to be used by channel tests. Such tests rely on `Phoenix.ChannelTest` and also import other functionality to make it easier to build and query models. Finally, if the test case interacts with the database, it cannot be async. For this reason, every test runs inside a transaction which is reset at the beginning of the test unless the test case is marked as async. """ use ExUnit.CaseTemplate using do quote do # Import conveniences for testing with channels use Phoenix.ChannelTest alias Gears.Repo import Ecto import Ecto.Changeset import Ecto.Query # The default endpoint for testing @endpoint Gears.Endpoint end end setup tags do :ok = Ecto.Adapters.SQL.Sandbox.checkout(Gears.Repo) unless tags[:async] do Ecto.Adapters.SQL.Sandbox.mode(Gears.Repo, {:shared, self()}) end :ok end end
22.454545
67
0.697368
0359f6f085756999eec959dab3ab77a8674b5836
902
ex
Elixir
lib/dojo_sequance.ex
agnaldo4j/sequence_elixir_kata
2aeee6a276161ff7360b9296cb90ec57bc51d9e4
[ "MIT" ]
null
null
null
lib/dojo_sequance.ex
agnaldo4j/sequence_elixir_kata
2aeee6a276161ff7360b9296cb90ec57bc51d9e4
[ "MIT" ]
null
null
null
lib/dojo_sequance.ex
agnaldo4j/sequence_elixir_kata
2aeee6a276161ff7360b9296cb90ec57bc51d9e4
[ "MIT" ]
null
null
null
defmodule Sequence do def computeSequence([head|tail]) do tuple = %{:max => head, :min => head, :average => head, :length => 1} computeSequence(tail, tuple) end def computeSequence([head|tail], accumulator) do tuple = %{ :max => if (accumulator[:max] < head) do head else accumulator[:max] end, :min => if (accumulator[:min] > head) do head else accumulator[:min] end, :average => accumulator[:average]+head, :length => accumulator[:length]+1 } computeSequence(tail, tuple) end def computeSequence([], accumulator) do tuple = %{ :max => accumulator[:max], :min => accumulator[:min], :average => accumulator[:average] / accumulator[:length], :length => accumulator[:length] } end def computeSequence([]) do raise ArgumentError, message: "invalid empty list" end def computeSequence(nil) do raise ArgumentError, message: "invalid nil list" end end
26.529412
76
0.670732
035a131dc8264c6d554f98555c41008dbe865dfa
447
ex
Elixir
lib/airline_api_aggregator/application.ex
SanketSapkal/airline_api_aggregator
fd4d5243c7ee936ab2fa07281ef1db6badec8d14
[ "Apache-2.0" ]
null
null
null
lib/airline_api_aggregator/application.ex
SanketSapkal/airline_api_aggregator
fd4d5243c7ee936ab2fa07281ef1db6badec8d14
[ "Apache-2.0" ]
null
null
null
lib/airline_api_aggregator/application.ex
SanketSapkal/airline_api_aggregator
fd4d5243c7ee936ab2fa07281ef1db6badec8d14
[ "Apache-2.0" ]
null
null
null
defmodule AirlineAPIAggregator.Application do @moduledoc false use Application def start(_type, _args) do children = [ Plug.Cowboy.child_spec(scheme: :http, plug: AirlineAPIAggregator.Router, options: [port: 4000]), {AirlineAPIAggregator, []}, {AirlineAPIAggregator.RateLimiter, []} ] opts = [strategy: :one_for_one, name: AirlineAPIAggregator.Supervisor] Supervisor.start_link(children, opts) end end
26.294118
102
0.713647
035a197ea87bdaf669fdf52aa438937a638259d9
1,592
ex
Elixir
web/web.ex
appdojolabs/myapp
41887a60f7ea86db3c70470631b703455c865042
[ "MIT" ]
41
2017-05-21T14:33:28.000Z
2022-03-28T22:29:56.000Z
web/web.ex
DMeechan/deploy-elixir-docker-example
b63a46453629ced5134aba039575a3c010a6f2a1
[ "MIT" ]
2
2017-07-23T07:06:38.000Z
2018-07-16T23:53:12.000Z
web/web.ex
appdojolabs/myapp
41887a60f7ea86db3c70470631b703455c865042
[ "MIT" ]
16
2017-05-21T22:35:10.000Z
2022-03-28T22:30:04.000Z
defmodule Myapp.Web do @moduledoc """ A module that keeps using definitions for controllers, views and so on. This can be used in your application as: use Myapp.Web, :controller use Myapp.Web, :view The definitions below will be executed for every view, controller, etc, so keep them short and clean, focused on imports, uses and aliases. Do NOT define functions inside the quoted expressions below. """ def model do quote do use Ecto.Schema import Ecto import Ecto.Changeset import Ecto.Query end end def controller do quote do use Phoenix.Controller alias Myapp.Repo import Ecto import Ecto.Query import Myapp.Router.Helpers import Myapp.Gettext end end def view do quote do use Phoenix.View, root: "web/templates" # Import convenience functions from controllers import Phoenix.Controller, only: [get_csrf_token: 0, get_flash: 2, view_module: 1] # Use all HTML functionality (forms, tags, etc) use Phoenix.HTML import Myapp.Router.Helpers import Myapp.ErrorHelpers import Myapp.Gettext end end def router do quote do use Phoenix.Router end end def channel do quote do use Phoenix.Channel alias Myapp.Repo import Ecto import Ecto.Query import Myapp.Gettext end end @doc """ When used, dispatch to the appropriate controller/view/etc. """ defmacro __using__(which) when is_atom(which) do apply(__MODULE__, which, []) end end
19.414634
88
0.661432
035a2bfce6a3c4d614b8e1382fc96045222fe592
787
ex
Elixir
lib/postgrex/extensions/point.ex
enter-haken/postgrex
fb3438d4e6a56db81ddd0d578cdfc0484909c233
[ "Apache-2.0" ]
681
2016-06-16T12:28:22.000Z
2022-03-30T08:48:42.000Z
deps/postgrex/lib/postgrex/extensions/point.ex
rwtrecs/rocketseat-nlw5-inmana
8ce8bc32e0bdd005c423394bb163945747b557e2
[ "MIT" ]
383
2016-06-17T14:49:41.000Z
2022-03-21T18:13:19.000Z
deps/postgrex/lib/postgrex/extensions/point.ex
adrianomota/blog
ef3b2d2ed54f038368ead8234d76c18983caa75b
[ "MIT" ]
234
2016-06-16T16:14:47.000Z
2022-03-03T00:43:59.000Z
defmodule Postgrex.Extensions.Point do @moduledoc false import Postgrex.BinaryUtils, warn: false use Postgrex.BinaryExtension, send: "point_send" def encode(_) do quote location: :keep do %Postgrex.Point{x: x, y: y} -> <<16::int32, x::float64, y::float64>> other -> raise DBConnection.EncodeError, Postgrex.Utils.encode_msg(other, Postgrex.Point) end end def decode(_) do quote location: :keep do <<16::int32, x::float64, y::float64>> -> %Postgrex.Point{x: x, y: y} end end # used by other extensions def encode_point(%Postgrex.Point{x: x, y: y}, _) do <<x::float64, y::float64>> end def encode_point(other, wanted) do raise DBConnection.EncodeError, Postgrex.Utils.encode_msg(other, wanted) end end
25.387097
88
0.662008
035a33525f2439d955ae2c8f7a004bd16d2c9dfa
1,793
ex
Elixir
clients/composer/lib/google_api/composer/v1beta1/model/web_server_config.ex
kolorahl/elixir-google-api
46bec1e092eb84c6a79d06c72016cb1a13777fa6
[ "Apache-2.0" ]
null
null
null
clients/composer/lib/google_api/composer/v1beta1/model/web_server_config.ex
kolorahl/elixir-google-api
46bec1e092eb84c6a79d06c72016cb1a13777fa6
[ "Apache-2.0" ]
null
null
null
clients/composer/lib/google_api/composer/v1beta1/model/web_server_config.ex
kolorahl/elixir-google-api
46bec1e092eb84c6a79d06c72016cb1a13777fa6
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.Composer.V1beta1.Model.WebServerConfig do @moduledoc """ The configuration settings for the Airflow web server App Engine instance. ## Attributes * `machineType` (*type:* `String.t`, *default:* `nil`) - Optional. Machine type on which Airflow web server is running. For example: composer-n1-webserver-2, composer-n1-webserver-4, composer-n1-webserver-8. If not specified, composer-n1-webserver-2 will be used. Value custom is returned only in response, if Airflow web server parameters were manually changed to a non-standard values. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :machineType => String.t() } field(:machineType) end defimpl Poison.Decoder, for: GoogleApi.Composer.V1beta1.Model.WebServerConfig do def decode(value, options) do GoogleApi.Composer.V1beta1.Model.WebServerConfig.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.Composer.V1beta1.Model.WebServerConfig do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
34.480769
123
0.741774
035a39d0433dabeb10f4b22cb3159edc5dc434c1
238
ex
Elixir
lib/cadet/env.ex
seanlowjk/cadet
52b55cc0f777cb0d55a78fe1693f762085ab36c2
[ "Apache-2.0" ]
null
null
null
lib/cadet/env.ex
seanlowjk/cadet
52b55cc0f777cb0d55a78fe1693f762085ab36c2
[ "Apache-2.0" ]
null
null
null
lib/cadet/env.ex
seanlowjk/cadet
52b55cc0f777cb0d55a78fe1693f762085ab36c2
[ "Apache-2.0" ]
null
null
null
defmodule Cadet.Env do @moduledoc """ Cadet.Env just contains a function that returns the current environment from the configuration. """ @spec env :: atom() def env do Application.get_env(:cadet, :environment) end end
19.833333
73
0.705882
035a4f7a028acc4fdb0c4aa413c5c64774adcc26
1,676
ex
Elixir
clients/dialogflow/lib/google_api/dialogflow/v2/model/google_cloud_dialogflow_v2_suggestion_feature.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
1
2021-12-20T03:40:53.000Z
2021-12-20T03:40:53.000Z
clients/dialogflow/lib/google_api/dialogflow/v2/model/google_cloud_dialogflow_v2_suggestion_feature.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
1
2020-08-18T00:11:23.000Z
2020-08-18T00:44:16.000Z
clients/dialogflow/lib/google_api/dialogflow/v2/model/google_cloud_dialogflow_v2_suggestion_feature.ex
pojiro/elixir-google-api
928496a017d3875a1929c6809d9221d79404b910
[ "Apache-2.0" ]
null
null
null
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # NOTE: This file is auto generated by the elixir code generator program. # Do not edit this file manually. defmodule GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowV2SuggestionFeature do @moduledoc """ The type of Human Agent Assistant API suggestion to perform, and the maximum number of results to return for that type. Multiple `Feature` objects can be specified in the `features` list. ## Attributes * `type` (*type:* `String.t`, *default:* `nil`) - Type of Human Agent Assistant API feature to request. """ use GoogleApi.Gax.ModelBase @type t :: %__MODULE__{ :type => String.t() | nil } field(:type) end defimpl Poison.Decoder, for: GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowV2SuggestionFeature do def decode(value, options) do GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowV2SuggestionFeature.decode(value, options) end end defimpl Poison.Encoder, for: GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowV2SuggestionFeature do def encode(value, options) do GoogleApi.Gax.ModelBase.encode(value, options) end end
34.204082
189
0.754177
035a7c46615597e469e3ebecca854ccbe4fd6116
284
ex
Elixir
phoenix/discuss/web/models/distributor.ex
pshaddel/turbo-Elixir
fb5fc900ad40c963f885b75d94f4fe360d69bcb8
[ "MIT" ]
1
2021-04-13T06:48:57.000Z
2021-04-13T06:48:57.000Z
phoenix/discuss/web/models/distributor.ex
pshaddel/turbo-Elixir
fb5fc900ad40c963f885b75d94f4fe360d69bcb8
[ "MIT" ]
null
null
null
phoenix/discuss/web/models/distributor.ex
pshaddel/turbo-Elixir
fb5fc900ad40c963f885b75d94f4fe360d69bcb8
[ "MIT" ]
null
null
null
defmodule Discuss.Distributor do use Discuss.Web, :model schema "distributors" do field(:name, :string) belongs_to(:movie, Friends.Movie) end def changeset(struct, params \\ %{}) do struct |> cast(params, [:name]) |> validate_required([:name]) end end
18.933333
41
0.651408
035ab65edc4dfadde2e2d835d4ea5d8b00392d68
234
ex
Elixir
lib/discovery_api/quantum/scheduler.ex
folkengine/discovery_api
0bb7a0aff4603a4f7532cc65ca8c8dbb37a57217
[ "Apache-2.0" ]
26
2019-09-20T23:54:45.000Z
2020-08-20T14:23:32.000Z
lib/discovery_api/quantum/scheduler.ex
folkengine/discovery_api
0bb7a0aff4603a4f7532cc65ca8c8dbb37a57217
[ "Apache-2.0" ]
757
2019-08-15T18:15:07.000Z
2020-09-18T20:55:31.000Z
lib/discovery_api/quantum/scheduler.ex
folkengine/discovery_api
0bb7a0aff4603a4f7532cc65ca8c8dbb37a57217
[ "Apache-2.0" ]
9
2019-11-12T16:43:46.000Z
2020-03-25T16:23:16.000Z
defmodule DiscoveryApi.Quantum.Scheduler do @moduledoc """ This modules defines a quantum scheduler which can be wired to run arbitrary functions from within config.exs """ use Quantum.Scheduler, otp_app: :discovery_api end
29.25
88
0.777778
035ab7c7d28004b07a485946802bd0a6cbca4559
254
ex
Elixir
test/unit/fixtures/compiler/pruner/module_46.ex
gregjohnsonsaltaire/hologram
aa8e9ea0d599def864c263cc37cc8ee31f02ac4a
[ "MIT" ]
40
2022-01-19T20:27:36.000Z
2022-03-31T18:17:41.000Z
test/unit/fixtures/compiler/pruner/module_46.ex
gregjohnsonsaltaire/hologram
aa8e9ea0d599def864c263cc37cc8ee31f02ac4a
[ "MIT" ]
42
2022-02-03T22:52:43.000Z
2022-03-26T20:57:32.000Z
test/unit/fixtures/compiler/pruner/module_46.ex
gregjohnsonsaltaire/hologram
aa8e9ea0d599def864c263cc37cc8ee31f02ac4a
[ "MIT" ]
3
2022-02-10T04:00:37.000Z
2022-03-08T22:07:45.000Z
defmodule Hologram.Test.Fixtures.Compiler.Pruner.Module46 do use Hologram.Component alias Hologram.Test.Fixtures.Compiler.Pruner.Module47 def init(_props) do Module47.test_fun_47a() %{} end def template do ~H""" """ end end
16.933333
60
0.700787
035ac05c17e5b62e253f2149de5434d1299f52ba
10,602
ex
Elixir
apps/evm/lib/evm/debugger/breakpoint.ex
atoulme/mana
cff3fd96c23feaaeb9fe32df3c0d35ee6dc548a5
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
null
null
null
apps/evm/lib/evm/debugger/breakpoint.ex
atoulme/mana
cff3fd96c23feaaeb9fe32df3c0d35ee6dc548a5
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
null
null
null
apps/evm/lib/evm/debugger/breakpoint.ex
atoulme/mana
cff3fd96c23feaaeb9fe32df3c0d35ee6dc548a5
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
null
null
null
defmodule EVM.Debugger.Breakpoint do @moduledoc """ Breakpoints allow us to break execution of a given contract based on a set of conditions. """ @table __MODULE__ @type id :: integer() @type conditions :: [ # only triggers when contract executes at given address :address ] @type t :: %__MODULE__{ id: id | nil, enabled: boolean(), conditions: conditions | [], pc: nil | :start | :next | integer() } defstruct id: nil, enabled: true, conditions: [], pc: nil @doc """ Initializes the debugger. Must be called prior to getting or checking breakpoints. """ @spec init() :: :ok def init() do case :ets.info(@table) do :undefined -> :ets.new(@table, [:ordered_set, :public, :named_table]) _info -> :table_exists end :ok end @doc """ Adds a global breakpoint condition. We can set the following types of breakpoints: ... ## Examples iex> id = EVM.Debugger.Breakpoint.set_breakpoint(%EVM.Debugger.Breakpoint{conditions: [address: <<15::160>>]}) iex> EVM.Debugger.Breakpoint.get_breakpoint(id) |> Map.put(:id, nil) %EVM.Debugger.Breakpoint{conditions: [address: <<15::160>>]} """ @spec set_breakpoint(t) :: id def set_breakpoint(breakpoint) do id = next_id() true = :ets.insert_new(@table, {id, %{breakpoint | id: id}}) id end @doc """ Gets a breakpoint by id. This will raise if no such breakpoint is found. ## Examples iex> id = EVM.Debugger.Breakpoint.set_breakpoint(%EVM.Debugger.Breakpoint{conditions: [address: <<20::160>>]}) iex> EVM.Debugger.Breakpoint.get_breakpoint(id) |> Map.put(:id, nil) %EVM.Debugger.Breakpoint{conditions: [address: <<20::160>>]} iex> EVM.Debugger.Breakpoint.get_breakpoint(999) ** (CaseClauseError) no case clause matching: [] """ @spec get_breakpoint(id) :: t def get_breakpoint(breakpoint_id) do case :ets.lookup(@table, breakpoint_id) do [{_id, breakpoint}] -> breakpoint end end @doc """ Returns true if a given breakpoint matches the current execution environment. Note: we currently only support address matching. ## Examples iex> breakpoint = %EVM.Debugger.Breakpoint{conditions: [address: <<20::160>>], pc: :next} iex> machine_state = %EVM.MachineState{} iex> sub_state = %EVM.SubState{} iex> exec_env = %EVM.ExecEnv{address: <<20::160>>} iex> EVM.Debugger.Breakpoint.matches?(breakpoint, machine_state, sub_state, exec_env) true iex> breakpoint = %EVM.Debugger.Breakpoint{conditions: [address: <<20::160>>], pc: 999} iex> machine_state = %EVM.MachineState{} iex> sub_state = %EVM.SubState{} iex> exec_env = %EVM.ExecEnv{address: <<20::160>>} iex> EVM.Debugger.Breakpoint.matches?(breakpoint, machine_state, sub_state, exec_env) false iex> breakpoint = %EVM.Debugger.Breakpoint{conditions: [address: <<20::160>>], pc: 999} iex> machine_state = %EVM.MachineState{program_counter: 999} iex> sub_state = %EVM.SubState{} iex> exec_env = %EVM.ExecEnv{address: <<20::160>>} iex> EVM.Debugger.Breakpoint.matches?(breakpoint, machine_state, sub_state, exec_env) true iex> breakpoint = %EVM.Debugger.Breakpoint{conditions: [address: <<20::160>>], pc: nil} iex> machine_state = %EVM.MachineState{program_counter: 999} iex> sub_state = %EVM.SubState{} iex> exec_env = %EVM.ExecEnv{address: <<20::160>>} iex> EVM.Debugger.Breakpoint.matches?(breakpoint, machine_state, sub_state, exec_env) false iex> breakpoint = %EVM.Debugger.Breakpoint{conditions: [address: <<20::160>>], enabled: false, pc: :next} iex> machine_state = %EVM.MachineState{} iex> sub_state = %EVM.SubState{} iex> exec_env = %EVM.ExecEnv{address: <<20::160>>} iex> EVM.Debugger.Breakpoint.matches?(breakpoint, machine_state, sub_state, exec_env) false iex> breakpoint = %EVM.Debugger.Breakpoint{conditions: [address: <<20::160>>], pc: :next} iex> machine_state = %EVM.MachineState{} iex> sub_state = %EVM.SubState{} iex> exec_env = %EVM.ExecEnv{address: <<21::160>>} iex> EVM.Debugger.Breakpoint.matches?(breakpoint, machine_state, sub_state, exec_env) false """ @spec matches?(t, EVM.MachineState.t(), EVM.SubState.t(), EVM.ExecEnv.t()) :: boolean() def matches?(breakpoint, machine_state, _sub_state, exec_env) do should_break = break_on_next_pc?(breakpoint, machine_state.program_counter) breakpoint.enabled and should_break and Enum.all?(breakpoint.conditions, fn {condition, condition_val} -> case condition do :sender -> exec_env.sender == condition_val :address -> exec_env.address == condition_val end end) end @doc """ Describes a breakpoint's trigger conditions. ## Examples iex> %EVM.Debugger.Breakpoint{conditions: [address: <<20::160>>], pc: :next} |> EVM.Debugger.Breakpoint.describe "contract address 0x0000000000000000000000000000000000000014 (next)" iex> %EVM.Debugger.Breakpoint{conditions: [address: <<20::160>>], pc: :start} |> EVM.Debugger.Breakpoint.describe "contract address 0x0000000000000000000000000000000000000014 (start)" iex> %EVM.Debugger.Breakpoint{conditions: [address: <<20::160>>], pc: nil} |> EVM.Debugger.Breakpoint.describe "contract address 0x0000000000000000000000000000000000000014 (waiting)" iex> %EVM.Debugger.Breakpoint{conditions: [], pc: nil} |> EVM.Debugger.Breakpoint.describe "(waiting)" """ @spec describe(t) :: String.t() def describe(breakpoint) do conditions = for {k, v} <- breakpoint.conditions do case k do :sender -> "sender address 0x#{Base.encode16(v, case: :lower)}" :address -> "contract address 0x#{Base.encode16(v, case: :lower)}" end end |> Enum.join(" ") state = case breakpoint.pc do :next -> "next" :start -> "start" nil -> "waiting" end "#{conditions} (#{state})" |> String.trim() end @doc """ Returns all active breakpoints. ## Examples iex> id = EVM.Debugger.Breakpoint.set_breakpoint(%EVM.Debugger.Breakpoint{conditions: [address: <<1::160>>]}) iex> breakpoint = EVM.Debugger.Breakpoint.get_breakpoint(id) iex> breakpoints = EVM.Debugger.Breakpoint.get_breakpoints() iex> breakpoints |> Enum.count > 0 true iex> breakpoints |> Enum.member?(breakpoint) true """ @spec get_breakpoints() :: [t()] def get_breakpoints() do :ets.foldl( fn {_id, breakpoint}, acc -> [breakpoint | acc] end, [], @table ) end @doc """ Disables a given breakpoint. ## Examples iex> id = EVM.Debugger.Breakpoint.set_breakpoint(%EVM.Debugger.Breakpoint{conditions: [address: <<1::160>>]}) iex> EVM.Debugger.Breakpoint.disable_breakpoint(id) |> Map.put(:id, nil) %EVM.Debugger.Breakpoint{conditions: [address: <<1::160>>], enabled: false} """ @spec disable_breakpoint(id) :: t() def disable_breakpoint(breakpoint_id) do update_breakpoint(breakpoint_id, fn breakpoint -> %{breakpoint | enabled: false} end) end @doc """ Enables a given breakpoint. ## Examples iex> id = EVM.Debugger.Breakpoint.set_breakpoint(%EVM.Debugger.Breakpoint{conditions: [address: <<1::160>>], enabled: false}) iex> EVM.Debugger.Breakpoint.enable_breakpoint(id) |> Map.put(:id, nil) %EVM.Debugger.Breakpoint{conditions: [address: <<1::160>>], enabled: true} """ @spec enable_breakpoint(id) :: t() def enable_breakpoint(breakpoint_id) do update_breakpoint(breakpoint_id, fn breakpoint -> %{breakpoint | enabled: true} end) end @doc """ Sets the pc to next so that this breakpoint will likely break on the next run. ## Examples iex> id = EVM.Debugger.Breakpoint.set_breakpoint(%EVM.Debugger.Breakpoint{conditions: [address: <<1::160>>]}) iex> EVM.Debugger.Breakpoint.set_next(id) |> Map.put(:id, nil) %EVM.Debugger.Breakpoint{conditions: [address: <<1::160>>], pc: :next} """ @spec set_next(id) :: t() def set_next(breakpoint_id) do update_breakpoint(breakpoint_id, fn breakpoint -> %{breakpoint | pc: :next} end) end @doc """ Clears the pc so that this breakpoint doesn't continue breaking. ## Examples iex> id = EVM.Debugger.Breakpoint.set_breakpoint(%EVM.Debugger.Breakpoint{conditions: [address: <<1::160>>], pc: :next}) iex> EVM.Debugger.Breakpoint.clear_pc_if_one_time_break(id) |> Map.put(:id, nil) %EVM.Debugger.Breakpoint{conditions: [address: <<1::160>>], pc: nil} iex> id = EVM.Debugger.Breakpoint.set_breakpoint(%EVM.Debugger.Breakpoint{conditions: [address: <<1::160>>], pc: :start}) iex> EVM.Debugger.Breakpoint.clear_pc_if_one_time_break(id) |> Map.put(:id, nil) %EVM.Debugger.Breakpoint{conditions: [address: <<1::160>>], pc: nil} iex> id = EVM.Debugger.Breakpoint.set_breakpoint(%EVM.Debugger.Breakpoint{conditions: [address: <<1::160>>], pc: 5}) iex> EVM.Debugger.Breakpoint.clear_pc_if_one_time_break(id) |> Map.put(:id, nil) %EVM.Debugger.Breakpoint{conditions: [address: <<1::160>>], pc: 5} """ @spec clear_pc_if_one_time_break(id) :: t() def clear_pc_if_one_time_break(breakpoint_id) do update_breakpoint(breakpoint_id, fn breakpoint -> if breakpoint.pc in [:start, :next] do %{breakpoint | pc: nil} else breakpoint end end) end @spec update_breakpoint(id, (t -> t)) :: t defp update_breakpoint(breakpoint_id, fun) do breakpoint = get_breakpoint(breakpoint_id) updated_breakpoint = fun.(breakpoint) :ets.insert(@table, {breakpoint.id, updated_breakpoint}) updated_breakpoint end # Returns a new id for the next breakpoint @spec next_id() :: id defp next_id() do case :ets.last(@table) do :"$end_of_table" -> 1 key -> key + 1 end end # Returns true if we should break on the next instruction. # This is will be true if we're instructed to break on :next or :start, or # when the machine's breakpoint's pc matches the machine's pc. @spec break_on_next_pc?(t, EVM.MachineState.program_counter()) :: boolean() def break_on_next_pc?(breakpoint, pc) do case breakpoint.pc do nil -> false :next -> true :start -> true ^pc -> true _ -> false end end end
33.444795
131
0.649406
035ac7ed3d138e9e212a450f3168bc2a32b772c0
4,130
ex
Elixir
lib/mpesa.ex
manuelgeek/mpesa_elixir
24e17df6ef2f12cc514932ce4a6696bf348d310d
[ "MIT" ]
4
2020-03-01T18:44:40.000Z
2021-05-29T15:52:49.000Z
lib/mpesa.ex
manuelgeek/mpesa_elixir
24e17df6ef2f12cc514932ce4a6696bf348d310d
[ "MIT" ]
null
null
null
lib/mpesa.ex
manuelgeek/mpesa_elixir
24e17df6ef2f12cc514932ce4a6696bf348d310d
[ "MIT" ]
1
2021-05-29T15:52:58.000Z
2021-05-29T15:52:58.000Z
defmodule Mpesa do @moduledoc """ Documentation for `Mpesa`. """ @doc false def get_url do if Application.get_env(:mpesa, :env) === "sandbox" do "https://sandbox.safaricom.co.ke" else "https://api.safaricom.co.ke" end end @doc false def authorize do url = get_url() <> "/oauth/v1/generate?grant_type=client_credentials" string = Application.get_env(:mpesa, :consumer_key) <> ":" <> Application.get_env(:mpesa, :consumer_secret) token = Base.encode64(string) headers = [ {"Authorization", "Basic #{token}"}, {"Content-Type", "application/json"} ] HTTPoison.start() {:ok, response} = HTTPoison.get(url, headers) get_token(response) end @doc false def get_token(%{status_code: 400} = _response) do {:error, "Wrong Credentials"} end @doc false def get_token(%{status_code: 200, body: body} = _response) do {:ok, body} = body |> Poison.decode() {:ok, body["access_token"]} end @doc """ Initiates the Mpesa Lipa Online STK Push . ## Configuration Add below config to dec.exs / prod.exs files This asumes you have a clear understanding of how Daraja API works. The `env` is either `sandbox` or `production` `dev.exs` These are sandbox credentials given by Safaricom ```elixir config :mpesa, env: "sandbox", consumer_key: "72yw1nun6g1QQPPgOsAObCGSfuimGO7b", consumer_secret: "vRzZiD5RllMLIdLD", mpesa_short_code: "174379", mpesa_passkey: "bfb279f9aa9bdbcf158e97dd71a467cd2e0c893059b10f78e6b72ada1ed2c919", mpesa_callback_url: "http://91eb0af5.ngrok.io/api/payment/callback" ``` `prod.secret.exs` ```elixir config :mpesa, env: "production", consumer_key: "", consumer_secret: "", mpesa_short_code: "", mpesa_passkey: "", mpesa_callback_url: "" ``` ## Examples iex> Mpesa.make_request(10, "254724540039", "reference", "description") {:ok, %{ "CheckoutRequestID" => "ws_CO_010320202011179845", "CustomerMessage" => "Success. Request accepted for processing", "MerchantRequestID" => "25558-10595705-4", "ResponseCode" => "0", "ResponseDescription" => "Success. Request accepted for processing" }} {:error, "Invalid Access Token"} """ def make_request(amount, phone, reference, description) do case authorize() do {:ok, token} -> request(token, amount, phone, reference, description) {:error, message} -> {:error, message} _ -> {:error, 'An Error occurred, try again'} end end @doc false def request(token, amount, phone, reference, description) do url = get_url() <> "/mpesa/stkpush/v1/processrequest" paybill = Application.get_env(:mpesa, :mpesa_short_code) passkey = Application.get_env(:mpesa, :mpesa_passkey) {:ok, timestamp} = Timex.now() |> Timex.format("%Y%m%d%H%M%S", :strftime) password = Base.encode64(paybill <> passkey <> timestamp) payload = %{ "BusinessShortCode" => paybill, "Password" => password, "Timestamp" => timestamp, "TransactionType" => "CustomerPayBillOnline", "Amount" => amount, "PartyA" => phone, "PartyB" => paybill, "PhoneNumber" => phone, "CallBackURL" => Application.get_env(:mpesa, :mpesa_callback_url), "AccountReference" => reference, "TransactionDesc" => description } request_body = Poison.encode!(payload) headers = [ {"Authorization", "Bearer #{token}"}, {"Content-Type", "application/json"} ] {:ok, response} = HTTPoison.post(url, request_body, headers) get_response_body(response) end @doc false def get_response_body(%{status_code: 200, body: body} = _response) do {:ok, _body} = body |> Poison.decode() end @doc false def get_response_body(%{status_code: 404} = _response) do {:error, "Invalid Access Token"} end @doc false def get_response_body(%{status_code: 500} = _response) do {:error, "Unable to lock subscriber, a transaction is already in process for the current subscriber"} end end
26.474359
97
0.643099
035acb00afecc200bd53a4e4133e1a0a3328aa6a
4,935
ex
Elixir
lib/cf_sync/rich_text.ex
3h15/CFSync
0b5024688bcb40786c8313e77385f935686d1bdd
[ "MIT" ]
null
null
null
lib/cf_sync/rich_text.ex
3h15/CFSync
0b5024688bcb40786c8313e77385f935686d1bdd
[ "MIT" ]
null
null
null
lib/cf_sync/rich_text.ex
3h15/CFSync
0b5024688bcb40786c8313e77385f935686d1bdd
[ "MIT" ]
null
null
null
defmodule CFSync.RichText do @moduledoc """ RichText recursive struct RichText in Contentful is implemented as a tree of nodes. All nodes share a common structure and some of them have specific properties. Here I chosed to represent all nodes with a single struct for simplicity. """ alias CFSync.Link defstruct type: :document, content: [], value: nil, marks: [], target: nil, uri: nil, colspan: 0, rowspan: 0 @type marks :: :bold | :italic | :underline | :code @type node_types :: :document | :paragraph | :heading_1 | :heading_2 | :heading_3 | :heading_4 | :heading_5 | :heading_6 | :ol_list | :ul_list | :list_item | :hr | :quote | :embedded_entry | :embedded_asset | :table | :table_row | :table_cell | :table_header_cell | :hyperlink | :entry_hyperlink | :asset_hyperlink | :embedded_entry_inline | :text @type t :: %__MODULE__{ type: node_types(), content: list(t()), value: binary(), marks: list(marks()), target: nil | Link.t(), uri: nil | binary(), colspan: integer(), rowspan: integer() } @spec new(:empty | map) :: t() def new(data) when is_map(data) do create(data) |> maybe_add_content(data) |> maybe_add_value(data) |> maybe_add_marks(data) |> maybe_add_target(data) |> maybe_add_uri(data) |> maybe_add_colspan(data) |> maybe_add_rowspan(data) end def new(:empty) do create(%{ "nodeType" => "document", "content" => [] }) end defp create(data), do: %__MODULE__{type: type(data)} defp maybe_add_content(node, %{"content" => content}) when is_list(content), do: %__MODULE__{node | content: Enum.map(content, &new/1)} defp maybe_add_content(node, _data), do: node defp maybe_add_target(node, %{"data" => %{"target" => link_data}}), do: %__MODULE__{node | target: Link.new(link_data)} defp maybe_add_target(node, _data), do: node defp maybe_add_uri(node, %{"data" => %{"uri" => uri}}) when is_binary(uri), do: %__MODULE__{node | uri: uri} defp maybe_add_uri(node, _data), do: node defp maybe_add_colspan(node, %{"data" => %{"colspan" => colspan}}) when is_integer(colspan), do: %__MODULE__{node | colspan: colspan} defp maybe_add_colspan(node, _data), do: node defp maybe_add_rowspan(node, %{"data" => %{"rowspan" => rowspan}}) when is_integer(rowspan), do: %__MODULE__{node | rowspan: rowspan} defp maybe_add_rowspan(node, _data), do: node defp maybe_add_value(node, %{"value" => v}) when is_binary(v) do value = v |> Phoenix.HTML.html_escape() |> Phoenix.HTML.safe_to_string() %__MODULE__{node | value: value} end defp maybe_add_value(node, _data), do: node defp maybe_add_marks(node, %{"marks" => marks}) when is_list(marks), do: %__MODULE__{node | marks: Enum.map(marks, &mark/1)} defp maybe_add_marks(node, _data), do: node defp mark(%{"type" => "bold"}), do: :bold defp mark(%{"type" => "italic"}), do: :italic defp mark(%{"type" => "underline"}), do: :underline defp mark(%{"type" => "code"}), do: :code defp type(%{"nodeType" => "document"}), do: :document defp type(%{"nodeType" => "paragraph"}), do: :paragraph defp type(%{"nodeType" => "heading-1"}), do: :heading_1 defp type(%{"nodeType" => "heading-2"}), do: :heading_2 defp type(%{"nodeType" => "heading-3"}), do: :heading_3 defp type(%{"nodeType" => "heading-4"}), do: :heading_4 defp type(%{"nodeType" => "heading-5"}), do: :heading_5 defp type(%{"nodeType" => "heading-6"}), do: :heading_6 defp type(%{"nodeType" => "ordered-list"}), do: :ol_list defp type(%{"nodeType" => "unordered-list"}), do: :ul_list defp type(%{"nodeType" => "list-item"}), do: :list_item defp type(%{"nodeType" => "hr"}), do: :hr defp type(%{"nodeType" => "blockquote"}), do: :quote defp type(%{"nodeType" => "embedded-entry-block"}), do: :embedded_entry defp type(%{"nodeType" => "embedded-asset-block"}), do: :embedded_asset defp type(%{"nodeType" => "table"}), do: :table defp type(%{"nodeType" => "table-row"}), do: :table_row defp type(%{"nodeType" => "table-cell"}), do: :table_cell defp type(%{"nodeType" => "table-header-cell"}), do: :table_header_cell defp type(%{"nodeType" => "hyperlink"}), do: :hyperlink defp type(%{"nodeType" => "entry-hyperlink"}), do: :entry_hyperlink defp type(%{"nodeType" => "asset-hyperlink"}), do: :asset_hyperlink defp type(%{"nodeType" => "embedded-entry-inline"}), do: :embedded_entry_inline defp type(%{"nodeType" => "text"}), do: :text end
31.634615
94
0.586626