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
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
939630e923ee189b1933713e307525aaabe72503
| 850
|
ex
|
Elixir
|
squitter/lib/squitter/decoding/comm_b_alt_reply/decoder.ex
|
electricshaman/squitter
|
7a0dfbc125118b764d192f02b42b36596f6d4ac6
|
[
"MIT"
] | 34
|
2017-08-30T02:29:41.000Z
|
2021-05-29T20:21:43.000Z
|
squitter/lib/squitter/decoding/comm_b_alt_reply/decoder.ex
|
electricshaman/squitter
|
7a0dfbc125118b764d192f02b42b36596f6d4ac6
|
[
"MIT"
] | 7
|
2017-09-12T05:27:23.000Z
|
2020-01-06T22:07:52.000Z
|
squitter/lib/squitter/decoding/comm_b_alt_reply/decoder.ex
|
electricshaman/squitter
|
7a0dfbc125118b764d192f02b42b36596f6d4ac6
|
[
"MIT"
] | 9
|
2017-09-11T22:17:55.000Z
|
2022-01-31T03:07:58.000Z
|
defmodule Squitter.Decoding.CommBAltitudeReply do
alias Squitter.StatsTracker
alias Squitter.Decoding.ModeS
@df 20
defstruct [:df, :icao, :msg, :checksum, :parity, :pi, :crc, :time]
# TODO: Rename pi to ap. pi is on the uplink
def decode(time, <<@df::5, _control::27-bits, _payload::56-bits, pi::24-unsigned>> = msg) do
checksum = ModeS.checksum(msg, 112)
{:ok, address} = ModeS.icao_address(msg, checksum)
parity = ModeS.parity(pi, address)
StatsTracker.count({:df, @df, :decoded})
%__MODULE__{
df: @df,
icao: address,
checksum: checksum,
parity: parity,
pi: pi,
crc: if(checksum == pi, do: :valid, else: :invalid),
time: time,
msg: msg
}
end
def decode(_time, other) do
StatsTracker.count({:df, @df, :decode_failed})
{:unknown, other}
end
end
| 25
| 94
| 0.624706
|
9396716a18aabaf504eb3cb46746b534db9a4c65
| 65
|
ex
|
Elixir
|
web/views/layout_view.ex
|
jtrudell/yo_phoenix
|
d242ae5b0151bd7b6b8039e3507b8c4946acc6d4
|
[
"MIT"
] | null | null | null |
web/views/layout_view.ex
|
jtrudell/yo_phoenix
|
d242ae5b0151bd7b6b8039e3507b8c4946acc6d4
|
[
"MIT"
] | null | null | null |
web/views/layout_view.ex
|
jtrudell/yo_phoenix
|
d242ae5b0151bd7b6b8039e3507b8c4946acc6d4
|
[
"MIT"
] | null | null | null |
defmodule YoPhoenix.LayoutView do
use YoPhoenix.Web, :view
end
| 16.25
| 33
| 0.8
|
9396740cf9e11bd0d46962ef736a47f5d2615580
| 1,192
|
ex
|
Elixir
|
lib/events_tools/accounts/user.ex
|
community-tools/community-tools
|
40b0e6cc9234b44593d2ab60bb2303d7224deb30
|
[
"Apache-2.0"
] | 2
|
2017-10-06T01:14:35.000Z
|
2017-11-18T16:44:44.000Z
|
lib/events_tools/accounts/user.ex
|
community-tools/community-tools
|
40b0e6cc9234b44593d2ab60bb2303d7224deb30
|
[
"Apache-2.0"
] | 6
|
2017-10-06T00:04:59.000Z
|
2017-10-06T00:09:27.000Z
|
lib/events_tools/accounts/user.ex
|
apps-team/community-tools
|
40b0e6cc9234b44593d2ab60bb2303d7224deb30
|
[
"Apache-2.0"
] | 1
|
2017-10-06T01:17:35.000Z
|
2017-10-06T01:17:35.000Z
|
defmodule CommunityTools.Accounts.User do
use Ecto.Schema
import Ecto.Changeset
alias CommunityTools.Accounts.User
alias CommunityTools.Repo
schema "users" do
field :email, :string
field :password_web, :string, virtual: true
field :password, :string
has_one :profile, CommunityTools.Accounts.Profile
many_to_many :presentations, CommunityTools.Presentations.Presentation, join_through: "presentations_owners", on_delete: :delete_all, on_replace: :delete
many_to_many :roles, CommunityTools.Accounts.Roles, join_through: "users_roles", on_delete: :delete_all, on_replace: :delete
many_to_many :status, CommunityTools.Status.Status, join_through: "users_status", on_delete: :delete_all, on_replace: :delete
has_many :authorizations, CommunityTools.Accounts.Authorization
timestamps()
end
@required_fields ~w(email)a
@optional_fields ~w()a
def registration_changeset(model, params \\ :empty) do
model
|>cast(params, ~w(email)a)
|> validate_required(@required_fields)
end
@doc false
def changeset(%User{} = user, attrs) do
user
|> cast(attrs, [:email, :password])
|> validate_required([:email])
end
end
| 31.368421
| 157
| 0.739933
|
9396939bfcc395f651c843cc9f3ba6b01dbf05d7
| 2,832
|
ex
|
Elixir
|
clients/cloud_build/lib/google_api/cloud_build/v1/model/source_provenance.ex
|
MasashiYokota/elixir-google-api
|
975dccbff395c16afcb62e7a8e411fbb58e9ab01
|
[
"Apache-2.0"
] | null | null | null |
clients/cloud_build/lib/google_api/cloud_build/v1/model/source_provenance.ex
|
MasashiYokota/elixir-google-api
|
975dccbff395c16afcb62e7a8e411fbb58e9ab01
|
[
"Apache-2.0"
] | 1
|
2020-12-18T09:25:12.000Z
|
2020-12-18T09:25:12.000Z
|
clients/cloud_build/lib/google_api/cloud_build/v1/model/source_provenance.ex
|
MasashiYokota/elixir-google-api
|
975dccbff395c16afcb62e7a8e411fbb58e9ab01
|
[
"Apache-2.0"
] | 1
|
2020-10-04T10:12:44.000Z
|
2020-10-04T10:12:44.000Z
|
# 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.CloudBuild.V1.Model.SourceProvenance do
@moduledoc """
Provenance of the source. Ways to find the original source, or verify that some source was used for this build.
## Attributes
* `fileHashes` (*type:* `%{optional(String.t) => GoogleApi.CloudBuild.V1.Model.FileHashes.t}`, *default:* `nil`) - Output only. Hash(es) of the build source, which can be used to verify that the original source integrity was maintained in the build. Note that `FileHashes` will only be populated if `BuildOptions` has requested a `SourceProvenanceHash`. The keys to this map are file paths used as build source and the values contain the hash values for those files. If the build source came in a single package such as a gzipped tarfile (`.tar.gz`), the `FileHash` will be for the single path to that file.
* `resolvedRepoSource` (*type:* `GoogleApi.CloudBuild.V1.Model.RepoSource.t`, *default:* `nil`) - A copy of the build's `source.repo_source`, if exists, with any revisions resolved.
* `resolvedStorageSource` (*type:* `GoogleApi.CloudBuild.V1.Model.StorageSource.t`, *default:* `nil`) - A copy of the build's `source.storage_source`, if exists, with any generations resolved.
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:fileHashes => %{optional(String.t()) => GoogleApi.CloudBuild.V1.Model.FileHashes.t()},
:resolvedRepoSource => GoogleApi.CloudBuild.V1.Model.RepoSource.t(),
:resolvedStorageSource => GoogleApi.CloudBuild.V1.Model.StorageSource.t()
}
field(:fileHashes, as: GoogleApi.CloudBuild.V1.Model.FileHashes, type: :map)
field(:resolvedRepoSource, as: GoogleApi.CloudBuild.V1.Model.RepoSource)
field(:resolvedStorageSource, as: GoogleApi.CloudBuild.V1.Model.StorageSource)
end
defimpl Poison.Decoder, for: GoogleApi.CloudBuild.V1.Model.SourceProvenance do
def decode(value, options) do
GoogleApi.CloudBuild.V1.Model.SourceProvenance.decode(value, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.CloudBuild.V1.Model.SourceProvenance do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 53.433962
| 611
| 0.749294
|
93969d5fc829bb3419f3e2da344d2af2063f24b8
| 63
|
exs
|
Elixir
|
test/test_helper.exs
|
dark-elixir/dark_flows
|
efddf942177938d143d937caa8d9dcef5a843fb2
|
[
"Apache-2.0"
] | null | null | null |
test/test_helper.exs
|
dark-elixir/dark_flows
|
efddf942177938d143d937caa8d9dcef5a843fb2
|
[
"Apache-2.0"
] | null | null | null |
test/test_helper.exs
|
dark-elixir/dark_flows
|
efddf942177938d143d937caa8d9dcef5a843fb2
|
[
"Apache-2.0"
] | null | null | null |
Code.require_file("test_modules.exs", __DIR__)
ExUnit.start()
| 15.75
| 46
| 0.777778
|
9396a1511dc37216006e225fdf8fa844d738474b
| 548
|
ex
|
Elixir
|
lib/key_web/controllers/fallback_controller.ex
|
joaothallis/key
|
10e7aa872d907ca585418ca0cd74c4c2a88de033
|
[
"MIT"
] | 1
|
2018-09-09T22:30:16.000Z
|
2018-09-09T22:30:16.000Z
|
lib/key_web/controllers/fallback_controller.ex
|
joaothallis/key
|
10e7aa872d907ca585418ca0cd74c4c2a88de033
|
[
"MIT"
] | 36
|
2018-09-09T15:08:05.000Z
|
2022-03-23T09:27:10.000Z
|
lib/key_web/controllers/fallback_controller.ex
|
joaothallis/key
|
10e7aa872d907ca585418ca0cd74c4c2a88de033
|
[
"MIT"
] | null | null | null |
defmodule KeyWeb.FallbackController do
@moduledoc """
Translates controller action results into valid `Plug.Conn` responses.
See `Phoenix.Controller.action_fallback/1` for more details.
"""
use KeyWeb, :controller
def call(conn, {:error, %Ecto.Changeset{} = changeset}) do
conn
|> put_status(:unprocessable_entity)
|> render(KeyWeb.ChangesetView, "error.json", changeset: changeset)
end
def call(conn, {:error, :not_found}) do
conn
|> put_status(:not_found)
|> render(KeyWeb.ErrorView, :"404")
end
end
| 24.909091
| 72
| 0.695255
|
9396b27feb4f8e986782651be169310ce2196233
| 12,979
|
ex
|
Elixir
|
lib/ash/resource/info.ex
|
savish/ash
|
7faf73097a6c6f801851e9d89569b6f5e6e87f81
|
[
"MIT"
] | null | null | null |
lib/ash/resource/info.ex
|
savish/ash
|
7faf73097a6c6f801851e9d89569b6f5e6e87f81
|
[
"MIT"
] | null | null | null |
lib/ash/resource/info.ex
|
savish/ash
|
7faf73097a6c6f801851e9d89569b6f5e6e87f81
|
[
"MIT"
] | null | null | null |
defmodule Ash.Resource.Info do
@moduledoc "Introspection for resources"
alias Ash.Dsl.Extension
@spec set_metadata(Ash.Resource.record(), map) :: Ash.Resource.record()
def set_metadata(record, map) do
%{record | __metadata__: Ash.Helpers.deep_merge_maps(record.__metadata__, map)}
end
@spec put_metadata(Ash.Resource.record(), atom, term) :: Ash.Resource.record()
def put_metadata(record, key, term) do
set_metadata(record, %{key => term})
end
@spec get_metadata(Ash.Resource.record(), atom | list(atom)) :: term
def get_metadata(record, key_or_path) do
get_in(record.__metadata__ || %{}, List.wrap(key_or_path))
end
@spec selected?(Ash.Resource.record(), atom) :: boolean
def selected?(%resource{} = record, field) do
case get_metadata(record, :selected) do
nil ->
attribute = Ash.Resource.Info.attribute(resource, field)
attribute && (!attribute.private? || attribute.primary_key?)
select ->
if field in select do
true
else
attribute = Ash.Resource.Info.attribute(resource, field)
attribute && attribute.primary_key?
end
end
end
@spec interfaces(Ash.Resource.t()) :: [Ash.Resource.Interface.t()]
def interfaces(resource) do
Extension.get_entities(resource, [:code_interface])
end
@spec extensions(Ash.Resource.t()) :: [module]
def extensions(resource) do
Extension.get_persisted(resource, :extensions, [])
end
@spec embedded?(Ash.Resource.t()) :: boolean
def embedded?(resource) do
Extension.get_persisted(resource, :embedded?, false)
end
@spec description(Ash.Resource.t()) :: String.t() | nil
def description(resource) do
Extension.get_opt(resource, [:resource], :description, "no description")
end
@spec base_filter(Ash.Resource.t()) :: term
def base_filter(resource) do
Extension.get_opt(resource, [:resource], :base_filter, nil)
end
@spec default_context(Ash.Resource.t()) :: term
def default_context(resource) do
Extension.get_opt(resource, [:resource], :default_context, nil)
end
@doc "A list of identities for the resource"
@spec identities(Ash.Resource.t()) :: [Ash.Resource.Identity.t()]
def identities(resource) do
Extension.get_entities(resource, [:identities])
end
@doc "A list of authorizers to be used when accessing"
@spec authorizers(Ash.Resource.t()) :: [module]
def authorizers(resource) do
Extension.get_persisted(resource, :authorizers, [])
end
@doc "A list of notifiers to be used when accessing"
@spec notifiers(Ash.Resource.t()) :: [module]
def notifiers(resource) do
Extension.get_persisted(resource, :notifiers, [])
end
@spec validations(Ash.Resource.t(), :create | :update | :destroy) :: [
Ash.Resource.Validation.t()
]
def validations(resource, type) do
resource
|> validations()
|> Enum.filter(&(type in &1.on))
end
@doc "A list of all validations for the resource"
@spec validations(Ash.Resource.t()) :: [Ash.Resource.Validation.t()]
def validations(resource) do
Extension.get_entities(resource, [:validations])
end
@doc "Whether or not a given module is a resource module"
@spec resource?(module) :: boolean
def resource?(module) when is_atom(module) do
# Prevent compile time dependency
Ash.Dsl.is?(module, Module.concat(["Ash", Resource]))
end
def resource?(_), do: false
@doc "A list of field names corresponding to the primary key"
@spec primary_key(Ash.Resource.t()) :: list(atom)
def primary_key(resource) do
Ash.Dsl.Extension.get_persisted(resource, :primary_key, [])
end
@doc "Returns all relationships of a resource"
@spec relationships(Ash.Resource.t()) :: list(Ash.Resource.Relationships.relationship())
def relationships(resource) do
Extension.get_entities(resource, [:relationships])
end
@doc "Get a relationship by name or path"
@spec relationship(Ash.Resource.t(), atom | String.t() | [atom | String.t()]) ::
Ash.Resource.Relationships.relationship() | nil
def relationship(resource, [name]) do
relationship(resource, name)
end
def relationship(resource, [name | rest]) do
case relationship(resource, name) do
nil ->
nil
relationship ->
relationship(relationship.destination, rest)
end
end
def relationship(resource, relationship_name) when is_binary(relationship_name) do
resource
|> relationships()
|> Enum.find(&(to_string(&1.name) == relationship_name))
end
def relationship(resource, relationship_name) do
resource
|> relationships()
|> Enum.find(&(&1.name == relationship_name))
end
@doc "Returns all public relationships of a resource"
@spec public_relationships(Ash.Resource.t()) :: list(Ash.Resource.Relationships.relationship())
def public_relationships(resource) do
resource
|> relationships()
|> Enum.reject(& &1.private?)
end
@doc "Get a public relationship by name or path"
def public_relationship(resource, [name | rest]) do
case public_relationship(resource, name) do
nil ->
nil
relationship ->
public_relationship(relationship.destination, rest)
end
end
def public_relationship(resource, relationship_name) when is_binary(relationship_name) do
resource
|> relationships()
|> Enum.find(&(to_string(&1.name) == relationship_name && !&1.private?))
end
def public_relationship(resource, relationship_name) do
resource
|> relationships()
|> Enum.find(&(&1.name == relationship_name && !&1.private?))
end
@doc "Get the multitenancy strategy for a resource"
@spec multitenancy_strategy(Ash.Resource.t()) :: :context | :attribute | nil
def multitenancy_strategy(resource) do
Ash.Dsl.Extension.get_opt(resource, [:multitenancy], :strategy, nil)
end
@spec multitenancy_attribute(Ash.Resource.t()) :: atom | nil
def multitenancy_attribute(resource) do
Ash.Dsl.Extension.get_opt(resource, [:multitenancy], :attribute, nil)
end
@spec multitenancy_parse_attribute(Ash.Resource.t()) :: {atom, atom, list(any)}
def multitenancy_parse_attribute(resource) do
Ash.Dsl.Extension.get_opt(
resource,
[:multitenancy],
:parse_attribute,
{__MODULE__, :identity, []}
)
end
@doc false
def identity(x), do: x
@spec multitenancy_global?(Ash.Resource.t()) :: atom | nil
def multitenancy_global?(resource) do
Ash.Dsl.Extension.get_opt(resource, [:multitenancy], :global?, nil)
end
@spec multitenancy_source(Ash.Resource.t()) :: atom | nil
def multitenancy_source(resource) do
Ash.Dsl.Extension.get_opt(resource, [:multitenancy], :source, nil)
end
@spec multitenancy_template(Ash.Resource.t()) :: atom | nil
def multitenancy_template(resource) do
Ash.Dsl.Extension.get_opt(resource, [:multitenancy], :template, nil)
end
@doc "Returns all calculations of a resource"
@spec calculations(Ash.Resource.t()) :: list(Ash.Resource.Calculation.t())
def calculations(resource) do
Extension.get_entities(resource, [:calculations])
end
@doc "Get a calculation by name"
@spec calculation(Ash.Resource.t(), atom | String.t()) :: Ash.Resource.Calculation.t() | nil
def calculation(resource, name) when is_binary(name) do
resource
|> calculations()
|> Enum.find(&(to_string(&1.name) == name))
end
def calculation(resource, name) do
resource
|> calculations()
|> Enum.find(&(&1.name == name))
end
@doc "Returns all public calculations of a resource"
@spec public_calculations(Ash.Resource.t()) :: list(Ash.Resource.Calculation.t())
def public_calculations(resource) do
resource
|> Extension.get_entities([:calculations])
|> Enum.reject(& &1.private?)
end
@doc "Get a public calculation by name"
@spec public_calculation(Ash.Resource.t(), atom | String.t()) ::
Ash.Resource.Calculation.t() | nil
def public_calculation(resource, name) when is_binary(name) do
resource
|> calculations()
|> Enum.find(&(to_string(&1.name) == name && !&1.private?))
end
def public_calculation(resource, name) do
resource
|> calculations()
|> Enum.find(&(&1.name == name && !&1.private?))
end
@doc "Returns all aggregates of a resource"
@spec aggregates(Ash.Resource.t()) :: list(Ash.Resource.Aggregate.t())
def aggregates(resource) do
Extension.get_entities(resource, [:aggregates])
end
@doc "Get an aggregate by name"
@spec aggregate(Ash.Resource.t(), atom | String.t()) :: Ash.Resource.Aggregate.t() | nil
def aggregate(resource, name) when is_binary(name) do
resource
|> aggregates()
|> Enum.find(&(to_string(&1.name) == name))
end
def aggregate(resource, name) do
resource
|> aggregates()
|> Enum.find(&(&1.name == name))
end
@doc "Returns all public aggregates of a resource"
@spec public_aggregates(Ash.Resource.t()) :: list(Ash.Resource.Aggregate.t())
def public_aggregates(resource) do
resource
|> Extension.get_entities([:aggregates])
|> Enum.reject(& &1.private?)
end
@doc "Get an aggregate by name"
@spec public_aggregate(Ash.Resource.t(), atom | String.t()) ::
Ash.Resource.Aggregate.t() | nil
def public_aggregate(resource, name) when is_binary(name) do
resource
|> aggregates()
|> Enum.find(&(to_string(&1.name) == name && !&1.private?))
end
def public_aggregate(resource, name) do
resource
|> aggregates()
|> Enum.find(&(&1.name == name && !&1.private?))
end
@doc "Returns the primary action of the given type"
@spec primary_action!(Ash.Resource.t(), Ash.Resource.Actions.action_type()) ::
Ash.Resource.Actions.action() | no_return
def primary_action!(resource, type) do
case primary_action(resource, type) do
nil -> raise "Required primary #{type} action for #{inspect(resource)}"
action -> action
end
end
@doc "Returns the primary action of a given type"
@spec primary_action(Ash.Resource.t(), Ash.Resource.Actions.action_type()) ::
Ash.Resource.Actions.action() | nil
def primary_action(resource, type) do
resource
|> actions()
|> Enum.filter(&(&1.type == type))
|> case do
[action] -> action
actions -> Enum.find(actions, & &1.primary?)
end
end
@doc "Returns the configured default actions"
@spec default_actions(Ash.Resource.t()) :: [:create | :read | :update | :destroy]
def default_actions(resource) do
Extension.get_opt(
resource,
[:actions],
:defaults,
[:create, :read, :update, :destroy]
)
end
@doc "Returns all actions of a resource"
@spec actions(Ash.Resource.t()) :: [Ash.Resource.Actions.action()]
def actions(resource) do
Extension.get_entities(resource, [:actions])
end
@doc "Returns the action with the matching name and type on the resource"
@spec action(Ash.Resource.t(), atom(), Ash.Resource.Actions.action_type() | nil) ::
Ash.Resource.Actions.action() | nil
def action(resource, name, _type \\ nil) do
# We used to need type, but we don't anymore since action names are unique
resource
|> actions()
|> Enum.find(&(&1.name == name))
end
@doc "Returns all attributes of a resource"
@spec attributes(Ash.Resource.t()) :: [Ash.Resource.Attribute.t()]
def attributes(resource) do
Extension.get_entities(resource, [:attributes])
end
@doc "Get an attribute name from the resource"
@spec attribute(Ash.Resource.t(), String.t() | atom) :: Ash.Resource.Attribute.t() | nil
def attribute(resource, name) when is_binary(name) do
resource
|> attributes()
|> Enum.find(&(to_string(&1.name) == name))
end
def attribute(resource, name) do
resource
|> attributes()
|> Enum.find(&(&1.name == name))
end
@doc "Returns all public attributes of a resource"
@spec public_attributes(Ash.Resource.t()) :: [Ash.Resource.Attribute.t()]
def public_attributes(resource) do
resource
|> attributes()
|> Enum.reject(& &1.private?)
end
@doc "Get a public attribute name from the resource"
@spec public_attribute(Ash.Resource.t(), String.t() | atom) :: Ash.Resource.Attribute.t() | nil
def public_attribute(resource, name) when is_binary(name) do
resource
|> attributes()
|> Enum.find(&(to_string(&1.name) == name && !&1.private?))
end
def public_attribute(resource, name) do
resource
|> attributes()
|> Enum.find(&(&1.name == name && !&1.private?))
end
@spec related(Ash.Resource.t(), atom() | String.t() | [atom() | String.t()]) ::
Ash.Resource.t() | nil
def related(resource, relationship) when not is_list(relationship) do
related(resource, [relationship])
end
def related(resource, []), do: resource
def related(resource, [path | rest]) do
case relationship(resource, path) do
%{destination: destination} -> related(destination, rest)
nil -> nil
end
end
end
| 31.199519
| 97
| 0.674243
|
9396b3cbb777f522694bbeb36cef4ba4324d9daf
| 124
|
exs
|
Elixir
|
config/test.exs
|
edenlabllc/nex_json_schema
|
f7445a1da1f470b2876e9ee28965e675c54e74c2
|
[
"MIT"
] | 3
|
2016-10-25T12:10:00.000Z
|
2020-11-06T21:33:23.000Z
|
config/test.exs
|
edenlabllc/nex_json_schema
|
f7445a1da1f470b2876e9ee28965e675c54e74c2
|
[
"MIT"
] | 12
|
2017-05-31T17:23:16.000Z
|
2020-10-21T00:58:45.000Z
|
config/test.exs
|
edenlabllc/nex_json_schema
|
f7445a1da1f470b2876e9ee28965e675c54e74c2
|
[
"MIT"
] | 4
|
2018-06-18T23:37:53.000Z
|
2020-07-08T13:03:20.000Z
|
use Mix.Config
config :nex_json_schema, :remote_schema_resolver, fn url -> HTTPoison.get!(url).body |> Jason.decode!() end
| 31
| 107
| 0.75
|
9396c15b539c1bc0cbdd1bbe747e69b240dbeb47
| 876
|
ex
|
Elixir
|
godin_umbrella/apps/godin_web/lib/godin_web/application.ex
|
ruben44bac/god-n
|
af78dc683b58bb3a5e4dbfec2dd53887651a8aa7
|
[
"MIT"
] | null | null | null |
godin_umbrella/apps/godin_web/lib/godin_web/application.ex
|
ruben44bac/god-n
|
af78dc683b58bb3a5e4dbfec2dd53887651a8aa7
|
[
"MIT"
] | null | null | null |
godin_umbrella/apps/godin_web/lib/godin_web/application.ex
|
ruben44bac/god-n
|
af78dc683b58bb3a5e4dbfec2dd53887651a8aa7
|
[
"MIT"
] | null | null | null |
defmodule GodinWeb.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 endpoint when the application starts
GodinWeb.Endpoint
# Starts a worker by calling: GodinWeb.Worker.start_link(arg)
# {GodinWeb.Worker, arg},
]
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: GodinWeb.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
GodinWeb.Endpoint.config_change(changed, removed)
:ok
end
end
| 29.2
| 67
| 0.72032
|
9396ca9151ed525db3ef8b4fa394a0cb6086cde4
| 4,139
|
ex
|
Elixir
|
lib/daguex/temp_file.ex
|
secretworry/daguex
|
323e9eb6dfe29cb94783937e89244b6de8de7d0c
|
[
"Apache-2.0"
] | null | null | null |
lib/daguex/temp_file.ex
|
secretworry/daguex
|
323e9eb6dfe29cb94783937e89244b6de8de7d0c
|
[
"Apache-2.0"
] | null | null | null |
lib/daguex/temp_file.ex
|
secretworry/daguex
|
323e9eb6dfe29cb94783937e89244b6de8de7d0c
|
[
"Apache-2.0"
] | null | null | null |
defmodule Daguex.TempFileError do
defexception [:message]
end
defmodule Daguex.TempFile do
@moduledoc false
@moduledoc """
A server (a `GenServer` specifically) that manages temporary files
Temporary files are stored in a temporary directory
and removed from that directory after the process that
requested the file dies.
"""
use GenServer
@table __MODULE__
@max_attempts 10
@temp_env_vars ~w(DAGUEX_TMPDIR TMPDIR TMP TEMP)s
@doc """
Requests a random temporary file to be created in the tmp directory
with the given prefix.
"""
@spec temp_file(binary) ::
{:ok, binary} |
{:too_many_attempts, binary, pos_integer} |
{:no_tmp, [binary]}
def temp_file(prefix) do
case ensure_tmp() do
{:ok, tmp, paths} ->
open_random_file(prefix, tmp, 0, paths)
{:no_tmp, tmps} ->
{:no_tmp, tmps}
end
end
defp ensure_tmp() do
pid = self()
server = temp_file_server()
case :ets.lookup(@table, pid) do
[{^pid, tmp, paths}] ->
{:ok, tmp, paths}
[] ->
{:ok, tmps} = GenServer.call(server, :register)
{mega, _, _} = :os.timestamp
subdir = "/daguex-" <> i(mega)
if tmp = Enum.find_value(tmps, &make_tmp_dir(&1 <> subdir)) do
true = :ets.insert_new(@table, {pid, tmp, []})
{:ok, tmp, []}
else
{:no_tmp, tmps}
end
end
end
defp make_tmp_dir(path) do
case File.mkdir_p(path) do
:ok -> path |> Path.expand
{:error, _} -> nil
end
end
defp open_random_file(prefix, tmp, attempts, paths) when attempts < @max_attempts do
path = path(prefix, tmp)
case :file.write_file(path, "", [:write, :raw, :exclusive, :binary]) do
:ok ->
:ets.update_element(@table, self(), {3, [path|paths]})
{:ok, path}
{:error, reason} when reason in [:eexist, :eacces] ->
open_random_file(prefix, tmp, attempts + 1, paths)
end
end
defp open_random_file(_prefix, tmp, attempts, _paths) do
{:too_many_attempts, tmp, attempts}
end
defp path(prefix, tmp) do
{_mega, sec, micro} = :os.timestamp
scheduler_id = :erlang.system_info(:scheduler_id)
tmp <> "/" <> prefix <> "-" <> i(sec) <> "-" <> i(micro) <> "-" <> i(scheduler_id)
end
@compile {:inline, i: 1}
defp i(integer), do: Integer.to_string(integer)
@doc """
Requests a random file to be created in the upload directory
with the given prefix. Raises on failure.
"""
@spec temp_file!(binary) :: binary | no_return
def temp_file!(prefix) do
case temp_file(prefix) do
{:ok, path} ->
path
{:too_many_attempts, tmp, attempts} ->
raise Daguex.TempFileError, "tried #{attempts} times to create an temporary file at #{tmp} but failed. " <>
"Set DAGUEX_TMPDIR to a directory with write permission"
{:no_tmp, _tmps} ->
raise Daguex.TempFileError, "could not create a tmp directory to store temporary files. " <>
"Set DAGUEX_TMPDIR to a directory with write permission"
end
end
defp temp_file_server do
Process.whereis(__MODULE__) ||
raise Daguex.TempFileError, "could not find process #{inspect __MODULE__}. Have you started the :daguex application?"
end
@doc """
Starts the temperory file handling server.
"""
def start_link() do
GenServer.start_link(__MODULE__, :ok, [name: __MODULE__])
end
## Callbacks
def init(:ok) do
tmp = Enum.find_value @temp_env_vars, "/tmp", &System.get_env/1
cwd = Path.join(File.cwd!, "tmp")
:ets.new(@table, [:named_table, :public, :set])
{:ok, [tmp, cwd]}
end
def handle_call(:register, {pid, _ref}, dirs) do
Process.monitor(pid)
{:reply, {:ok, dirs}, dirs}
end
def handle_info({:DOWN, _ref, :process, pid, _reason}, state) do
case :ets.lookup(@table, pid) do
[{pid, _tmp, paths}] ->
:ets.delete(@table, pid)
Enum.each paths, &:file.delete/1
[] ->
:ok
end
{:noreply, state}
end
def handle_info(msg, state) do
super(msg, state)
end
end
| 27.593333
| 123
| 0.609809
|
9397033ebe5a6852930c281fd39cbc6fc6a42cea
| 12,090
|
exs
|
Elixir
|
test/tarams_test.exs
|
prithvihv/tarams
|
45396934d91aa624da6e3ef233d8e26236eeed2c
|
[
"MIT"
] | null | null | null |
test/tarams_test.exs
|
prithvihv/tarams
|
45396934d91aa624da6e3ef233d8e26236eeed2c
|
[
"MIT"
] | null | null | null |
test/tarams_test.exs
|
prithvihv/tarams
|
45396934d91aa624da6e3ef233d8e26236eeed2c
|
[
"MIT"
] | null | null | null |
defmodule ParamTest.StringList do
def cast(value) when is_binary(value) do
rs =
String.split(value, ",")
|> Tarams.scrub_param()
|> Tarams.clean_nil()
{:ok, rs}
end
def cast(_), do: :error
end
defmodule ParamTest do
use ExUnit.Case
alias Tarams
defmodule Address do
defstruct [:province, :city]
end
describe "test srub_params" do
test "scrub empty string to nil" do
params = %{"email" => "", "type" => "customer"}
assert %{"email" => nil, "type" => "customer"} = Tarams.scrub_param(params)
end
test "scrub string with all space to nil" do
params = %{"email" => " ", "type" => "customer"}
assert %{"email" => nil, "type" => "customer"} = Tarams.scrub_param(params)
end
test "scrub success with atom key" do
params = %{email: " ", password: "123"}
assert %{email: nil, password: "123"} = Tarams.scrub_param(params)
end
test "scrub success with nested map" do
params = %{
email: " ",
password: "123",
address: %{street: "", province: " ", city: "HCM"}
}
assert %{address: %{street: nil, province: nil, city: "HCM"}} = Tarams.scrub_param(params)
end
test "scrub array params" do
params = %{ids: [1, 2, "3", "", " "]}
assert %{ids: [1, 2, "3", nil, nil]} = Tarams.scrub_param(params)
end
test "scrub success with mix atom and string key" do
params = %{email: " "} |> Map.put("type", "customer")
assert %{email: nil} = Tarams.scrub_param(params)
end
test "scrub skip struct" do
params = %{
"email" => " ",
"type" => "customer",
"address" => %Address{province: " ", city: "Hochiminh"}
}
assert %{"address" => %Address{province: " ", city: "Hochiminh"}} =
Tarams.scrub_param(params)
end
test "scrub plug" do
params = %{email: " ", password: "123"}
assert %{params: %{email: nil, password: "123"}} = Tarams.plug_scrub(%{params: params})
assert %{params: %{email: nil}} = Tarams.plug_scrub(%{params: params}, [:email, :name])
end
end
describe "test clean_nil" do
test "clean nil map" do
params = %{"email" => nil, "type" => "customer"}
assert %{"type" => "customer"} = Tarams.clean_nil(params)
end
test "scrub nil success with list" do
params = %{ids: [2, nil, 3, nil]}
assert %{ids: [2, 3]} = Tarams.clean_nil(params)
end
test "clean nil success with nested map" do
params = %{
email: nil,
password: "123",
address: %{street: nil, province: nil, city: "HCM"}
}
assert %{address: %{city: "HCM"}} = Tarams.clean_nil(params)
end
test "clean nil success with nested list" do
params = %{
users: [
%{
name: nil,
age: 20,
hobbies: ["cooking", nil]
},
nil
]
}
assert %{
users: [
%{
age: 20,
hobbies: ["cooking"]
}
]
} == Tarams.clean_nil(params)
end
test "clean nil skip struct" do
params = %{
"email" => "dn@gmail.com",
"type" => "customer",
"address" => %Address{province: nil, city: "Hochiminh"}
}
assert %{"address" => %Address{province: nil, city: "Hochiminh"}} = Tarams.clean_nil(params)
end
end
alias ParamTest.StringList
describe "Tarams.cast" do
@type_checks [
[:string, "Bluz", "Bluz", :ok],
[:string, 10, nil, :error],
[:binary, "Bluz", "Bluz", :ok],
[:binary, true, nil, :error],
[:boolean, "1", true, :ok],
[:boolean, "true", true, :ok],
[:boolean, "0", false, :ok],
[:boolean, "false", false, :ok],
[:boolean, true, true, :ok],
[:boolean, 10, nil, :error],
[:integer, 10, 10, :ok],
[:integer, "10", 10, :ok],
[:integer, 10.0, nil, :error],
[:integer, "10.0", nil, :error],
[:float, 10.1, 10.1, :ok],
[:float, "10.1", 10.1, :ok],
[:float, 10, 10.0, :ok],
[:float, "10", 10.0, :ok],
[:float, "10xx", nil, :error],
[:decimal, "10.1", Decimal.new("10.1"), :ok],
[:decimal, "10.1a", nil, :error],
[:map, %{name: "Bluz"}, %{name: "Bluz"}, :ok],
[:map, %{"name" => "Bluz"}, %{"name" => "Bluz"}, :ok],
[:map, [], nil, :error],
[{:array, :integer}, [1, 2, 3], [1, 2, 3], :ok],
[{:array, :integer}, ["1", "2", "3"], [1, 2, 3], :ok],
[{:array, :string}, ["1", "2", "3"], ["1", "2", "3"], :ok],
[StringList, "1,2,3", ["1", "2", "3"], :ok],
[StringList, "", [], :ok],
[StringList, [], nil, :error],
[{:array, StringList}, ["1", "2"], [["1"], ["2"]], :ok],
[{:array, StringList}, [1, 2], nil, :error],
[:date, "2020-10-11", ~D[2020-10-11], :ok],
[:date, "2020-10-11T01:01:01", ~D[2020-10-11], :ok],
[:date, ~D[2020-10-11], ~D[2020-10-11], :ok],
[:date, ~N[2020-10-11 01:00:00], ~D[2020-10-11], :ok],
[:date, ~U[2020-10-11 01:00:00Z], ~D[2020-10-11], :ok],
[:date, "2", nil, :error],
[:time, "01:01:01", ~T[01:01:01], :ok],
[:time, ~N[2020-10-11 01:01:01], ~T[01:01:01], :ok],
[:time, ~U[2020-10-11 01:01:01Z], ~T[01:01:01], :ok],
[:time, ~T[01:01:01], ~T[01:01:01], :ok],
[:time, "2", nil, :error],
[:naive_datetime, "-2020-10-11 01:01:01", ~N[-2020-10-11 01:01:01], :ok],
[:naive_datetime, "2020-10-11 01:01:01", ~N[2020-10-11 01:01:01], :ok],
[:naive_datetime, "2020-10-11 01:01:01+07", ~N[2020-10-11 01:01:01], :ok],
[:naive_datetime, ~N[2020-10-11 01:01:01], ~N[2020-10-11 01:01:01], :ok],
[
:naive_datetime,
%{year: 2020, month: 10, day: 11, hour: 1, minute: 1, second: 1},
~N[2020-10-11 01:01:01],
:ok
],
[
:naive_datetime,
%{year: "", month: 10, day: 11, hour: 1, minute: 1, second: 1},
nil,
:error
],
[
:naive_datetime,
%{year: "", month: "", day: "", hour: "", minute: "", second: ""},
nil,
:ok
],
[:naive_datetime, "2", nil, :error],
[:naive_datetime, true, nil, :error],
[:datetime, "-2020-10-11 01:01:01", ~U[-2020-10-11 01:01:01Z], :ok],
[:datetime, "2020-10-11 01:01:01", ~U[2020-10-11 01:01:01Z], :ok],
[:datetime, "2020-10-11 01:01:01-07", ~U[2020-10-11 08:01:01Z], :ok],
[:datetime, ~N[2020-10-11 01:01:01], ~U[2020-10-11 01:01:01Z], :ok],
[:datetime, ~U[2020-10-11 01:01:01Z], ~U[2020-10-11 01:01:01Z], :ok],
[:datetime, "2", nil, :error],
[:utc_datetime, "-2020-10-11 01:01:01", ~U[-2020-10-11 01:01:01Z], :ok],
[:utc_datetime, "2020-10-11 01:01:01", ~U[2020-10-11 01:01:01Z], :ok],
[:utc_datetime, "2020-10-11 01:01:01-07", ~U[2020-10-11 08:01:01Z], :ok],
[:utc_datetime, ~N[2020-10-11 01:01:01], ~U[2020-10-11 01:01:01Z], :ok],
[:utc_datetime, ~U[2020-10-11 01:01:01Z], ~U[2020-10-11 01:01:01Z], :ok],
[:utc_datetime, "2", nil, :error],
[:any, "any", "any", :ok]
]
test "cast base type" do
@type_checks
|> Enum.each(fn [type, value, expected_value, expect] ->
rs =
Tarams.cast(%{"key" => value}, %{
key: type
})
if expect == :ok do
assert {:ok, %{key: ^expected_value}} = rs
else
assert {:error, _} = rs
end
end)
end
test "schema short hand" do
assert {:ok, %{number: 10}} = Tarams.cast(%{number: "10"}, %{number: :integer})
assert {:ok, %{number: 10}} =
Tarams.cast(%{number: "10"}, %{number: [:integer, number: [min: 5]]})
end
test "cast ok" do
assert 10 = Tarams.Type.cast!(:integer, 10)
assert 10 = Tarams.Type.cast!(:integer, "10")
end
test "cast raise exception" do
assert_raise RuntimeError, fn ->
Tarams.Type.cast!(:integer, "10xx")
end
end
test "cast with alias" do
schema = %{
email: [type: :string, as: :user_email]
}
rs = Tarams.cast(%{email: "xx@yy.com"}, schema)
assert {:ok, %{user_email: "xx@yy.com"}} = rs
end
test "cast use default value if field not exist in params" do
assert {:ok, %{name: "Dzung"}} =
Tarams.cast(%{}, %{name: [type: :string, default: "Dzung"]})
end
test "cast use default function if field not exist in params" do
assert {:ok, %{name: "123"}} =
Tarams.cast(%{}, %{name: [type: :string, default: fn -> "123" end]})
end
test "cast validate required skip if default is set" do
assert {:ok, %{name: "Dzung"}} =
Tarams.cast(%{}, %{name: [type: :string, default: "Dzung", required: true]})
end
test "cast func is used if set" do
assert {:ok, %{name: "Dzung is so handsome"}} =
Tarams.cast(%{name: "Dzung"}, %{
name: [
type: :string,
cast_func: fn value -> {:ok, "#{value} is so handsome"} end
]
})
end
@schema %{
user: [
type: %{
name: [type: :string, required: true],
email: [type: :string, length: [min: 5]],
age: [type: :integer]
}
]
}
test "cast embed type with valid value" do
data = %{
user: %{
name: "D",
email: "d@h.com",
age: 10
}
}
assert {:ok, ^data} = Tarams.cast(data, @schema)
end
test "cast with no value should default to nil and skip validation" do
data = %{
user: %{
name: "D",
age: 10
}
}
assert {:ok, %{user: %{email: nil}}} = Tarams.cast(data, @schema)
end
test "cast embed validation invalid should error" do
data = %{
user: %{
name: "D",
email: "h",
age: 10
}
}
assert {:error, %{user: %{email: ["length must be greater than or equal to 5"]}}} =
Tarams.cast(data, @schema)
end
test "cast missing required value should error" do
data = %{
user: %{
age: 10
}
}
assert {:error, %{user: %{name: ["is required"]}}} = Tarams.cast(data, @schema)
end
@array_schema %{
user: [
type:
{:array,
%{
name: [type: :string, required: true],
email: [type: :string],
age: [type: :integer]
}}
]
}
test "cast array embed schema with valid data" do
data = %{
"user" => [
%{
"name" => "D",
"email" => "d@h.com",
"age" => 10
}
]
}
assert {:ok, %{user: [%{age: 10, email: "d@h.com", name: "D"}]}} =
Tarams.cast(data, @array_schema)
end
test "cast empty array embed should ok" do
data = %{
"user" => []
}
assert {:ok, %{user: []}} = Tarams.cast(data, @array_schema)
end
test "cast nil array embed should ok" do
data = %{
"user" => nil
}
assert {:ok, %{user: nil}} = Tarams.cast(data, @array_schema)
end
test "cast array embed with invalid value should error" do
data = %{
"user" => [
%{
"email" => "d@h.com",
"age" => 10
},
%{
"name" => "HUH",
"email" => "om",
"age" => 10
}
]
}
assert {:error, %{user: %{name: ["is required"]}}} = Tarams.cast(data, @array_schema)
end
test "error with custom message" do
schema = %{
age: [type: :integer, number: [min: 10], message: "so khong hop le"]
}
assert {:error, %{age: ["so khong hop le"]}} = Tarams.cast(%{"age" => "abc"}, schema)
assert {:error, %{age: ["so khong hop le"]}} = Tarams.cast(%{"age" => "1"}, schema)
end
end
end
| 29.487805
| 98
| 0.481803
|
939704ae937bfa64ccf8bca925d3d3aaf6b2f566
| 582
|
exs
|
Elixir
|
examples/bulk.exs
|
DataKrewTech/tirexs
|
8238da373f4547d27eea57a10826114e947aa66b
|
[
"Apache-2.0"
] | 384
|
2015-03-09T05:03:42.000Z
|
2022-02-27T00:45:58.000Z
|
examples/bulk.exs
|
DataKrewTech/tirexs
|
8238da373f4547d27eea57a10826114e947aa66b
|
[
"Apache-2.0"
] | 144
|
2015-03-06T11:19:49.000Z
|
2021-06-11T11:26:39.000Z
|
examples/bulk.exs
|
DataKrewTech/tirexs
|
8238da373f4547d27eea57a10826114e947aa66b
|
[
"Apache-2.0"
] | 97
|
2015-03-21T13:58:38.000Z
|
2022-01-07T14:40:49.000Z
|
#
# Run this example from console manually:
#
# $ mix run -r examples/bulk.exs
# # => ?
#
# Run this example from Elixir environment (`iex -S mix`):
#
# iex> Path.expand("examples/bulk.exs") |> Tirexs.load_file
#
import Tirexs.Bulk
payload = bulk do
index [ index: "bear_test", type: "blog" ], [
[id: 1, title: "My second blog post"]
# ...
]
# update [ index: "bear_test", type: "blog"], [
# [
# doc: [id: 1, _retry_on_conflict: 3, title: "[updated] My first blog post"],
# fields: ["_source"],
# ]
# ]
end
Tirexs.bump!(payload)._bulk()
| 20.785714
| 83
| 0.580756
|
93970a6684480883a703fdeba4e0d0981eed12ca
| 2,133
|
ex
|
Elixir
|
clients/vision/lib/google_api/vision/v1/model/google_cloud_vision_v1p2beta1_bounding_poly.ex
|
pojiro/elixir-google-api
|
928496a017d3875a1929c6809d9221d79404b910
|
[
"Apache-2.0"
] | 1
|
2021-12-20T03:40:53.000Z
|
2021-12-20T03:40:53.000Z
|
clients/vision/lib/google_api/vision/v1/model/google_cloud_vision_v1p2beta1_bounding_poly.ex
|
pojiro/elixir-google-api
|
928496a017d3875a1929c6809d9221d79404b910
|
[
"Apache-2.0"
] | 1
|
2020-08-18T00:11:23.000Z
|
2020-08-18T00:44:16.000Z
|
clients/vision/lib/google_api/vision/v1/model/google_cloud_vision_v1p2beta1_bounding_poly.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.Vision.V1.Model.GoogleCloudVisionV1p2beta1BoundingPoly do
@moduledoc """
A bounding polygon for the detected image annotation.
## Attributes
* `normalizedVertices` (*type:* `list(GoogleApi.Vision.V1.Model.GoogleCloudVisionV1p2beta1NormalizedVertex.t)`, *default:* `nil`) - The bounding polygon normalized vertices.
* `vertices` (*type:* `list(GoogleApi.Vision.V1.Model.GoogleCloudVisionV1p2beta1Vertex.t)`, *default:* `nil`) - The bounding polygon vertices.
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:normalizedVertices =>
list(GoogleApi.Vision.V1.Model.GoogleCloudVisionV1p2beta1NormalizedVertex.t()) | nil,
:vertices => list(GoogleApi.Vision.V1.Model.GoogleCloudVisionV1p2beta1Vertex.t()) | nil
}
field(:normalizedVertices,
as: GoogleApi.Vision.V1.Model.GoogleCloudVisionV1p2beta1NormalizedVertex,
type: :list
)
field(:vertices, as: GoogleApi.Vision.V1.Model.GoogleCloudVisionV1p2beta1Vertex, type: :list)
end
defimpl Poison.Decoder, for: GoogleApi.Vision.V1.Model.GoogleCloudVisionV1p2beta1BoundingPoly do
def decode(value, options) do
GoogleApi.Vision.V1.Model.GoogleCloudVisionV1p2beta1BoundingPoly.decode(value, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.Vision.V1.Model.GoogleCloudVisionV1p2beta1BoundingPoly do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 38.781818
| 177
| 0.759962
|
93973461afdf4d558e721f0f6ecdb924d749d7a3
| 1,182
|
exs
|
Elixir
|
lib/elixir/test/elixir/application_test.exs
|
jbcrail/elixir
|
f30ef15d9d028a6d0f74d10c2bb320d5f8501bdb
|
[
"Apache-2.0"
] | 1
|
2015-02-23T00:01:48.000Z
|
2015-02-23T00:01:48.000Z
|
lib/elixir/test/elixir/application_test.exs
|
jbcrail/elixir
|
f30ef15d9d028a6d0f74d10c2bb320d5f8501bdb
|
[
"Apache-2.0"
] | null | null | null |
lib/elixir/test/elixir/application_test.exs
|
jbcrail/elixir
|
f30ef15d9d028a6d0f74d10c2bb320d5f8501bdb
|
[
"Apache-2.0"
] | null | null | null |
Code.require_file "test_helper.exs", __DIR__
defmodule ApplicationTest do
use ExUnit.Case, async: true
test "application environment" do
assert Application.get_env(:elixir, :unknown) == nil
assert Application.get_env(:elixir, :unknown, :default) == :default
assert Application.fetch_env(:elixir, :unknown) == :error
assert Application.put_env(:elixir, :unknown, :known) == :ok
assert Application.fetch_env(:elixir, :unknown) == {:ok, :known}
assert Application.get_env(:elixir, :unknown, :default) == :known
assert {:unknown, :known} in Application.get_all_env(:elixir)
assert Application.delete_env(:elixir, :unknown) == :ok
assert Application.get_env(:elixir, :unknown, :default) == :default
end
test "application directory" do
root = Path.expand("../../../..", __DIR__)
assert String.downcase(Application.app_dir(:elixir)) ==
String.downcase(Path.join(root, "bin/../lib/elixir"))
assert String.downcase(Application.app_dir(:elixir, "priv")) ==
String.downcase(Path.join(root, "bin/../lib/elixir/priv"))
assert_raise ArgumentError, fn ->
Application.app_dir(:unknown)
end
end
end
| 36.9375
| 71
| 0.686125
|
93973902a57c8c47b391a0da781ee9b13fb450b0
| 235
|
ex
|
Elixir
|
lib/plenario_web/views/field_api_view.ex
|
vforgione/plenario2
|
001526e5c60a1d32794a18f3fd65ead6cade1a29
|
[
"Apache-2.0"
] | 13
|
2017-12-11T13:59:42.000Z
|
2020-11-16T21:52:31.000Z
|
lib/plenario_web/views/field_api_view.ex
|
vforgione/plenario2
|
001526e5c60a1d32794a18f3fd65ead6cade1a29
|
[
"Apache-2.0"
] | 310
|
2017-11-13T22:52:26.000Z
|
2018-11-19T17:49:30.000Z
|
lib/plenario_web/views/field_api_view.ex
|
vforgione/plenario2
|
001526e5c60a1d32794a18f3fd65ead6cade1a29
|
[
"Apache-2.0"
] | 3
|
2017-12-05T00:36:12.000Z
|
2020-03-10T15:15:29.000Z
|
defmodule PlenarioWeb.FieldApiView do
use PlenarioWeb, :view
def render("field.json", %{field_api: f}) do
%{
name: f.name,
col_name: f.col_name,
type: f.type,
description: f.description
}
end
end
| 18.076923
| 46
| 0.621277
|
93974ca6d4ce81cfab77679bd2fdcf17afea929d
| 1,818
|
ex
|
Elixir
|
apps/definition_dictionary/lib/dictionary/type/list.ex
|
rucker/hindsight
|
876a5d344c5d8eebbea37684ee07e0a91e4430f0
|
[
"Apache-2.0"
] | null | null | null |
apps/definition_dictionary/lib/dictionary/type/list.ex
|
rucker/hindsight
|
876a5d344c5d8eebbea37684ee07e0a91e4430f0
|
[
"Apache-2.0"
] | null | null | null |
apps/definition_dictionary/lib/dictionary/type/list.ex
|
rucker/hindsight
|
876a5d344c5d8eebbea37684ee07e0a91e4430f0
|
[
"Apache-2.0"
] | null | null | null |
defmodule Dictionary.Type.List do
use Definition, schema: Dictionary.Type.List.V1
use Dictionary.JsonEncoder
@behaviour Access
@type t :: %__MODULE__{
version: integer,
name: String.t(),
description: String.t(),
item_type: module
}
defstruct version: 1,
name: nil,
description: "",
item_type: nil
@impl Definition
def on_new(%{item_type: %{"type" => type} = item_type} = data) do
with {:ok, module} <- Dictionary.Type.from_string(type),
{:ok, new_item_type} <- module.new(item_type) do
Map.put(data, :item_type, new_item_type)
|> Ok.ok()
end
end
def on_new(data) do
Ok.ok(data)
end
@impl Access
def fetch(%{item_type: %module{} = item_type}, key) do
module.fetch(item_type, key)
end
@impl Access
def get_and_update(%{item_type: %module{} = item_type} = list, key, function) do
{get, update} = module.get_and_update(item_type, key, function)
{get, %{list | item_type: update}}
end
@impl Access
def pop(%{item_type: %module{} = item_type} = list, key) do
{value, update} = module.pop(item_type, key)
{value, %{list | item_type: update}}
end
defimpl Dictionary.Type.Normalizer, for: __MODULE__ do
alias Dictionary.Type.Normalizer
def normalize(_, nil), do: Ok.ok(nil)
def normalize(%{item_type: item_type}, list) do
Ok.transform(list, &Normalizer.normalize(item_type, &1))
|> Ok.map_if_error(fn reason -> {:invalid_list, reason} end)
end
end
end
defmodule Dictionary.Type.List.V1 do
use Definition.Schema
@impl true
def s do
schema(%Dictionary.Type.List{
version: version(1),
name: lowercase_string(),
description: string(),
item_type: spec(is_map())
})
end
end
| 24.90411
| 82
| 0.630363
|
93977e1b61168afb6e662a555fbc56391ba4dc97
| 378
|
exs
|
Elixir
|
daniel/pragstudio/servy/rna.exs
|
jdashton/glowing-succotash
|
44580c2d4cb300e33156d42e358e8a055948a079
|
[
"MIT"
] | null | null | null |
daniel/pragstudio/servy/rna.exs
|
jdashton/glowing-succotash
|
44580c2d4cb300e33156d42e358e8a055948a079
|
[
"MIT"
] | 1
|
2020-02-26T14:55:23.000Z
|
2020-02-26T14:55:23.000Z
|
daniel/pragstudio/servy/rna.exs
|
jdashton/glowing-succotash
|
44580c2d4cb300e33156d42e358e8a055948a079
|
[
"MIT"
] | null | null | null |
defmodule RNA do
@char %{
?C => ?G,
?G => ?C,
?T => ?A,
?A => ?U,
}
def to_rna([]), do: []
def to_rna(dna) do
chars = %{
?C => ?G,
?G => ?C,
?T => ?A,
?A => ?U,
}
# [ @char[head] | to_rna(tail) ]
Enum.map(dna, &chars[&1])
end
def tr(dna_letter) do
@char[dna_letter]
end
end
IO.inspect(RNA.to_rna('CATG'))
| 13.5
| 36
| 0.42328
|
9397821102ce16e2c70fb5c958004c41cb5d6600
| 4,425
|
ex
|
Elixir
|
lib/captain_hook/webhook_endpoints/secrets.ex
|
annatel/captain_hook
|
e16a01107d11756d37d96d1e9092c17d9aa9260b
|
[
"MIT"
] | 4
|
2020-11-13T11:27:24.000Z
|
2021-08-19T17:28:53.000Z
|
lib/captain_hook/webhook_endpoints/secrets.ex
|
annatel/captain_hook
|
e16a01107d11756d37d96d1e9092c17d9aa9260b
|
[
"MIT"
] | null | null | null |
lib/captain_hook/webhook_endpoints/secrets.ex
|
annatel/captain_hook
|
e16a01107d11756d37d96d1e9092c17d9aa9260b
|
[
"MIT"
] | null | null | null |
defmodule CaptainHook.WebhookEndpoints.Secrets do
@moduledoc false
import Ecto.Changeset, only: [add_error: 3, fetch_field!: 2, prepare_changes: 2]
alias Ecto.Multi
alias CaptainHook.WebhookEndpoints.WebhookEndpoint
alias CaptainHook.WebhookEndpoints.Secrets.WebhookEndpointSecret
@secret_length 32
@secret_prefix "whsec"
@spec list_webhook_endpoint_secrets(WebhookEndpoint.t()) :: [WebhookEndpointSecret.t()]
def list_webhook_endpoint_secrets(%WebhookEndpoint{} = webhook_endpoint) do
WebhookEndpointSecret
|> AntlUtilsEcto.Query.where(:webhook_endpoint_id, webhook_endpoint.id)
|> AntlUtilsEcto.Query.where_period_status(
:ongoing,
:started_at,
:ended_at,
DateTime.utc_now()
)
|> CaptainHook.repo().all()
end
@spec create_webhook_endpoint_secret(WebhookEndpoint.t(), DateTime.t()) ::
{:ok, WebhookEndpointSecret.t()} | {:error, Ecto.Changeset.t()}
def create_webhook_endpoint_secret(
%WebhookEndpoint{} = webhook_endpoint,
%DateTime{} = started_at
) do
attrs = %{webhook_endpoint_id: webhook_endpoint.id, started_at: started_at, is_main: true}
%WebhookEndpointSecret{}
|> WebhookEndpointSecret.create_changeset(attrs)
|> validate_create_changes()
|> CaptainHook.repo().insert()
end
@spec remove_webhook_endpoint_secret(WebhookEndpointSecret.t(), DateTime.t()) ::
{:ok, WebhookEndpointSecret.t()} | {:error, Ecto.Changeset.t()}
def remove_webhook_endpoint_secret(
%WebhookEndpointSecret{} = webhook_secret,
%DateTime{} = ended_at
) do
webhook_secret
|> WebhookEndpointSecret.remove_changeset(%{is_main: false, ended_at: ended_at})
|> CaptainHook.repo().update()
end
@spec roll_webhook_endpoint_secret(WebhookEndpoint.t(), DateTime.t()) ::
{:ok, WebhookEndpointSecret.t()} | {:error, Ecto.Changeset.t()}
def roll_webhook_endpoint_secret(
%WebhookEndpoint{} = webhook_endpoint,
%DateTime{} = expires_at \\ DateTime.utc_now()
) do
[main_webhook_secret] =
webhook_endpoint
|> list_webhook_endpoint_secrets()
|> Enum.filter(& &1.is_main)
Multi.new()
|> Multi.run(:remove_current_main_webhook_endpoint_secret, fn _, %{} ->
remove_webhook_endpoint_secret(main_webhook_secret, expires_at)
end)
|> Multi.run(:create_webhook_endpoint_secret, fn _, %{} ->
create_webhook_endpoint_secret(webhook_endpoint, DateTime.utc_now())
end)
|> CaptainHook.repo().transaction()
|> case do
{:ok, %{create_webhook_endpoint_secret: %WebhookEndpointSecret{} = webhook_secret}} ->
{:ok, webhook_secret}
{:error, _, changeset, _} ->
{:error, changeset}
end
end
@spec generate_secret() :: binary
def generate_secret() do
prefix_separator = "_"
unfriendly_chars_to_copy_past = [prefix_separator, "-"]
replacement =
[?0..?9, ?a..?z, ?A..?Z]
|> Enum.flat_map(&Enum.to_list/1)
|> Enum.random()
|> List.wrap()
|> to_string()
secret =
:crypto.strong_rand_bytes(@secret_length)
|> Base.url_encode64(padding: false)
|> String.replace(unfriendly_chars_to_copy_past, replacement)
|> binary_part(0, @secret_length)
"#{@secret_prefix}#{prefix_separator}#{secret}"
end
defp has_main_webhook_endpoint_secret_ongoing?(webhook_endpoint_id, %DateTime{} = datetime)
when is_binary(webhook_endpoint_id) do
WebhookEndpointSecret
|> AntlUtilsEcto.Query.where(:webhook_endpoint_id, webhook_endpoint_id)
|> AntlUtilsEcto.Query.where(:is_main, true)
|> AntlUtilsEcto.Query.where_period_status(:ongoing, :started_at, :ended_at, datetime)
|> CaptainHook.repo().exists?()
end
defp validate_create_changes(%Ecto.Changeset{valid?: false} = changeset), do: changeset
defp validate_create_changes(%Ecto.Changeset{} = changeset) do
changeset
|> prepare_changes(fn changeset ->
changeset
|> validate_uniq_main_webhook_secret()
end)
end
defp validate_uniq_main_webhook_secret(%Ecto.Changeset{} = changeset) do
webhook_endpoint_id = fetch_field!(changeset, :webhook_endpoint_id)
started_at = fetch_field!(changeset, :started_at)
if has_main_webhook_endpoint_secret_ongoing?(webhook_endpoint_id, started_at) do
changeset |> add_error(:is_main, "already exists")
else
changeset
end
end
end
| 33.778626
| 94
| 0.699209
|
939798f22898e5a0e9add48229bfc144703d77c4
| 267
|
ex
|
Elixir
|
demo/lib/demo/supervisor.ex
|
PJUllrich/event-sourcing-with-elixir
|
7f70e6bc49d9d93f1d86513a1f358e41e07b8304
|
[
"MIT"
] | 19
|
2020-10-08T14:05:30.000Z
|
2022-03-18T08:43:11.000Z
|
demo/lib/demo/supervisor.ex
|
PJUllrich/event-sourcing-with-elixir
|
7f70e6bc49d9d93f1d86513a1f358e41e07b8304
|
[
"MIT"
] | null | null | null |
demo/lib/demo/supervisor.ex
|
PJUllrich/event-sourcing-with-elixir
|
7f70e6bc49d9d93f1d86513a1f358e41e07b8304
|
[
"MIT"
] | 3
|
2021-02-19T08:31:58.000Z
|
2021-12-09T05:28:55.000Z
|
defmodule Demo.Supervisor do
use Supervisor
def start_link(args) do
Supervisor.start_link(__MODULE__, [args], name: __MODULE__)
end
def init([args]) do
children = [Demo.EventConsumer]
Supervisor.init(children, strategy: :one_for_one)
end
end
| 19.071429
| 63
| 0.722846
|
9397a36760391fe6e014608277eaf35c21f09569
| 2,761
|
exs
|
Elixir
|
apps/re/test/units/units_test.exs
|
caspg/backend
|
34df9dc14ab8ed75de4578fefa2e087580c7e867
|
[
"MIT"
] | 1
|
2021-01-19T05:01:15.000Z
|
2021-01-19T05:01:15.000Z
|
apps/re/test/units/units_test.exs
|
caspg/backend
|
34df9dc14ab8ed75de4578fefa2e087580c7e867
|
[
"MIT"
] | null | null | null |
apps/re/test/units/units_test.exs
|
caspg/backend
|
34df9dc14ab8ed75de4578fefa2e087580c7e867
|
[
"MIT"
] | null | null | null |
defmodule Re.UnitsTest do
use Re.ModelCase
alias Re.{
Listing,
Listings.Units.Server,
Unit,
Units
}
import Re.Factory
@unit_attrs %{
complement: "201",
price: 500_000,
property_tax: 5_000.0,
maintenance_fee: 500.0,
floor: "2",
rooms: 3,
bathrooms: 1,
restrooms: 1,
area: 100,
garage_spots: 1,
garage_type: "contract",
suites: 1,
dependencies: 1,
balconies: 1,
status: "active"
}
describe "insert/2" do
test "insert new unit" do
development = insert(:development)
listing = insert(:listing, development_uuid: development.uuid)
assert {:ok, inserted_unit} = Units.insert(@unit_attrs, development, listing)
retrieved_unit = Repo.get(Unit, inserted_unit.uuid)
assert retrieved_unit == inserted_unit
assert retrieved_unit.development_uuid == development.uuid
assert retrieved_unit.listing_id == listing.id
end
test "update listing with unit attributes when unit is inserted" do
Server.start_link()
development = insert(:development)
{:ok, listing} = Re.Repo.insert(%Re.Listing{}, development_uuid: development.uuid, price: 1_000_000)
assert {:ok, inserted_unit} = Units.insert(@unit_attrs, development, listing)
GenServer.call(Server, :inspect)
listing = Repo.get(Listing, listing.id)
assert listing.complement
assert listing.price
assert listing.property_tax
assert listing.maintenance_fee
assert listing.floor
assert listing.rooms
assert listing.bathrooms
assert listing.restrooms
assert listing.area
assert listing.garage_spots
assert listing.garage_type
assert listing.suites
assert listing.dependencies
assert listing.balconies
end
end
describe "update/2" do
test "update listing with unit attributes when unit is updated" do
Server.start_link()
development = insert(:development)
{:ok, listing} = Re.Repo.insert(%Re.Listing{}, development_uuid: development.uuid)
unit = insert(:unit, development_uuid: development.uuid)
assert {:ok, _updated_unit} = Units.update(unit, @unit_attrs, development, listing)
GenServer.call(Server, :inspect)
listing = Repo.get(Listing, listing.id)
assert listing.complement
assert listing.price
assert listing.property_tax
assert listing.maintenance_fee
assert listing.floor
assert listing.rooms
assert listing.bathrooms
assert listing.restrooms
assert listing.area
assert listing.garage_spots
assert listing.garage_type
assert listing.suites
assert listing.dependencies
assert listing.balconies
end
end
end
| 27.336634
| 106
| 0.680551
|
9397ffe27de99bf20275400b23cf405cca83cb31
| 881
|
ex
|
Elixir
|
lib/paytm/api/wallet/balance.ex
|
wundercar/paytm
|
378ce47ae68588b80a60098f84ea50eb380cf7de
|
[
"MIT"
] | 2
|
2017-11-10T14:57:02.000Z
|
2018-01-30T04:53:11.000Z
|
lib/paytm/api/wallet/balance.ex
|
wundercar/paytm
|
378ce47ae68588b80a60098f84ea50eb380cf7de
|
[
"MIT"
] | 2
|
2019-04-16T12:55:01.000Z
|
2020-08-25T15:17:52.000Z
|
lib/paytm/api/wallet/balance.ex
|
wundercar/paytm
|
378ce47ae68588b80a60098f84ea50eb380cf7de
|
[
"MIT"
] | null | null | null |
defmodule Paytm.API.Wallet.Balance do
@type t :: %__MODULE__{
total_balance: Money.t(),
paytm_wallet_balance: Money.t(),
sub_wallet_balance: Money.t()
}
@enforce_keys [:total_balance, :paytm_wallet_balance, :sub_wallet_balance]
defstruct [:total_balance, :paytm_wallet_balance, :sub_wallet_balance]
@spec new(
full_units_or_cents :: atom,
total_balance :: integer,
paytm_wallet_balance :: integer,
sub_wallet_balance :: integer
) :: __MODULE__.t()
def new(:full_units, total_balance, paytm_wallet_balance, sub_wallet_balance) do
%__MODULE__{
total_balance: Money.new(trunc(total_balance * 100), :INR),
paytm_wallet_balance: Money.new(trunc(paytm_wallet_balance * 100), :INR),
sub_wallet_balance: Money.new(trunc(sub_wallet_balance * 100), :INR)
}
end
end
| 35.24
| 82
| 0.676504
|
939833c1384dba6cdaef95502ebfeffe6136abb0
| 893
|
ex
|
Elixir
|
lib/glue_web/views/guest_book_comment_view.ex
|
seanbreckenridge/glue
|
60cbe6478be27572de6c6d5276a806b5940ffcbc
|
[
"Apache-2.0"
] | 5
|
2020-07-04T12:18:58.000Z
|
2022-01-13T22:35:40.000Z
|
lib/glue_web/views/guest_book_comment_view.ex
|
seanbreckenridge/glue
|
60cbe6478be27572de6c6d5276a806b5940ffcbc
|
[
"Apache-2.0"
] | 37
|
2020-07-20T23:35:56.000Z
|
2022-03-19T02:13:16.000Z
|
lib/glue_web/views/guest_book_comment_view.ex
|
seanbreckenridge/glue
|
60cbe6478be27572de6c6d5276a806b5940ffcbc
|
[
"Apache-2.0"
] | null | null | null |
defmodule GlueWeb.GuestBookCommentView do
use GlueWeb, :view
alias GlueWeb.GuestBookCommentView
alias Glue.DateUtils
def render("index.json", %{gb_comment: gb_comment}) do
render_many(gb_comment, GuestBookCommentView, "guest_book_comment.json")
end
def render("show.json", %{guest_book_comment: guest_book_comment}) do
render_one(guest_book_comment, GuestBookCommentView, "guest_book_comment.json")
end
def render("error.json", %{message: err_msg}) do
Jason.encode!(%{error: err_msg})
end
def render("guest_book_comment.json", %{guest_book_comment: guest_book_comment}) do
%{
id: guest_book_comment.id,
name: guest_book_comment.name,
comment: guest_book_comment.comment,
# TODO: optimize: use date once?
at:
DateUtils.descrive_naive_datetime(guest_book_comment.inserted_at, NaiveDateTime.utc_now())
}
end
end
| 30.793103
| 98
| 0.735722
|
93984dbeb3b7df037d7eac9a54250cabaca6e2f0
| 1,809
|
exs
|
Elixir
|
test/changelog/schema/post/post_test.exs
|
PsOverflow/changelog.com
|
53f4ecfc39b021c6b8cfcc0fa11f29aff8038a7f
|
[
"MIT"
] | null | null | null |
test/changelog/schema/post/post_test.exs
|
PsOverflow/changelog.com
|
53f4ecfc39b021c6b8cfcc0fa11f29aff8038a7f
|
[
"MIT"
] | null | null | null |
test/changelog/schema/post/post_test.exs
|
PsOverflow/changelog.com
|
53f4ecfc39b021c6b8cfcc0fa11f29aff8038a7f
|
[
"MIT"
] | null | null | null |
defmodule Changelog.PostTest do
use Changelog.SchemaCase
alias Changelog.Post
describe "admin_changeset" do
test "with valid attributes" do
changeset = Post.admin_changeset(%Post{}, %{slug: "what-a-post", title: "What a Post", author_id: 42})
assert changeset.valid?
end
test "with invalid attributes" do
changeset = Post.admin_changeset(%Post{}, %{title: "What a Post"})
refute changeset.valid?
end
end
describe "is_publishable" do
test "is false when post is missing required fields" do
refute Post.is_publishable(build(:post))
end
test "is false when post is published" do
refute Post.is_publishable(build(:published_post))
end
test "is true when post has all fields and isn't published" do
assert Post.is_publishable(insert(:publishable_post))
end
end
describe "search" do
setup do
{:ok, phoenix: insert(:published_post, slug: "phoenix-post", title: "Phoenix", tldr: "A web framework for Elixir", body: "Chris McCord"),
rails: insert(:published_post, slug: "rails-post", title: "Rails", tldr: "A web framework for Ruby", body: "DHH") }
end
test "finds post by matching title" do
post_titles =
Post
|> Post.search("Phoenix")
|> Repo.all
|> Enum.map(&(&1.title))
assert post_titles == ["Phoenix"]
end
test "finds post by matching tldr" do
post_titles =
Post
|> Post.search("Ruby")
|> Repo.all
|> Enum.map(&(&1.title))
assert post_titles == ["Rails"]
end
test "finds post by matching body" do
post_titles =
Post
|> Post.search("DHH")
|> Repo.all
|> Enum.map(&(&1.title))
assert post_titles == ["Rails"]
end
end
end
| 26.217391
| 143
| 0.61581
|
9398508e66dc4ed6c540498ee5cf6d7e5c789e5e
| 69
|
ex
|
Elixir
|
lib/poe_api.ex
|
simplecastapps/poe-api
|
56e9b6ebfcd931c4023e555534a753f5ad32cf9c
|
[
"MIT"
] | 4
|
2016-01-14T05:33:21.000Z
|
2017-02-01T14:10:57.000Z
|
lib/poe_api.ex
|
poegroup/poe-api
|
d056412c336e30747f811fb5124e14ecb1b43b98
|
[
"MIT"
] | null | null | null |
lib/poe_api.ex
|
poegroup/poe-api
|
d056412c336e30747f811fb5124e14ecb1b43b98
|
[
"MIT"
] | 3
|
2017-01-09T14:34:54.000Z
|
2020-12-17T07:14:33.000Z
|
defmodule PoeApi do
defmacro __using__(_opts) do
nil
end
end
| 11.5
| 30
| 0.724638
|
939896fd0373db0737e6fa54f35cd841fd91c365
| 961
|
exs
|
Elixir
|
todo/config/test.exs
|
mpeseke/literate-waffle
|
1b8da264d841d9f1d076729936b060c79f93e1aa
|
[
"Apache-2.0"
] | null | null | null |
todo/config/test.exs
|
mpeseke/literate-waffle
|
1b8da264d841d9f1d076729936b060c79f93e1aa
|
[
"Apache-2.0"
] | null | null | null |
todo/config/test.exs
|
mpeseke/literate-waffle
|
1b8da264d841d9f1d076729936b060c79f93e1aa
|
[
"Apache-2.0"
] | null | null | null |
import Config
# Configure your database
#
# The MIX_TEST_PARTITION environment variable can be used
# to provide built-in test partitioning in CI environment.
# Run `mix help test` for more information.
config :todo, Todo.Repo,
username: "postgres",
password: "postgres",
hostname: "localhost",
database: "todo_test#{System.get_env("MIX_TEST_PARTITION")}",
pool: Ecto.Adapters.SQL.Sandbox,
pool_size: 10
# We don't run a server during test. If one is required,
# you can enable the server option below.
config :todo, TodoWeb.Endpoint,
http: [ip: {127, 0, 0, 1}, port: 4002],
secret_key_base: "S4IDO68V/4yDH08Shxk7n70QJtFFn6+NBJQ1yVOSWyvtYyMbnuzCnIottNXoEqJX",
server: false
# In test we don't send emails.
config :todo, Todo.Mailer, adapter: Swoosh.Adapters.Test
# Print only warnings and errors during test
config :logger, level: :warn
# Initialize plugs at runtime for faster test compilation
config :phoenix, :plug_init_mode, :runtime
| 31
| 86
| 0.754422
|
9398bfa8ad7378bbb4148f17cf1d8577d829e421
| 1,922
|
exs
|
Elixir
|
apps/tag_editor/config/dev.exs
|
gregredhead/belethor
|
255925396b18ba4a6950f386abf8a9e17a7e5e7c
|
[
"Apache-2.0"
] | 3
|
2018-07-20T22:14:36.000Z
|
2018-12-21T19:54:48.000Z
|
apps/tag_editor/config/dev.exs
|
gregredhead/belethor
|
255925396b18ba4a6950f386abf8a9e17a7e5e7c
|
[
"Apache-2.0"
] | 36
|
2018-09-15T21:46:54.000Z
|
2020-03-28T16:10:18.000Z
|
apps/tag_editor/config/dev.exs
|
gregredhead/belethor
|
255925396b18ba4a6950f386abf8a9e17a7e5e7c
|
[
"Apache-2.0"
] | 2
|
2018-07-22T08:47:07.000Z
|
2021-12-11T01:39:19.000Z
|
use Mix.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 :tag_editor, TagEditorWeb.Endpoint,
http: [port: 4000],
debug_errors: true,
code_reloader: true,
check_origin: false,
watchers: [
node: [
"node_modules/webpack/bin/webpack.js",
"--mode",
"development",
"--watch-stdin",
cd: Path.expand("../assets", __DIR__)
]
]
# ## 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.
# Watch static and templates for browser reloading.
config :tag_editor, TagEditorWeb.Endpoint,
live_reload: [
patterns: [
~r{priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$},
~r{priv/gettext/.*(po)$},
~r{lib/tag_editor_web/views/.*(ex)$},
~r{lib/tag_editor_web/templates/.*(eex)$}
]
]
# 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
| 28.264706
| 68
| 0.686785
|
9398d90ab699326ebc0d54b10f9016f6d953863b
| 711
|
ex
|
Elixir
|
lib/coophub_web/gettext.ex
|
peth-yursick/coophub
|
27ef7ffcdace4eb377535f8f1caa47490b45ef22
|
[
"MIT"
] | 49
|
2019-12-11T16:40:52.000Z
|
2022-01-14T12:44:14.000Z
|
lib/coophub_web/gettext.ex
|
peth-yursick/coophub
|
27ef7ffcdace4eb377535f8f1caa47490b45ef22
|
[
"MIT"
] | 47
|
2019-12-12T20:03:10.000Z
|
2021-10-14T14:25:00.000Z
|
lib/coophub_web/gettext.ex
|
peth-yursick/coophub
|
27ef7ffcdace4eb377535f8f1caa47490b45ef22
|
[
"MIT"
] | 28
|
2019-12-11T17:15:03.000Z
|
2021-09-17T09:19:44.000Z
|
defmodule CoophubWeb.Gettext do
@moduledoc """
A module providing Internationalization with a gettext-based API.
By using [Gettext](https://hexdocs.pm/gettext),
your module gains a set of macros for translations, for example:
import CoophubWeb.Gettext
# Simple translation
gettext("Here is the string to translate")
# Plural translation
ngettext("Here is the string to translate",
"Here are the strings to translate",
3)
# Domain-based translation
dgettext("errors", "Here is the error message to translate")
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
"""
use Gettext, otp_app: :coophub
end
| 28.44
| 72
| 0.677918
|
939927949c965bca256fd5d7b3378536b8577ed1
| 2,812
|
ex
|
Elixir
|
lib/clickhousex/query.ex
|
hissssst/clickhousex
|
76af47440408ca9280bcb7c07d0b33e249e1295d
|
[
"Apache-2.0"
] | null | null | null |
lib/clickhousex/query.ex
|
hissssst/clickhousex
|
76af47440408ca9280bcb7c07d0b33e249e1295d
|
[
"Apache-2.0"
] | null | null | null |
lib/clickhousex/query.ex
|
hissssst/clickhousex
|
76af47440408ca9280bcb7c07d0b33e249e1295d
|
[
"Apache-2.0"
] | null | null | null |
defmodule Clickhousex.Query do
@moduledoc """
Query struct returned from a successfully prepared query.
"""
@codec Application.get_env(:clickhousex, :codec, Clickhousex.Codec.JSON)
@type t :: %__MODULE__{
name: iodata,
type: :select | :insert | :alter | :create | :drop,
param_count: integer,
params: iodata | nil,
columns: [String.t()] | nil,
codec: Clickhousex.Codec.JSON | Clickhousex.Codec.RowBinary
}
defstruct [
name: nil,
statement: "",
type: :select,
params: [],
param_count: 0,
columns: [],
external_data: [],
codec: @codec
]
def new(statement) do
%__MODULE__{statement: statement}
|> DBConnection.Query.parse([])
end
end
defimpl DBConnection.Query, for: Clickhousex.Query do
alias Clickhousex.HTTPRequest
@values_regex ~r/VALUES/i
@select_query_regex ~r/\bSELECT\b/i
@insert_query_regex ~r/\bINSERT\b/i
@alter_query_regex ~r/\bALTER\b/i
def parse(%{statement: statement} = query, opts) do
param_count =
statement
|> String.codepoints()
|> Enum.count(fn s -> s == "?" end)
query = %{query | type: query_type(statement)}
%{query | param_count: param_count, external_data: opts[:external_data] || []}
end
def describe(query, _opts) do
query
end
def encode(%{type: :insert, codec: codec} = query, params, _opts) do
{query_part, post_body_part} = do_parse(query)
encoded_params = codec.encode(query, post_body_part, params)
%HTTPRequest{post_data: encoded_params, query_string_data: query_part}
end
def encode(%{codec: codec, statement: statement} = query, params, _opts) do
encoded_params = codec.encode(query, statement, params)
%HTTPRequest{post_data: encoded_params}
end
def decode(_query, result, _opts) do
result
end
defp do_parse(%{statement: statement, codec: codec}) do
with(
true <- Regex.match?(@values_regex, statement),
[fragment, substitutions] <- String.split(statement, @values_regex),
true <- String.contains?(substitutions, "?")
) do
{fragment <> " FORMAT #{codec.request_format()}", substitutions}
else
_ -> {statement, ""}
end
end
defp query_type(statement) do
with(
{:select, false} <- {:select, Regex.match?(@select_query_regex, statement)},
{:insert, false} <- {:insert, Regex.match?(@insert_query_regex, statement)},
{:alter, false} <- {:alter, Regex.match?(@alter_query_regex, statement)}
) do
:unknown
else
{statement_type, true} -> statement_type
end
end
end
defimpl String.Chars, for: Clickhousex.Query do
def to_string(%Clickhousex.Query{statement: statement}) do
IO.iodata_to_binary(statement)
end
end
| 27.038462
| 82
| 0.64367
|
939998229dffaf589b8b5910426ce6a3b99a0788
| 1,076
|
ex
|
Elixir
|
ex_chain/test/support/conn_case.ex
|
L-Serodio/sip-of-elixir
|
7c6cf0d9e00f95a51ffa98d5d16baaa6b3f131b2
|
[
"MIT"
] | null | null | null |
ex_chain/test/support/conn_case.ex
|
L-Serodio/sip-of-elixir
|
7c6cf0d9e00f95a51ffa98d5d16baaa6b3f131b2
|
[
"MIT"
] | null | null | null |
ex_chain/test/support/conn_case.ex
|
L-Serodio/sip-of-elixir
|
7c6cf0d9e00f95a51ffa98d5d16baaa6b3f131b2
|
[
"MIT"
] | null | null | null |
defmodule ExChainWeb.ConnCase do
@moduledoc """
This module defines the test case to be used by
tests that require setting up a connection.
Such tests rely on `Phoenix.ConnTest` and also
import other functionality to make it easier
to build common data structures and query the data layer.
Finally, if the test case interacts with the database,
we enable the SQL sandbox, so changes done to the database
are reverted at the end of every test. If you are using
PostgreSQL, you can even run database tests asynchronously
by setting `use ExChainWeb.ConnCase, async: true`, although
this option is not recommended for other databases.
"""
use ExUnit.CaseTemplate
using do
quote do
# Import conveniences for testing with connections
import Plug.Conn
import Phoenix.ConnTest
import ExChainWeb.ConnCase
alias ExChainWeb.Router.Helpers, as: Routes
# The default endpoint for testing
@endpoint ExChainWeb.Endpoint
end
end
setup _tags do
{:ok, conn: Phoenix.ConnTest.build_conn()}
end
end
| 28.315789
| 61
| 0.734201
|
93999f5f6badc31d870552ef976d21eafe3b4005
| 1,945
|
exs
|
Elixir
|
mix.exs
|
antondomratchev/bamboo
|
732a9b086b0e0cc6fc66ddbc6f1354f10a86662a
|
[
"MIT"
] | 1
|
2021-12-01T13:37:19.000Z
|
2021-12-01T13:37:19.000Z
|
mix.exs
|
sasa1977/bamboo
|
21371640ecda35307f265e84842a90dcb4c5557f
|
[
"MIT"
] | 1
|
2021-02-23T18:44:13.000Z
|
2021-02-23T18:44:13.000Z
|
mix.exs
|
sasa1977/bamboo
|
21371640ecda35307f265e84842a90dcb4c5557f
|
[
"MIT"
] | null | null | null |
defmodule Bamboo.Mixfile do
use Mix.Project
@project_url "https://github.com/thoughtbot/bamboo"
def project do
[
app: :bamboo,
version: "1.6.0",
elixir: "~> 1.6",
source_url: @project_url,
homepage_url: @project_url,
compilers: compilers(Mix.env()),
test_coverage: [tool: ExCoveralls],
preferred_cli_env: [coveralls: :test, "coveralls.circle": :test],
elixirc_paths: elixirc_paths(Mix.env()),
description:
"Straightforward, powerful, and adapter based Elixir email library." <>
" Works with Mandrill, Mailgun, SendGrid, SparkPost, Postmark, in-memory, and test.",
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
package: package(),
docs: [main: "readme", extras: ["README.md"]],
deps: deps(),
xref: [exclude: [IEx]]
]
end
defp compilers(:test), do: [:phoenix] ++ Mix.compilers()
defp compilers(_), do: Mix.compilers()
# Configuration for the OTP application
#
# Type "mix help compile.app" for more information
def application do
[
extra_applications: [:logger, :eex],
mod: {Bamboo, []}
]
end
defp package do
[
maintainers: ["German Velasco"],
licenses: ["MIT"],
links: %{"GitHub" => @project_url}
]
end
defp elixirc_paths(:test), do: elixirc_paths() ++ ["test/support"]
defp elixirc_paths(_), do: elixirc_paths()
defp elixirc_paths, do: ["lib"]
defp deps do
[
{:plug, "~> 1.0"},
{:mime, "~> 1.4"},
{:ex_machina, "~> 2.4", only: :test},
{:cowboy, "~> 1.0", only: [:test, :dev]},
{:phoenix, "~> 1.1", optional: true},
{:phoenix_html, "~> 2.2", only: :test},
{:excoveralls, "~> 0.13", only: :test},
{:floki, "~> 0.29", only: :test},
{:ex_doc, "~> 0.23", only: :dev},
{:hackney, ">= 1.13.0"},
{:jason, "~> 1.0", optional: true}
]
end
end
| 27.785714
| 95
| 0.567095
|
9399ce51d32d75909ad41ae064dd65cf3a0cb03a
| 383
|
exs
|
Elixir
|
programming_elixir_1.3_snippets/spawn/monitor1.exs
|
benjohns1/elixer-app
|
6e866ec084c5e75442c0b70f66e35f61b5b74d34
|
[
"MIT"
] | null | null | null |
programming_elixir_1.3_snippets/spawn/monitor1.exs
|
benjohns1/elixer-app
|
6e866ec084c5e75442c0b70f66e35f61b5b74d34
|
[
"MIT"
] | null | null | null |
programming_elixir_1.3_snippets/spawn/monitor1.exs
|
benjohns1/elixer-app
|
6e866ec084c5e75442c0b70f66e35f61b5b74d34
|
[
"MIT"
] | null | null | null |
defmodule Monitor1 do
import :timer, only: [sleep: 1]
def sad_function do
sleep 500
exit(:boom)
end
def run do
res = spawn_monitor(__MODULE__, :sad_function, [])
IO.puts inspect res
receive do
msg -> IO.puts "Message Received: #{inspect msg}"
after 1000 -> IO.puts "Nothing happened afaik"
end
end
end
Monitor1.run()
| 20.157895
| 56
| 0.616188
|
939a042cc3f72fea68c521a982e658a3e0e933dc
| 224
|
exs
|
Elixir
|
apps/neoscan/config/dev.exs
|
cc1776/neo-scan
|
49fc9256f5c7ed4e0a7cd43513b27ba5d9d4f287
|
[
"MIT"
] | 1
|
2021-02-23T02:55:26.000Z
|
2021-02-23T02:55:26.000Z
|
apps/neoscan/config/dev.exs
|
solohin/neo-scan
|
2aa6dfdb0346b108a20463efe1dcd8bbb00cbc0e
|
[
"MIT"
] | null | null | null |
apps/neoscan/config/dev.exs
|
solohin/neo-scan
|
2aa6dfdb0346b108a20463efe1dcd8bbb00cbc0e
|
[
"MIT"
] | 1
|
2019-10-16T21:37:31.000Z
|
2019-10-16T21:37:31.000Z
|
use Mix.Config
# Configure your database
config :neoscan, Neoscan.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: "postgres",
database: "neoscan_dev",
hostname: "localhost",
pool_size: 10
| 20.363636
| 34
| 0.727679
|
939a08f7a801a48a0b0537e9c24b6cc7ccf7e58a
| 1,522
|
ex
|
Elixir
|
lib/bolt/cogs/multiban.ex
|
CyberFlameGO/bolt
|
225e6276983bec646e7f13519df066e8e1e770ed
|
[
"ISC"
] | 31
|
2018-12-06T23:12:33.000Z
|
2022-03-29T18:34:25.000Z
|
lib/bolt/cogs/multiban.ex
|
CyberFlameGO/bolt
|
225e6276983bec646e7f13519df066e8e1e770ed
|
[
"ISC"
] | 18
|
2021-06-14T19:03:26.000Z
|
2022-03-15T17:46:22.000Z
|
lib/bolt/cogs/multiban.ex
|
CyberFlameGO/bolt
|
225e6276983bec646e7f13519df066e8e1e770ed
|
[
"ISC"
] | 4
|
2018-11-07T18:52:28.000Z
|
2022-03-16T00:14:38.000Z
|
defmodule Bolt.Cogs.MultiBan do
@moduledoc false
@behaviour Nosedrum.Command
alias Bolt.Cogs.Ban
alias Bolt.Helpers
alias Nosedrum.Predicates
alias Nostrum.Api
@impl true
def usage,
do: [
"multiban <user:snowflake|member...>",
"multiban <reason:str> <user:snowflake|member...>"
]
@impl true
def description,
do: """
Ban the given users with an optional reason.
Infractions are stored in the infraction database, and can be retrieved later.
Requires the `BAN_MEMBERS` permission.
**Examples**:
```rs
// Ban two bots
multiban @Dude#0001 @Meep#0142
// Same as above, but provide a reason
multiban "bot accounts" @Dude#0001 @Meep#0142
```
"""
@impl true
def predicates,
do: [&Predicates.guild_only/1, Predicates.has_permission(:ban_members)]
@impl true
def command(msg, [reason_or_target | targets] = args) when args != [] do
case Helpers.into_id(msg.guild_id, reason_or_target) do
{:ok, _snowflake, _user} ->
multiban(args, msg)
{:error, _reason} ->
# reason cannot be interpreted as a user,
# it's probably a reason instead
multiban(targets, msg, reason_or_target)
end
end
def command(msg, []) do
response = "ℹ️ usage: `multiban [reason:str] <user:snowflake|member...>`"
{:ok, _msg} = Api.create_message(msg.channel_id, response)
end
defp multiban(user_ids, msg, reason \\ "") do
Enum.map(user_ids, &Ban.command(msg, [&1, reason]))
end
end
| 25.366667
| 82
| 0.649803
|
939a36d80e22628a6532d88ff1f96bcd03b7d40e
| 1,267
|
exs
|
Elixir
|
channel-sender/large_bench/script.exs
|
santitigaga/async-dataflow
|
66132c7353ae0b3b9d5a3704699b5ba130b4da9d
|
[
"MIT"
] | 2
|
2022-01-11T21:03:44.000Z
|
2022-03-15T15:13:11.000Z
|
channel-sender/large_bench/script.exs
|
santitigaga/async-dataflow
|
66132c7353ae0b3b9d5a3704699b5ba130b4da9d
|
[
"MIT"
] | 3
|
2021-12-21T21:04:20.000Z
|
2022-03-15T16:16:45.000Z
|
channel-sender/large_bench/script.exs
|
santitigaga/async-dataflow
|
66132c7353ae0b3b9d5a3704699b5ba130b4da9d
|
[
"MIT"
] | 2
|
2022-02-08T22:33:36.000Z
|
2022-03-25T19:55:18.000Z
|
#Create Channel
body = Jason.encode!(%{application_ref: "some_application", user_ref: "user_ref_00117ALM"})
start_timing(:create_channel)
{200, _, {:json, json}} = post("/ext/channel/create", [{"content-type", "application/json"}], body)
stop_timing(:create_channel)
inc_counter(:create_channel)
#End Create Channel
#Upgrade connection and Authenticate
channel_ref = Map.get(json, "channel_ref")
channel_secret = Map.get(json, "channel_secret")
delay(400, 0.1)
start_timing(:auth_socket)
{:ok, _headers} = ws_upgrade("/ext/socket?channel=#{channel_ref}")
ws_send_text("Auth::#{channel_secret}")
{:ok, text} = ws_receive_text(25000)
[_, _, "AuthOk", _] = Jason.decode!(text)
stop_timing(:auth_socket)
inc_counter(:auth_socket)
#End Upgrade connection and Authenticate
Stream.repeatedly(fn ->
start_timing(:heartbeat)
ws_send_text("hb::1")
{:ok, text} = ws_receive_text(25000)
stop_timing(:heartbeat)
inc_counter(:heartbeat_count)
case Jason.decode!(text) do
[tkn_msg_id, "", ":n_token", _new_token] ->
inc_counter(:new_token_rec)
ws_send_text("Ack::" <> tkn_msg_id)
{:ok, text} = ws_receive_text(25000)
[_, "1", ":hb", _] = Jason.decode!(text)
[_, "1", ":hb", _] ->
:ok
end
delay(800, 0.1)
end) |> Stream.run()
| 31.675
| 99
| 0.694554
|
939a43eb07c8e6027611bf3148a54e2527802872
| 2,738
|
exs
|
Elixir
|
test/pummpcomm/crc/crc16_test.exs
|
infinity-aps/pummpcomm
|
7380585ecd110ab1c19d2aea3880e51e3f433050
|
[
"MIT"
] | 15
|
2017-08-31T00:58:47.000Z
|
2020-01-12T03:53:13.000Z
|
test/pummpcomm/crc/crc16_test.exs
|
vladhj38/pummpcomm
|
7380585ecd110ab1c19d2aea3880e51e3f433050
|
[
"MIT"
] | 1
|
2017-09-15T02:09:31.000Z
|
2017-09-15T02:09:31.000Z
|
test/pummpcomm/crc/crc16_test.exs
|
vladhj38/pummpcomm
|
7380585ecd110ab1c19d2aea3880e51e3f433050
|
[
"MIT"
] | 3
|
2017-09-10T17:24:59.000Z
|
2019-09-10T19:41:49.000Z
|
defmodule Pummpcomm.Crc.Crc16Test do
use ExUnit.Case
alias Pummpcomm.Crc.Crc16
doctest Crc16
setup do
{:ok, cgm_page} =
Base.decode16(
"201E1D1C1A1817161718191B1D1B1C1F212527282A2E3235383C3FCD9086850E0E0000011006850E1043484857EB181006940E0F595E00000110069F0E106670757374767A7D7F8181817D7813726D6663605E5B554F4C4E4F4B484946423E3B38353234332D2B2B2B2C2E302F2F312F2D2D2E2D2C2D2D2A2B292700000110069F1310242323272B2C3235383C00000110069514103E3E3F404141444A4945413E3D3D3A35302C2823201D1B1C1D1A1A1B1C1E2123272B2F3231323235383B3F43484949474542779007A0000E41423D6C171007AD000F3C3D3D3B3C3E3F41474F545A626A6E700000011007860210717271727476797A7A7B7C7D7C7B777472706E6D6C6B6A6763605C5A6064636160605F5D5C5C5B5956545250555A585656555554565654504D4C4A484E515455555452504F4D4D504E4D4E505050504F4E4D4C4C4F50510000011007980910539290079C090E54554BC4141007A8090F4A4A49494C4C4D50515253524F53524F4D4C7590078E0B0E7590878E0B0E4A4947433BD0121007A30B0F373333312F2B26242423252526292A2A2A0000011007810D102A2A2828282B3337383A3F44474746484B4F52504B4846434343413D393500000110079F0F10312F2D2B27211E1D3F90078E100E1C1A191214100798100F181817181F20242A2E33383E41464B4B4F56595E000001100788121065686667660000011007A3121066686B6D6F727375777774707273706C6764615F5A575553453D39322C251F1A1C191614171D2124282C2E31353A3F4144484A4B4C4D50555B000001100790171061656A6665656768C99007B9170E0000011007B917106869659413100889000F625F5D5D5F5D5A56524B4E4E4C4B4847494B494A4D5051514F4E4C4E4E4D4B4A494A4B4B4B4B47474D4E4E4E4E4E4C4B4A46434B4D4C4B49490000011008B804104B4B4B4D515456565655545455595A5800000110088F0610595A5A595A595755555858575655545453525152534E4A474445484B4E4F13505251135113515051525154AF9088A6090E0000011008A6091052505594141008B3090F55565B5A58534F4B49134037132F28132320131A13181514151615171919191A1A1B1A1B1C1D202325242221225890088B0D0E00000110088C0D1023252AEC151008990D0F2B2B2E31393F3A3C41484E555D00000110089F0E1063696E73767A7C7D7F7E7F8085878689E59008B50F0E0000011008B50F10878979CD13100885100F76737272706D0000011008A71010696461605D5A57555352520000011008A11110504C4947484743434278900893120E0000011008941210423F3A3837D6131008A9120F33322F2E2F31322F2C2C2B2828292A2827243A90088E140E211C19181809141008A4140F191A19191028B6140813131313133C95"
)
{:ok, cgm_page: cgm_page}
end
test "crc computation", %{cgm_page: cgm_page} do
<<page_data::size(8176), crc_data::size(16)>> = cgm_page
assert Crc16.crc_16(<<page_data::size(8176)>>) == crc_data
end
test "crc check", %{cgm_page: cgm_page} do
assert {:ok, _} = Crc16.check_crc_16(cgm_page)
end
test "bad checksum" do
assert {:fail, _} = Crc16.check_crc_16(<<1, 2, 3, 4, 5, 6, 7>>)
end
test "too short for crc" do
assert {:error, _} = Crc16.check_crc_16(<<1, 2>>)
end
end
| 85.5625
| 2,058
| 0.90431
|
939a5588d682cdfb8469595ada0d800eabb2265a
| 632
|
ex
|
Elixir
|
lib/openflow/actions/nx_clone.ex
|
shun159/tres
|
1e3e7f78ba1aa4f184d4be70300e5f4703d50a2f
|
[
"Beerware"
] | 5
|
2019-05-25T02:25:13.000Z
|
2020-10-06T17:00:03.000Z
|
lib/openflow/actions/nx_clone.ex
|
shun159/tres
|
1e3e7f78ba1aa4f184d4be70300e5f4703d50a2f
|
[
"Beerware"
] | 5
|
2018-03-29T14:42:10.000Z
|
2019-11-19T07:03:09.000Z
|
lib/openflow/actions/nx_clone.ex
|
shun159/tres
|
1e3e7f78ba1aa4f184d4be70300e5f4703d50a2f
|
[
"Beerware"
] | 1
|
2019-03-30T20:48:27.000Z
|
2019-03-30T20:48:27.000Z
|
defmodule Openflow.Action.NxClone do
defstruct(actions: [])
@experimenter 0x00002320
@nxast 42
alias __MODULE__
alias Openflow.Action.Experimenter
def new(actions \\ []) do
%NxClone{actions: actions}
end
def to_binary(%NxClone{actions: actions}) do
actions_bin = Openflow.Action.to_binary(actions)
Experimenter.pack_exp_header(
<<@experimenter::32, @nxast::16, 0::size(6)-unit(8), actions_bin::bytes>>
)
end
def read(<<@experimenter::32, @nxast::16, 0::size(6)-unit(8), actions_bin::bytes>>) do
actions = Openflow.Action.read(actions_bin)
%NxClone{actions: actions}
end
end
| 23.407407
| 88
| 0.689873
|
939a7b8576a88027c2d1ff8eb11a2944e980ebee
| 721
|
ex
|
Elixir
|
api/lib/skeleton_api_web/gettext.ex
|
psychowico/phoenix-vuejs-skeleton
|
6e8fa12bf1050bb08c5e312fd972db92a1e0b214
|
[
"MIT"
] | null | null | null |
api/lib/skeleton_api_web/gettext.ex
|
psychowico/phoenix-vuejs-skeleton
|
6e8fa12bf1050bb08c5e312fd972db92a1e0b214
|
[
"MIT"
] | null | null | null |
api/lib/skeleton_api_web/gettext.ex
|
psychowico/phoenix-vuejs-skeleton
|
6e8fa12bf1050bb08c5e312fd972db92a1e0b214
|
[
"MIT"
] | null | null | null |
defmodule SkeletonApiWeb.Gettext do
@moduledoc """
A module providing Internationalization with a gettext-based API.
By using [Gettext](https://hexdocs.pm/gettext),
your module gains a set of macros for translations, for example:
import SkeletonApiWeb.Gettext
# Simple translation
gettext "Here is the string to translate"
# Plural translation
ngettext "Here is the string to translate",
"Here are the strings to translate",
3
# Domain-based translation
dgettext "errors", "Here is the error message to translate"
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
"""
use Gettext, otp_app: :skeleton_api
end
| 28.84
| 72
| 0.686546
|
939a844bc47e33ea5e55e2613ddc532311c1a606
| 142
|
ex
|
Elixir
|
lib/techtree_web/controllers/page_controller.ex
|
kenkeiras/MonTree
|
7ec724634c123ee085921c4cac07800c9a15e4ec
|
[
"WTFPL"
] | 2
|
2018-10-26T06:06:42.000Z
|
2020-02-16T15:01:42.000Z
|
lib/techtree_web/controllers/page_controller.ex
|
kenkeiras/TechTree
|
26c8ca59855002a88bf15eb0b64a6c788f438ec8
|
[
"WTFPL"
] | 108
|
2018-10-25T10:30:33.000Z
|
2021-07-28T04:18:03.000Z
|
lib/techtree_web/controllers/page_controller.ex
|
kenkeiras/TechTree
|
26c8ca59855002a88bf15eb0b64a6c788f438ec8
|
[
"WTFPL"
] | null | null | null |
defmodule TechtreeWeb.PageController do
use TechtreeWeb, :controller
def index(conn, _params) do
render conn, "index.html"
end
end
| 17.75
| 39
| 0.746479
|
939ab84db4bd0c80e28c567a609d1a03c846c761
| 1,761
|
ex
|
Elixir
|
lib/absinthe/schema/notation/sdl.ex
|
hauptbenutzer/absinthe
|
f1d76e5c249ca337187971b0c96b1870f53716ed
|
[
"MIT"
] | null | null | null |
lib/absinthe/schema/notation/sdl.ex
|
hauptbenutzer/absinthe
|
f1d76e5c249ca337187971b0c96b1870f53716ed
|
[
"MIT"
] | null | null | null |
lib/absinthe/schema/notation/sdl.ex
|
hauptbenutzer/absinthe
|
f1d76e5c249ca337187971b0c96b1870f53716ed
|
[
"MIT"
] | null | null | null |
defmodule Absinthe.Schema.Notation.SDL do
@moduledoc false
@doc """
Parse definitions from SDL source
"""
@spec parse(sdl :: String.t(), Module.t(), map(), Keyword.t()) ::
{:ok, [Absinthe.Blueprint.Schema.type_t()]} | {:error, String.t()}
def parse(sdl, module, ref, opts) do
with {:ok, doc} <- Absinthe.Phase.Parse.run(sdl) do
definitions =
doc.input.definitions
|> Enum.map(&Absinthe.Blueprint.Draft.convert(&1, doc))
|> Enum.map(&put_ref(&1, ref, opts))
|> Enum.map(fn type -> %{type | module: module} end)
{:ok, definitions}
else
{:error, %Absinthe.Blueprint{execution: %{validation_errors: [_ | _] = errors}}} ->
error =
errors
|> Enum.map(&"#{&1.message} (#{inspect(&1.locations)})")
|> Enum.join("\n")
{:error, error}
other ->
other
end
end
defp put_ref(%{fields: fields} = node, ref, opts) do
%{node | fields: Enum.map(fields, &put_ref(&1, ref, opts))}
|> do_put_ref(ref, opts)
end
defp put_ref(%{arguments: args} = node, ref, opts) do
%{node | arguments: Enum.map(args, &put_ref(&1, ref, opts))}
|> do_put_ref(ref, opts)
end
defp put_ref(%{directives: dirs} = node, ref, opts) do
%{node | directives: Enum.map(dirs, &put_ref(&1, ref, opts))}
|> do_put_ref(ref, opts)
end
defp put_ref(node, ref, opts), do: do_put_ref(node, ref, opts)
defp do_put_ref(%{__reference__: nil} = node, ref, opts) do
ref =
case opts[:path] do
nil ->
ref
path ->
put_in(ref.location, %{file: path, line: node.source_location.line})
end
%{node | __reference__: ref}
end
defp do_put_ref(node, _ref, _opts), do: node
end
| 27.515625
| 89
| 0.576377
|
939ab8e447c2f93302b44e85eb3d3396f8932487
| 1,703
|
ex
|
Elixir
|
todo_interface/lib/todo_interface_web.ex
|
moritzploss/todoServer
|
404db774493b42bb328c552c8c428fa4be2b10d1
|
[
"MIT"
] | null | null | null |
todo_interface/lib/todo_interface_web.ex
|
moritzploss/todoServer
|
404db774493b42bb328c552c8c428fa4be2b10d1
|
[
"MIT"
] | null | null | null |
todo_interface/lib/todo_interface_web.ex
|
moritzploss/todoServer
|
404db774493b42bb328c552c8c428fa4be2b10d1
|
[
"MIT"
] | null | null | null |
defmodule TodoInterfaceWeb do
@moduledoc """
The entrypoint for defining your web interface, such
as controllers, views, channels and so on.
This can be used in your application as:
use TodoInterfaceWeb, :controller
use TodoInterfaceWeb, :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. Instead, define any helper function in modules
and import those modules here.
"""
def controller do
quote do
use Phoenix.Controller, namespace: TodoInterfaceWeb
import Plug.Conn
import TodoInterfaceWeb.Gettext
alias TodoInterfaceWeb.Router.Helpers, as: Routes
end
end
def view do
quote do
use Phoenix.View,
root: "lib/todo_interface_web/templates",
namespace: TodoInterfaceWeb
# Import convenience functions from controllers
import Phoenix.Controller, only: [get_flash: 1, get_flash: 2, view_module: 1]
# Use all HTML functionality (forms, tags, etc)
use Phoenix.HTML
import TodoInterfaceWeb.ErrorHelpers
import TodoInterfaceWeb.Gettext
alias TodoInterfaceWeb.Router.Helpers, as: Routes
end
end
def router do
quote do
use Phoenix.Router
import Plug.Conn
import Phoenix.Controller
end
end
def channel do
quote do
use Phoenix.Channel
import TodoInterfaceWeb.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
| 24.328571
| 83
| 0.70229
|
939abd7a63347ae15caec8f4de261b283f6c2360
| 2,118
|
ex
|
Elixir
|
clients/compute/lib/google_api/compute/v1/model/reservation_list_warning.ex
|
medikent/elixir-google-api
|
98a83d4f7bfaeac15b67b04548711bb7e49f9490
|
[
"Apache-2.0"
] | null | null | null |
clients/compute/lib/google_api/compute/v1/model/reservation_list_warning.ex
|
medikent/elixir-google-api
|
98a83d4f7bfaeac15b67b04548711bb7e49f9490
|
[
"Apache-2.0"
] | 1
|
2020-12-18T09:25:12.000Z
|
2020-12-18T09:25:12.000Z
|
clients/compute/lib/google_api/compute/v1/model/reservation_list_warning.ex
|
medikent/elixir-google-api
|
98a83d4f7bfaeac15b67b04548711bb7e49f9490
|
[
"Apache-2.0"
] | 1
|
2020-10-04T10:12:44.000Z
|
2020-10-04T10:12:44.000Z
|
# 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.Compute.V1.Model.ReservationListWarning do
@moduledoc """
[Output Only] Informational warning message.
## Attributes
* `code` (*type:* `String.t`, *default:* `nil`) - [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response.
* `data` (*type:* `list(GoogleApi.Compute.V1.Model.ReservationListWarningData.t)`, *default:* `nil`) - [Output Only] Metadata about this warning in key: value format. For example:
"data": [ { "key": "scope", "value": "zones/us-east1-d" }
* `message` (*type:* `String.t`, *default:* `nil`) - [Output Only] A human-readable description of the warning code.
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:code => String.t(),
:data => list(GoogleApi.Compute.V1.Model.ReservationListWarningData.t()),
:message => String.t()
}
field(:code)
field(:data, as: GoogleApi.Compute.V1.Model.ReservationListWarningData, type: :list)
field(:message)
end
defimpl Poison.Decoder, for: GoogleApi.Compute.V1.Model.ReservationListWarning do
def decode(value, options) do
GoogleApi.Compute.V1.Model.ReservationListWarning.decode(value, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.Compute.V1.Model.ReservationListWarning do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 39.222222
| 194
| 0.720963
|
939b2a90c6f311bd381331ab91810b87010dc76c
| 1,059
|
ex
|
Elixir
|
test/support/conn_case.ex
|
anndream/realworld-elixir-phoenix-v14
|
b8f8b3d37099f5efe47c92d8c33b16763526eb7a
|
[
"MIT"
] | null | null | null |
test/support/conn_case.ex
|
anndream/realworld-elixir-phoenix-v14
|
b8f8b3d37099f5efe47c92d8c33b16763526eb7a
|
[
"MIT"
] | null | null | null |
test/support/conn_case.ex
|
anndream/realworld-elixir-phoenix-v14
|
b8f8b3d37099f5efe47c92d8c33b16763526eb7a
|
[
"MIT"
] | null | null | null |
defmodule RealWorldWeb.ConnCase do
@moduledoc """
This module defines the test case to be used by
tests that require setting up a connection.
Such tests rely on `Phoenix.ConnTest` and also
import other functionality to make it easier
to build common datastructures and query the data layer.
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 connections
use Phoenix.ConnTest
alias RealWorldWeb.Router.Helpers, as: Routes
# The default endpoint for testing
@endpoint RealWorldWeb.Endpoint
end
end
setup tags do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(RealWorld.Repo)
unless tags[:async] do
Ecto.Adapters.SQL.Sandbox.mode(RealWorld.Repo, {:shared, self()})
end
{:ok, conn: Phoenix.ConnTest.build_conn()}
end
end
| 27.153846
| 71
| 0.721435
|
939b355bf6c71b1cbe03e59569c7958f3cde9d1f
| 332
|
ex
|
Elixir
|
2021-09-15-elixir-australia-prom-ex/prom_ex_demo/lib/prom_ex_demo/todos/todo.ex
|
rellen/talks
|
97e123e6cb331b78fa737c90cedc2974a35243e4
|
[
"CC-BY-4.0"
] | 1
|
2022-02-16T09:00:34.000Z
|
2022-02-16T09:00:34.000Z
|
2021-09-15-elixir-australia-prom-ex/prom_ex_demo/lib/prom_ex_demo/todos/todo.ex
|
rellen/talks
|
97e123e6cb331b78fa737c90cedc2974a35243e4
|
[
"CC-BY-4.0"
] | null | null | null |
2021-09-15-elixir-australia-prom-ex/prom_ex_demo/lib/prom_ex_demo/todos/todo.ex
|
rellen/talks
|
97e123e6cb331b78fa737c90cedc2974a35243e4
|
[
"CC-BY-4.0"
] | null | null | null |
defmodule PromExDemo.Todos.Todo do
use Ecto.Schema
import Ecto.Changeset
schema "todo" do
field :done, :boolean, default: false
field :title, :string
timestamps()
end
@doc false
def changeset(todo, attrs) do
todo
|> cast(attrs, [:title, :done])
|> validate_required([:title, :done])
end
end
| 17.473684
| 41
| 0.650602
|
939b3f02117d4eca8dee0bd065cbc90f6c13f652
| 668
|
ex
|
Elixir
|
testData/org/elixir_lang/parser_definition/matched_call_operation/matched_expression_parsing_test_case/DecimalFloat.ex
|
keyno63/intellij-elixir
|
4033e319992c53ddd42a683ee7123a97b5e34f02
|
[
"Apache-2.0"
] | 1,668
|
2015-01-03T05:54:27.000Z
|
2022-03-25T08:01:20.000Z
|
testData/org/elixir_lang/parser_definition/matched_call_operation/matched_expression_parsing_test_case/DecimalFloat.ex
|
keyno63/intellij-elixir
|
4033e319992c53ddd42a683ee7123a97b5e34f02
|
[
"Apache-2.0"
] | 2,018
|
2015-01-01T22:43:39.000Z
|
2022-03-31T20:13:08.000Z
|
testData/org/elixir_lang/parser_definition/matched_call_operation/matched_expression_parsing_test_case/DecimalFloat.ex
|
keyno63/intellij-elixir
|
4033e319992c53ddd42a683ee7123a97b5e34f02
|
[
"Apache-2.0"
] | 145
|
2015-01-15T11:37:16.000Z
|
2021-12-22T05:51:02.000Z
|
1.2e-3 &one
1.2e-3 one \\ default
1.2e-3 one when guard
1.2e-3 one :: type
1.2e-3 one | new
1.2e-3 one = two
1.2e-3 one or two
1.2e-3 one || two
1.2e-3 one and two
1.2e-3 one && two
1.2e-3 one != two
1.2e-3 one < two
1.2e-3 one |> two
1.2e-3 one + two
1.2e-3 one / two
1.2e-3 one * two
1.2e-3 one ^^^ two
1.2e-3 !one
1.2e-3 One.Two
1.2e-3 One.two
1.2e-3 @one
1.2e-3 one
1.2e-3 @1
1.2e-3 &1
1.2e-3 !1
1.2e-3 not 1
1.2e-3 ?1
1.2e-3 0b10
1.2e-3 1
1.2e-3 0xFF
1.2e-3 0o7
1.2e-3 []
1.2e-3 "StringLine"
1.2e-3 """
String
Heredoc
"""
1.2e-3 'CharListLine'
1.2e-3 '''
CharListLine
'''
1.2e-3 ~x{sigil}modifiers
1.2e-3 nil
1.2e-3 :atom
1.2e-3 One
| 14.521739
| 25
| 0.580838
|
939b42b40d20aecf8e83c6d012d509a8ad9bf8b0
| 301
|
ex
|
Elixir
|
lib/pugme/supervisor.ex
|
KevinGreene/Tinc
|
4101e4bd24ba81f84e51e9a85be3609515087e6e
|
[
"MIT"
] | null | null | null |
lib/pugme/supervisor.ex
|
KevinGreene/Tinc
|
4101e4bd24ba81f84e51e9a85be3609515087e6e
|
[
"MIT"
] | null | null | null |
lib/pugme/supervisor.ex
|
KevinGreene/Tinc
|
4101e4bd24ba81f84e51e9a85be3609515087e6e
|
[
"MIT"
] | null | null | null |
defmodule Pugme.Supervisor do
use Supervisor
def start_link do
Supervisor.start_link(__MODULE__, :ok)
end
@pugme_name Pugme.Slackbot
def init(:ok) do
children = [
worker(Pugme.Slackbot, [[name: @pugme_name]])
]
supervise(children, strategy: :one_for_one)
end
end
| 16.722222
| 51
| 0.684385
|
939b8f04d792118372fdad887564e6dad204c6b1
| 190
|
ex
|
Elixir
|
lib/witchcraft/foldable/map.ex
|
doma-engineering/witchcraft
|
c84fa6b2146e7de745105e21f672ed413df93ad3
|
[
"MIT"
] | 454
|
2019-06-05T22:56:45.000Z
|
2022-03-27T23:03:02.000Z
|
lib/witchcraft/foldable/map.ex
|
doma-engineering/witchcraft
|
c84fa6b2146e7de745105e21f672ed413df93ad3
|
[
"MIT"
] | 26
|
2019-07-08T09:29:08.000Z
|
2022-02-04T02:40:48.000Z
|
lib/witchcraft/foldable/map.ex
|
doma-engineering/witchcraft
|
c84fa6b2146e7de745105e21f672ed413df93ad3
|
[
"MIT"
] | 36
|
2019-06-25T17:45:27.000Z
|
2022-03-21T01:53:42.000Z
|
import TypeClass
definst Witchcraft.Foldable, for: Map do
def right_fold(map, seed, reducer) do
map
|> Map.values()
|> Witchcraft.Foldable.right_fold(seed, reducer)
end
end
| 19
| 52
| 0.705263
|
939bcda9056525ab90ed39a96c12e0cc58c45e63
| 253
|
ex
|
Elixir
|
debian/libjpeg-turbo.default.ex
|
mingw-deb/libjpeg-turbo
|
35ef423a54ff1cf3a2e722153791ca7386eeeb54
|
[
"Zlib"
] | null | null | null |
debian/libjpeg-turbo.default.ex
|
mingw-deb/libjpeg-turbo
|
35ef423a54ff1cf3a2e722153791ca7386eeeb54
|
[
"Zlib"
] | null | null | null |
debian/libjpeg-turbo.default.ex
|
mingw-deb/libjpeg-turbo
|
35ef423a54ff1cf3a2e722153791ca7386eeeb54
|
[
"Zlib"
] | null | null | null |
# Defaults for libjpeg-turbo initscript
# sourced by /etc/init.d/libjpeg-turbo
# installed at /etc/default/libjpeg-turbo by the maintainer scripts
#
# This is a POSIX shell fragment
#
# Additional options that are passed to the Daemon.
DAEMON_OPTS=""
| 23
| 67
| 0.766798
|
939c160b4f403db207757df8605d15fcbbd48b25
| 740
|
ex
|
Elixir
|
web/controllers/page_controller.ex
|
smpallen99/ucx_chat
|
0dd98d0eb5e0537521844520ea2ba63a08fd3f19
|
[
"MIT"
] | 60
|
2017-05-09T19:08:26.000Z
|
2021-01-20T11:09:42.000Z
|
web/controllers/page_controller.ex
|
smpallen99/ucx_chat
|
0dd98d0eb5e0537521844520ea2ba63a08fd3f19
|
[
"MIT"
] | 6
|
2017-05-10T15:43:16.000Z
|
2020-07-15T07:14:41.000Z
|
web/controllers/page_controller.ex
|
smpallen99/ucx_chat
|
0dd98d0eb5e0537521844520ea2ba63a08fd3f19
|
[
"MIT"
] | 10
|
2017-05-10T04:13:54.000Z
|
2020-12-28T10:30:27.000Z
|
defmodule UcxChat.PageController do
use UcxChat.Web, :controller
require Logger
alias Coherence.ControllerHelpers, as: Helpers
alias UcxChat.{Repo, User}
import Ecto.Query
def index(conn, _params) do
user = Coherence.current_user(conn)
|> Repo.preload([:user])
channel = UcxChat.Channel |> Ecto.Query.first |> Repo.one
Logger.info "user: #{inspect user}"
render conn, "index.html", user: user, channel: channel
end
def switch_user(conn, %{"user" => username}) do
Logger.warn "conn: #{inspect conn}"
new_user =
User
|> where([u], u.username == ^username)
|> Repo.one!
conn
|> Helpers.logout_user()
|> Helpers.login_user(new_user)
|> redirect(to: "/")
end
end
| 26.428571
| 61
| 0.65
|
939c44fc28f5b013e856aadaaabbf4f8552fdec4
| 98
|
ex
|
Elixir
|
exercises/ex5/elevator/lib/OrderHandler.ex
|
Sandbergo/distributed-elevator-controller
|
5b82858110b8e47e445e26aefd1d55a2dced9957
|
[
"MIT"
] | null | null | null |
exercises/ex5/elevator/lib/OrderHandler.ex
|
Sandbergo/distributed-elevator-controller
|
5b82858110b8e47e445e26aefd1d55a2dced9957
|
[
"MIT"
] | null | null | null |
exercises/ex5/elevator/lib/OrderHandler.ex
|
Sandbergo/distributed-elevator-controller
|
5b82858110b8e47e445e26aefd1d55a2dced9957
|
[
"MIT"
] | 1
|
2019-03-13T11:46:35.000Z
|
2019-03-13T11:46:35.000Z
|
defmodule OrderHandler do
@moduledoc """
OrderHandler module yayeet
"""
end
| 12.25
| 30
| 0.602041
|
939c73afda7807ae7797615f659acc4889fdd8fd
| 405
|
exs
|
Elixir
|
priv/repo/migrations/20200310074406_create_gameplays.exs
|
LKlemens/platform
|
837d70503c71e603c2830df9b6c1f8e77cdfe620
|
[
"MIT"
] | 1
|
2020-02-20T21:57:02.000Z
|
2020-02-20T21:57:02.000Z
|
priv/repo/migrations/20200310074406_create_gameplays.exs
|
LKlemens/platform
|
837d70503c71e603c2830df9b6c1f8e77cdfe620
|
[
"MIT"
] | 1
|
2020-03-23T19:22:48.000Z
|
2020-03-23T19:22:48.000Z
|
priv/repo/migrations/20200310074406_create_gameplays.exs
|
LKlemens/platform
|
837d70503c71e603c2830df9b6c1f8e77cdfe620
|
[
"MIT"
] | null | null | null |
defmodule Platform.Repo.Migrations.CreateGameplays do
use Ecto.Migration
def change do
create table(:gameplays) do
add :player_score, :integer
add :game_id, references(:games, on_delete: :nothing)
add :player_id, references(:players, on_delete: :nothing)
timestamps()
end
create index(:gameplays, [:game_id])
create index(:gameplays, [:player_id])
end
end
| 23.823529
| 63
| 0.691358
|
939c989d52a8d7ad80140710e6d191ab9eb4c60d
| 6,869
|
ex
|
Elixir
|
lib/livebook_web/live/session_live/input_cell_settings_component.ex
|
chamot1111/livebook
|
4ff1ff0d5a3c664fdf53b71667b9b4660ce8d7f4
|
[
"Apache-2.0"
] | null | null | null |
lib/livebook_web/live/session_live/input_cell_settings_component.ex
|
chamot1111/livebook
|
4ff1ff0d5a3c664fdf53b71667b9b4660ce8d7f4
|
[
"Apache-2.0"
] | null | null | null |
lib/livebook_web/live/session_live/input_cell_settings_component.ex
|
chamot1111/livebook
|
4ff1ff0d5a3c664fdf53b71667b9b4660ce8d7f4
|
[
"Apache-2.0"
] | null | null | null |
defmodule LivebookWeb.SessionLive.InputCellSettingsComponent do
use LivebookWeb, :live_component
alias Livebook.Session
alias Livebook.Notebook.Cell
@impl true
def update(assigns, socket) do
cell = assigns.cell
socket =
socket
|> assign(assigns)
|> assign(:current_type, cell.type)
|> assign_new(:attrs, fn ->
Map.take(cell, [:name, :type, :reactive, :props])
end)
|> assign_new(:valid, fn -> true end)
{:ok, socket}
end
@impl true
def render(assigns) do
~H"""
<div class="p-6 pb-4 flex flex-col space-y-8">
<h3 class="text-2xl font-semibold text-gray-800">
Cell settings
</h3>
<form
phx-submit="save"
phx-change="validate"
phx-target={@myself}
spellcheck="false"
autocomplete="off">
<div class="flex flex-col space-y-6">
<div>
<div class="input-label">Type</div>
<.select name="attrs[type]" selected={@attrs.type} options={input_types()} />
</div>
<div>
<div class="input-label">Name</div>
<input type="text" class="input" name="attrs[name]" value={@attrs.name} autofocus />
</div>
<.extra_fields type={@attrs.type} props={@attrs.props} myself={@myself} />
<.switch_checkbox
name="attrs[reactive]"
label="Reactive (reevaluates dependent cells on change)"
checked={@attrs.reactive} />
</div>
<div class="mt-8 flex justify-end space-x-2">
<%= live_patch "Cancel", to: @return_to, class: "button button-outlined-gray" %>
<button class="button button-blue" type="submit" disabled={not @valid}>
Save
</button>
</div>
</form>
</div>
"""
end
defp extra_fields(%{type: :range} = assigns) do
~H"""
<div class="flex space-x-4">
<div class="flex-grow">
<div class="input-label">Min</div>
<input type="number" class="input" name="attrs[props][min]" value={@props.min} />
</div>
<div class="flex-grow">
<div class="input-label">Max</div>
<input type="number" class="input" name="attrs[props][max]" value={@props.max} />
</div>
<div class="flex-grow">
<div class="input-label">Step</div>
<input type="number" class="input" name="attrs[props][step]" value={@props.step} />
</div>
</div>
"""
end
defp extra_fields(%{type: :select} = assigns) do
~H"""
<div class="flex flex-col">
<div class="input-label mb-0">Options</div>
<div class="my-2 flex flex-col space-y-2">
<%= for {option, idx} <- Enum.with_index(@props.options) do %>
<div class="flex items-center space-x-2">
<input
type="text"
class="input"
name="attrs[props][options][]"
value={option} />
<button
class="button button-gray button-square-icon"
type="button"
tabindex="-1"
phx-target={@myself}
phx-click="select_options_action"
phx-value-action="delete"
phx-value-index={idx}
disabled={length(@props.options) == 1}>
<.remix_icon icon="delete-bin-6-line" />
</button>
</div>
<% end %>
</div>
<div>
<button
class="button button-outlined-gray"
type="button"
phx-target={@myself}
phx-click="select_options_action"
phx-value-action="add">
Add
</button>
</div>
</div>
"""
end
defp extra_fields(assigns), do: ~H""
@impl true
def handle_event("validate", params, socket) do
{valid?, attrs} = validate_attrs(params["attrs"], socket.assigns.attrs)
{:noreply, socket |> assign(attrs: attrs) |> assign(:valid, valid?)}
end
def handle_event("save", params, socket) do
{true, attrs} = validate_attrs(params["attrs"], socket.assigns.attrs)
attrs =
if attrs.type != socket.assigns.current_type do
Map.put(attrs, :value, default_value(attrs.type, attrs.props))
else
attrs
end
Session.set_cell_attributes(socket.assigns.session.pid, socket.assigns.cell.id, attrs)
{:noreply, push_patch(socket, to: socket.assigns.return_to)}
end
def handle_event("select_options_action", params, socket) do
{action, params} = Map.pop!(params, "action")
attrs = socket.assigns.attrs
options = select_options_action(action, params, attrs.props.options)
attrs = put_in(attrs.props.options, options)
valid? = valid_options?(options)
{:noreply, socket |> assign(attrs: attrs) |> assign(valid: valid?)}
end
defp select_options_action("add", _params, options) do
options ++ [""]
end
defp select_options_action("delete", %{"index" => index}, options) do
index = String.to_integer(index)
List.delete_at(options, index)
end
defp validate_attrs(data, prev_attrs) do
name = data["name"]
type = data["type"] |> String.to_existing_atom()
reactive = data["reactive"] == "true"
{props_valid?, props} =
if type == prev_attrs.type do
data |> Map.get("props", %{}) |> validate_props(type)
else
{true, Cell.Input.default_props(type)}
end
valid? = name != "" and props_valid?
{valid?, %{name: name, type: type, reactive: reactive, props: props}}
end
defp validate_props(data, :range) do
min = parse_number(data["min"])
max = parse_number(data["max"])
step = parse_number(data["step"])
valid? = min != nil and max != nil and step != nil and min < max and step > 0
data = %{min: min, max: max, step: step}
{valid?, data}
end
defp validate_props(data, :select) do
options = data["options"] || []
valid? = valid_options?(options)
{valid?, %{options: options}}
end
defp validate_props(_data, _type) do
{true, %{}}
end
defp valid_options?(options) do
options != [] and options == Enum.uniq(options)
end
defp parse_number(string) do
case Float.parse(string) do
{number, _} ->
integer = round(number)
if integer == number, do: integer, else: number
:error ->
nil
end
end
defp default_value(:checkbox, _props), do: "false"
defp default_value(:color, _props), do: "#3E64FF"
defp default_value(:range, %{min: min}), do: to_string(min)
defp default_value(:select, %{options: [option | _]}), do: option
defp default_value(_type, _props), do: ""
defp input_types do
[
checkbox: "Checkbox",
color: "Color",
number: "Number",
password: "Password",
text: "Text",
textarea: "Textarea",
url: "URL",
range: "Range",
select: "Select"
]
end
end
| 29.607759
| 96
| 0.577231
|
939ca7d8c8b33d43a659cc9b263267f87e438e10
| 1,595
|
ex
|
Elixir
|
clients/display_video/lib/google_api/display_video/v1/model/browser_targeting_option_details.ex
|
pojiro/elixir-google-api
|
928496a017d3875a1929c6809d9221d79404b910
|
[
"Apache-2.0"
] | 1
|
2021-12-20T03:40:53.000Z
|
2021-12-20T03:40:53.000Z
|
clients/display_video/lib/google_api/display_video/v1/model/browser_targeting_option_details.ex
|
pojiro/elixir-google-api
|
928496a017d3875a1929c6809d9221d79404b910
|
[
"Apache-2.0"
] | 1
|
2020-08-18T00:11:23.000Z
|
2020-08-18T00:44:16.000Z
|
clients/display_video/lib/google_api/display_video/v1/model/browser_targeting_option_details.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.DisplayVideo.V1.Model.BrowserTargetingOptionDetails do
@moduledoc """
Represents a targetable browser. This will be populated in the browser_details field when targeting_type is `TARGETING_TYPE_BROWSER`.
## Attributes
* `displayName` (*type:* `String.t`, *default:* `nil`) - Output only. The display name of the browser.
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:displayName => String.t() | nil
}
field(:displayName)
end
defimpl Poison.Decoder, for: GoogleApi.DisplayVideo.V1.Model.BrowserTargetingOptionDetails do
def decode(value, options) do
GoogleApi.DisplayVideo.V1.Model.BrowserTargetingOptionDetails.decode(value, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.DisplayVideo.V1.Model.BrowserTargetingOptionDetails do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 33.93617
| 135
| 0.755486
|
939cceb4c5b20a51e61bf5b781b3fd3308a6ba83
| 1,420
|
exs
|
Elixir
|
test/scatterer_test.exs
|
dougal/scatter_swap.ex
|
f596196330081265d4838e884ce73ac2143cd66e
|
[
"MIT"
] | null | null | null |
test/scatterer_test.exs
|
dougal/scatter_swap.ex
|
f596196330081265d4838e884ce73ac2143cd66e
|
[
"MIT"
] | null | null | null |
test/scatterer_test.exs
|
dougal/scatter_swap.ex
|
f596196330081265d4838e884ce73ac2143cd66e
|
[
"MIT"
] | null | null | null |
defmodule ScatterSwap.ScattererTest do
use ExUnit.Case
doctest ScatterSwap.Scatterer
alias ScatterSwap.Scatterer
test "scatter() rearranges the digits" do
assert Scatterer.scatter([0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
assert Scatterer.scatter([0, 0, 0, 0, 0, 0, 0, 0, 0, 2]) == [0, 0, 0, 0, 2, 0, 0, 0, 0, 0]
end
test "scatter() with a salt scrambles the results" do
assert Scatterer.scatter([0, 0, 0, 0, 0, 0, 0, 0, 0, 1], 14) == [0, 0, 0, 1, 0, 0, 0, 0, 0, 0]
assert Scatterer.scatter([0, 0, 0, 0, 0, 0, 0, 0, 0, 2], 26) == [0, 2, 0, 0, 0, 0, 0, 0, 0, 0]
end
test "unscatter() uses the sum of the digits to return the original list" do
assert Scatterer.unscatter([0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
assert Scatterer.unscatter([0, 0, 0, 0, 2, 0, 0, 0, 0, 0]) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 2]
end
test "unscatter() with a salt returns the original list" do
assert Scatterer.unscatter([0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 14) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
assert Scatterer.unscatter([0, 2, 0, 0, 0, 0, 0, 0, 0, 0], 26) == [0, 0, 0, 0, 0, 0, 0, 0, 0, 2]
end
test "unscatter() reverses the actions of scatter()" do
original = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
output = original
|> Scatterer.scatter(84)
|> Scatterer.unscatter(84)
assert output == original
end
end
| 38.378378
| 100
| 0.549296
|
939cd3442b18a16188d24be09671aab8d03182ba
| 1,387
|
exs
|
Elixir
|
mix.exs
|
robotarmy/serve_elm
|
931787a55acbe076eac0c0b199c5cfc63425197e
|
[
"MIT"
] | null | null | null |
mix.exs
|
robotarmy/serve_elm
|
931787a55acbe076eac0c0b199c5cfc63425197e
|
[
"MIT"
] | null | null | null |
mix.exs
|
robotarmy/serve_elm
|
931787a55acbe076eac0c0b199c5cfc63425197e
|
[
"MIT"
] | null | null | null |
defmodule ServeElm.Mixfile do
use Mix.Project
def project do
[
app: :serve_elm,
version: "0.0.1",
elixir: "~> 1.4",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
start_permanent: Mix.env == :prod,
deps: deps()
]
end
# Configuration for the OTP application.
#
# Type `mix help compile.app` for more information.
def application do
[
mod: {ServeElm.Application, []},
extra_applications: [:logger, :runtime_tools, :corsica]
]
end
# Specifies which paths to compile per environment.
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
# Specifies your project dependencies.
#
# Type `mix help deps` for examples and options.
defp deps do
[
{
:phoenix,
git: "git@github.com:phoenixframework/phoenix",
branch: "master",
override: true
},
{:phoenix_pubsub, "~> 1.0"},
{:phoenix_html, "~> 2.10"},
{:phoenix_live_reload, "~> 1.0", only: :dev},
{:gettext, "~> 0.11"},
{:execjs, git: "git@github.com:robotarmy/execjs.git", branch: "master"},
{:cowboy, "~> 2.1", override: true},
{:plug, "~> 1.5-rc0", override: true},
{:json_web_token, "~> 0.2.5"},
{ :uuid, "~> 1.1" } ,
{:corsica, "~> 1.0"}
]
end
end
| 25.685185
| 78
| 0.568854
|
939d13316b94c52975fe5a9ab7a3cb07f810f966
| 198
|
exs
|
Elixir
|
priv/repo/migrations/20170528152505_add_winnings_adj_to_fantasy_team.exs
|
axelclark/ex338
|
3fb3c260d93bda61f7636ee1a677770d2dc1b89a
|
[
"MIT"
] | 17
|
2016-12-22T06:39:26.000Z
|
2021-01-20T13:51:13.000Z
|
priv/repo/migrations/20170528152505_add_winnings_adj_to_fantasy_team.exs
|
axelclark/ex338
|
3fb3c260d93bda61f7636ee1a677770d2dc1b89a
|
[
"MIT"
] | 608
|
2016-08-06T18:57:58.000Z
|
2022-03-01T02:48:17.000Z
|
priv/repo/migrations/20170528152505_add_winnings_adj_to_fantasy_team.exs
|
axelclark/ex338
|
3fb3c260d93bda61f7636ee1a677770d2dc1b89a
|
[
"MIT"
] | 6
|
2017-11-21T22:35:45.000Z
|
2022-01-11T21:37:40.000Z
|
defmodule Ex338.Repo.Migrations.AddWinningsAdjToFantasyTeam do
use Ecto.Migration
def change do
alter table(:fantasy_teams) do
add :winnings_adj, :float, default: 0
end
end
end
| 19.8
| 62
| 0.737374
|
939d6463e8c0f9088cf060376153a0beb6062657
| 109
|
exs
|
Elixir
|
.formatter.exs
|
mayel/benchee
|
faf3c85c241a4c7eeaab8edfc85094bbbb10c44d
|
[
"MIT"
] | 636
|
2016-06-06T07:58:36.000Z
|
2019-03-19T15:27:37.000Z
|
.formatter.exs
|
mayel/benchee
|
faf3c85c241a4c7eeaab8edfc85094bbbb10c44d
|
[
"MIT"
] | 198
|
2016-06-18T08:19:15.000Z
|
2019-03-19T15:32:37.000Z
|
.formatter.exs
|
mayel/benchee
|
faf3c85c241a4c7eeaab8edfc85094bbbb10c44d
|
[
"MIT"
] | 43
|
2016-06-08T08:04:30.000Z
|
2019-02-13T17:10:24.000Z
|
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test,samples,mix}/**/*.{ex,exs}"]
]
| 21.8
| 81
| 0.587156
|
939d7d6d66a49869f1b00bf00d89f644d9bd6c5e
| 158
|
exs
|
Elixir
|
test/ffaker/zh_cn/gender_test.exs
|
marocchino/ffaker
|
5bb4420a8034db9f954a2464cd72039129ef2307
|
[
"MIT"
] | 9
|
2016-11-09T15:50:05.000Z
|
2021-02-02T05:45:06.000Z
|
test/ffaker/zh_cn/gender_test.exs
|
marocchino/ffaker
|
5bb4420a8034db9f954a2464cd72039129ef2307
|
[
"MIT"
] | 3
|
2016-09-01T09:54:46.000Z
|
2017-07-25T05:23:56.000Z
|
test/ffaker/zh_cn/gender_test.exs
|
marocchino/ffaker
|
5bb4420a8034db9f954a2464cd72039129ef2307
|
[
"MIT"
] | 4
|
2016-11-22T17:51:48.000Z
|
2021-02-02T05:45:01.000Z
|
defmodule Ffaker.ZhCn.GenderTest do
use ExUnit.Case, async: true
import Ffaker.ZhCn.Gender
test "gender/0" do
assert gender() in ~w(女 男)
end
end
| 17.555556
| 35
| 0.702532
|
939d88069b9541c472b9b1dc39a18fa4dd20b41d
| 6,040
|
ex
|
Elixir
|
lib/livebook/application.ex
|
doyobi/livebook
|
136d5039c42b406dd0b31aea188deb4fce3b1328
|
[
"Apache-2.0"
] | 1
|
2022-02-16T09:13:27.000Z
|
2022-02-16T09:13:27.000Z
|
lib/livebook/application.ex
|
doyobi/livebook
|
136d5039c42b406dd0b31aea188deb4fce3b1328
|
[
"Apache-2.0"
] | null | null | null |
lib/livebook/application.ex
|
doyobi/livebook
|
136d5039c42b406dd0b31aea188deb4fce3b1328
|
[
"Apache-2.0"
] | null | null | null |
defmodule Livebook.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
def start(_type, _args) do
ensure_directories!()
set_local_filesystem!()
ensure_distribution!()
validate_hostname_resolution!()
set_cookie()
children =
[
# Start the Telemetry supervisor
LivebookWeb.Telemetry,
# Start the PubSub system
{Phoenix.PubSub, name: Livebook.PubSub},
# Start the storage module
Livebook.Storage.current(),
# Periodid measurement of system resources
Livebook.SystemResources,
# Start the tracker server on this node
{Livebook.Tracker, pubsub_server: Livebook.PubSub},
# Start the supervisor dynamically managing sessions
{DynamicSupervisor, name: Livebook.SessionSupervisor, strategy: :one_for_one},
# Start the server responsible for associating files with sessions
Livebook.Session.FileGuard,
# Start the Node Pool for managing node names
Livebook.Runtime.NodePool,
# Start the unique task dependencies
Livebook.Utils.UniqueTask
] ++
iframe_server_specs() ++
[
# Start the Endpoint (http/https)
# We skip the access url as we do our own logging below
{LivebookWeb.Endpoint, log_access_url: false}
] ++ app_specs()
opts = [strategy: :one_for_one, name: Livebook.Supervisor]
with {:ok, _} = result <- Supervisor.start_link(children, opts) do
clear_env_vars()
display_startup_info()
result
end
end
# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
def config_change(changed, _new, removed) do
LivebookWeb.Endpoint.config_change(changed, removed)
:ok
end
defp ensure_directories!() do
File.mkdir_p!(Livebook.Config.home())
File.mkdir_p!(Livebook.Config.data_path())
end
defp set_local_filesystem!() do
home =
Livebook.Config.home()
|> Livebook.FileSystem.Utils.ensure_dir_path()
local_filesystem = Livebook.FileSystem.Local.new(default_path: home)
:persistent_term.put(:livebook_local_filesystem, local_filesystem)
end
defp ensure_distribution!() do
unless Node.alive?() do
case System.cmd("epmd", ["-daemon"]) do
{_, 0} ->
:ok
_ ->
Livebook.Config.abort!("""
could not start epmd (Erlang Port Mapper Driver). Livebook uses epmd to \
talk to different runtimes. You may have to start epmd explicitly by calling:
epmd -daemon
Or by calling:
elixir --sname test -e "IO.puts node()"
Then you can try booting Livebook again
""")
end
{type, name} = get_node_type_and_name()
case Node.start(name, type) do
{:ok, _} ->
:ok
{:error, reason} ->
Livebook.Config.abort!("could not start distributed node: #{inspect(reason)}")
end
end
end
import Record
defrecordp :hostent, Record.extract(:hostent, from_lib: "kernel/include/inet.hrl")
# See https://github.com/livebook-dev/livebook/issues/302
defp validate_hostname_resolution!() do
unless Livebook.Config.longname() do
hostname = Livebook.Utils.node_host() |> to_charlist()
case :inet.gethostbyname(hostname) do
{:error, :nxdomain} ->
invalid_hostname!("your hostname \"#{hostname}\" does not resolve to an IP address")
# We only try the first address, so that's the one we validate.
{:ok, hostent(h_addrtype: :inet, h_addr_list: [address | _])} ->
unless inet_loopback?(address) or inet_if?(address) do
invalid_hostname!(
"your hostname \"#{hostname}\" does not resolve to a loopback address (127.0.0.0/8)"
)
end
_ ->
:ok
end
end
end
defp inet_loopback?(address) do
match?({127, _, _, _}, address)
end
defp inet_if?(address) do
case :inet.getifaddrs() do
{:ok, addrs} -> Enum.any?(addrs, fn {_name, flags} -> {:addr, address} in flags end)
_ -> false
end
end
@spec invalid_hostname!(String.t()) :: no_return()
defp invalid_hostname!(prelude) do
Livebook.Config.abort!("""
#{prelude}, which indicates something wrong in your OS configuration.
Make sure your computer's name resolves locally or start Livebook using a long distribution name. If you are using Livebook's CLI, you can:
livebook server --name livebook@127.0.0.1
If you are running it from source, do instead:
MIX_ENV=prod elixir --name livebook@127.0.0.1 -S mix phx.server
""")
end
defp set_cookie() do
cookie = Application.fetch_env!(:livebook, :cookie)
Node.set_cookie(cookie)
end
defp get_node_type_and_name() do
Application.get_env(:livebook, :node) || {:shortnames, random_short_name()}
end
defp random_short_name() do
:"livebook_#{Livebook.Utils.random_short_id()}"
end
defp display_startup_info() do
if Phoenix.Endpoint.server?(:livebook, LivebookWeb.Endpoint) do
IO.puts("[Livebook] Application running at #{LivebookWeb.Endpoint.access_url()}")
end
end
defp clear_env_vars() do
for {var, _} <- System.get_env(), config_env_var?(var) do
System.delete_env(var)
end
end
defp config_env_var?("LIVEBOOK_" <> _), do: true
defp config_env_var?("RELEASE_" <> _), do: true
defp config_env_var?(_), do: false
if Mix.target() == :app do
defp app_specs, do: [LivebookApp]
else
defp app_specs, do: []
end
defp iframe_server_specs() do
server? = Phoenix.Endpoint.server?(:livebook, LivebookWeb.Endpoint)
port = Livebook.Config.iframe_port()
if server? do
# Start the iframe endpoint on a different port
[{Plug.Cowboy, scheme: :http, plug: LivebookWeb.IframeEndpoint, options: [port: port]}]
else
[]
end
end
end
| 29.463415
| 143
| 0.648841
|
939da758177456cb62eb69b2bfb74d106922adcd
| 1,980
|
exs
|
Elixir
|
apps/rig_kafka/test/rig_kafka_test.exs
|
kevinbader/reactive-interaction-gateway
|
e957ca27ea897d074954ae09f65afbcaa79393f0
|
[
"Apache-2.0"
] | null | null | null |
apps/rig_kafka/test/rig_kafka_test.exs
|
kevinbader/reactive-interaction-gateway
|
e957ca27ea897d074954ae09f65afbcaa79393f0
|
[
"Apache-2.0"
] | 132
|
2018-11-26T14:00:54.000Z
|
2022-03-11T04:17:54.000Z
|
apps/rig_kafka/test/rig_kafka_test.exs
|
kevinbader/reactive-interaction-gateway
|
e957ca27ea897d074954ae09f65afbcaa79393f0
|
[
"Apache-2.0"
] | null | null | null |
defmodule RigKafkaTest do
@moduledoc """
Test suite for RIG's Kafka client.
The suite does not use any mocks, because RigKafka is, for the most part, glue code
on top of brod, the underlying Kafka client. The tests make sure that the setup
works in general and that the behaviour of brod stays the same.
There is also a recovery tests that shows how RIG deals with a network outage; see
`RigKafka.NetworkOutageTest`.
"""
use ExUnit.Case, async: false
doctest RigKafka
alias RigKafka
alias RigKafka.Config
@sup RigKafka.DynamicSupervisor
defp kafka_config(consumer_topics, serializer, schema_registry_host) do
broker_env = System.get_env("KAFKA_BROKERS")
assert not is_nil(broker_env), "KAFKA_BROKERS needs to be set for Kafka test to work"
brokers =
broker_env
|> String.split(",")
|> Enum.map(fn socket ->
[host, port] = for part <- String.split(socket, ":"), do: String.trim(part)
{host, String.to_integer(port)}
end)
Config.new(%{
brokers: brokers,
consumer_topics: consumer_topics,
serializer: serializer,
schema_registry_host: schema_registry_host,
group_id: "rig"
})
end
@tag :kafka
test "Given a started RigKafka client, messages can be produced and consumed." do
topic = "rig-kafka-test-simple-topic"
serializer = nil
schema_registry_host = ""
config = kafka_config([topic], serializer, schema_registry_host)
expected_msg = "this is a test message"
test_pid = self()
callback = fn
^expected_msg ->
send(test_pid, :test_message_received)
:ok
end
{:ok, pid} = RigKafka.start(config, callback)
RigKafka.produce(config, topic, "", "test", expected_msg)
assert_receive :test_message_received, 10_000
RigKafka.produce(config, topic, "", "test", expected_msg)
assert_receive :test_message_received, 10_000
DynamicSupervisor.terminate_child(@sup, pid)
end
end
| 28.285714
| 89
| 0.691919
|
939df5a7fc0f91094e74f19409d36e9d36713389
| 308
|
ex
|
Elixir
|
apps/aehttpserver/lib/aehttpserver/web/plugs/set_header.ex
|
SingularityMatrix/elixir-node
|
ad126aa97931165185cf35454718ed2eee40ceed
|
[
"ISC"
] | 131
|
2018-03-10T01:35:56.000Z
|
2021-12-27T13:44:41.000Z
|
apps/aehttpserver/lib/aehttpserver/web/plugs/set_header.ex
|
SingularityMatrix/elixir-node
|
ad126aa97931165185cf35454718ed2eee40ceed
|
[
"ISC"
] | 445
|
2018-03-12T09:46:17.000Z
|
2018-12-12T09:52:07.000Z
|
apps/aehttpserver/lib/aehttpserver/web/plugs/set_header.ex
|
gspasov/dogs-blockchain
|
884c14cfc98de2c3793a204da069630d090bbc90
|
[
"0BSD"
] | 23
|
2018-03-12T12:01:28.000Z
|
2022-03-06T09:22:17.000Z
|
defmodule Aehttpserver.Plugs.SetHeader do
@moduledoc """
A plug that adds a header which confirms that the server is an aehttpserver to every response
"""
import Plug.Conn
def init(default), do: default
def call(conn, _default) do
put_resp_header(conn, "server", "aehttpserver")
end
end
| 22
| 95
| 0.727273
|
939e03b50e612f9c580fbb9ec6866e43f9071c2e
| 583
|
exs
|
Elixir
|
test/auxilio_web/views/error_view_test.exs
|
HackathonSupport/auxilio
|
7afc7372d0fbd902580a567be4cd106ece0d5b9b
|
[
"MIT"
] | null | null | null |
test/auxilio_web/views/error_view_test.exs
|
HackathonSupport/auxilio
|
7afc7372d0fbd902580a567be4cd106ece0d5b9b
|
[
"MIT"
] | 1
|
2018-02-04T02:33:55.000Z
|
2018-12-07T11:22:13.000Z
|
test/auxilio_web/views/error_view_test.exs
|
HackathonSupport/auxilio
|
7afc7372d0fbd902580a567be4cd106ece0d5b9b
|
[
"MIT"
] | null | null | null |
defmodule AuxilioWeb.ErrorViewTest do
use AuxilioWeb.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(AuxilioWeb.ErrorView, "404.html", []) ==
"Page not found"
end
test "render 500.html" do
assert render_to_string(AuxilioWeb.ErrorView, "500.html", []) ==
"Internal server error"
end
test "render any other" do
assert render_to_string(AuxilioWeb.ErrorView, "505.html", []) ==
"Internal server error"
end
end
| 26.5
| 68
| 0.684391
|
939e14014c96630f8f5e2ce9a300f37ec51a7691
| 3,985
|
ex
|
Elixir
|
clients/dialogflow/lib/google_api/dialogflow/v2/model/google_cloud_dialogflow_cx_v3_conversation_turn_virtual_agent_output.ex
|
kyleVsteger/elixir-google-api
|
3a0dd498af066a4361b5b0fd66ffc04a57539488
|
[
"Apache-2.0"
] | 1
|
2021-10-01T09:20:41.000Z
|
2021-10-01T09:20:41.000Z
|
clients/dialogflow/lib/google_api/dialogflow/v2/model/google_cloud_dialogflow_cx_v3_conversation_turn_virtual_agent_output.ex
|
kyleVsteger/elixir-google-api
|
3a0dd498af066a4361b5b0fd66ffc04a57539488
|
[
"Apache-2.0"
] | null | null | null |
clients/dialogflow/lib/google_api/dialogflow/v2/model/google_cloud_dialogflow_cx_v3_conversation_turn_virtual_agent_output.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.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3ConversationTurnVirtualAgentOutput do
@moduledoc """
The output from the virtual agent.
## Attributes
* `currentPage` (*type:* `GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3Page.t`, *default:* `nil`) - The Page on which the utterance was spoken. Only name and displayName will be set.
* `diagnosticInfo` (*type:* `map()`, *default:* `nil`) - Required. Input only. The diagnostic info output for the turn.
* `differences` (*type:* `list(GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3TestRunDifference.t)`, *default:* `nil`) - Output only. If this is part of a result conversation turn, the list of differences between the original run and the replay for this output, if any.
* `sessionParameters` (*type:* `map()`, *default:* `nil`) - The session parameters available to the bot at this point.
* `status` (*type:* `GoogleApi.Dialogflow.V2.Model.GoogleRpcStatus.t`, *default:* `nil`) - Response error from the agent in the test result. If set, other output is empty.
* `textResponses` (*type:* `list(GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3ResponseMessageText.t)`, *default:* `nil`) - The text responses from the agent for the turn.
* `triggeredIntent` (*type:* `GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3Intent.t`, *default:* `nil`) - The Intent that triggered the response. Only name and displayName will be set.
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:currentPage => GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3Page.t() | nil,
:diagnosticInfo => map() | nil,
:differences =>
list(GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3TestRunDifference.t())
| nil,
:sessionParameters => map() | nil,
:status => GoogleApi.Dialogflow.V2.Model.GoogleRpcStatus.t() | nil,
:textResponses =>
list(GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3ResponseMessageText.t())
| nil,
:triggeredIntent =>
GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3Intent.t() | nil
}
field(:currentPage, as: GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3Page)
field(:diagnosticInfo, type: :map)
field(:differences,
as: GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3TestRunDifference,
type: :list
)
field(:sessionParameters, type: :map)
field(:status, as: GoogleApi.Dialogflow.V2.Model.GoogleRpcStatus)
field(:textResponses,
as: GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3ResponseMessageText,
type: :list
)
field(:triggeredIntent, as: GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3Intent)
end
defimpl Poison.Decoder,
for: GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3ConversationTurnVirtualAgentOutput do
def decode(value, options) do
GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3ConversationTurnVirtualAgentOutput.decode(
value,
options
)
end
end
defimpl Poison.Encoder,
for: GoogleApi.Dialogflow.V2.Model.GoogleCloudDialogflowCxV3ConversationTurnVirtualAgentOutput do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 46.882353
| 281
| 0.737516
|
939e7e9fc1f48f573efce12f60af8b4766dd567b
| 111
|
exs
|
Elixir
|
.formatter.exs
|
IvanRublev/TwitterWall
|
ca3f900dfaf64c5d59ac903f697da87e9fcc9914
|
[
"MIT"
] | 1
|
2020-01-27T17:43:01.000Z
|
2020-01-27T17:43:01.000Z
|
.formatter.exs
|
IvanRublev/TwitterWall
|
ca3f900dfaf64c5d59ac903f697da87e9fcc9914
|
[
"MIT"
] | 6
|
2021-03-09T22:08:16.000Z
|
2021-06-30T23:48:20.000Z
|
.formatter.exs
|
IvanRublev/TwitterWall
|
ca3f900dfaf64c5d59ac903f697da87e9fcc9914
|
[
"MIT"
] | null | null | null |
[
import_deps: [:phoenix],
inputs: ["*.{ex,exs}", "{config,lib,test}/**/*.{ex,exs}"],
line_length: 150
]
| 18.5
| 60
| 0.54955
|
939e90cb2a46967581e205886fb658a7eacc8a56
| 451
|
ex
|
Elixir
|
lab-two-flooding-algorithms/skeleton/lib/flooding.ex
|
HilliamT/distributed-algorithms
|
788e8e0b9a6c60570ecf8336f2239fb1d1945b1c
|
[
"MIT"
] | null | null | null |
lab-two-flooding-algorithms/skeleton/lib/flooding.ex
|
HilliamT/distributed-algorithms
|
788e8e0b9a6c60570ecf8336f2239fb1d1945b1c
|
[
"MIT"
] | null | null | null |
lab-two-flooding-algorithms/skeleton/lib/flooding.ex
|
HilliamT/distributed-algorithms
|
788e8e0b9a6c60570ecf8336f2239fb1d1945b1c
|
[
"MIT"
] | null | null | null |
# distributed algorithms, n.dulay, 4 jan 21
# basic flooding, v1
# flood message through 1-hop (fully connected) network
defmodule Flooding do
def start do
config = Helper.node_init()
start(config.start_function, config)
end # start/0
defp start(:cluster_wait, _), do: :skip
defp start(:cluster_start, config) do
IO.puts "-> Flooding at #{Helper.node_string()}"
# add your code here
end # start
end # module -----------------------
| 18.791667
| 55
| 0.676275
|
939e970ab5fce7b7df84939f053bd5ee388275da
| 1,003
|
ex
|
Elixir
|
lib/annacl/permissions/permissions.ex
|
annatel/annacl
|
55a7eff89617fe9cf41f532cf3f62566bd4b0d9a
|
[
"MIT"
] | 7
|
2020-07-26T18:24:19.000Z
|
2021-06-22T10:15:48.000Z
|
lib/annacl/permissions/permissions.ex
|
annatel/annacl
|
55a7eff89617fe9cf41f532cf3f62566bd4b0d9a
|
[
"MIT"
] | 2
|
2020-08-15T00:58:53.000Z
|
2020-10-31T16:54:11.000Z
|
lib/annacl/permissions/permissions.ex
|
annatel/annacl
|
55a7eff89617fe9cf41f532cf3f62566bd4b0d9a
|
[
"MIT"
] | 2
|
2020-10-22T20:13:21.000Z
|
2020-10-30T14:53:10.000Z
|
defmodule Annacl.Permissions do
@moduledoc false
import Ecto.Query, only: [where: 2]
alias Annacl.Permissions.Permission
@spec create_permission(map) :: {:ok, Permission.t()} | {:error, Ecto.Changeset.t()}
def create_permission(attrs) when is_map(attrs) do
%Permission{}
|> Permission.changeset(attrs)
|> Annacl.repo().insert()
end
@spec get_permission(binary) :: Permission.t() | nil
def get_permission(name) when is_binary(name) do
Permission
|> where(name: ^name)
|> Annacl.repo().one()
end
@spec get_permission!(binary) :: Permission.t()
def get_permission!(name) when is_binary(name) do
Permission
|> where(name: ^name)
|> Annacl.repo().one!()
end
@spec update_permission(Permission.t(), map) ::
{:ok, Permission.t()} | {:error, Ecto.Changeset.t()}
def update_permission(%Permission{} = permission, attrs) when is_map(attrs) do
permission
|> Permission.changeset(attrs)
|> Annacl.repo().update()
end
end
| 27.108108
| 86
| 0.664008
|
939eba8f76e5e4f5ad722a82076d96a6f92bc61f
| 921
|
ex
|
Elixir
|
lib/diff/patch.ex
|
scripbox/ex_audit
|
6478d72816e9357c9ba4eb5eeafd0244010133b4
|
[
"MIT"
] | null | null | null |
lib/diff/patch.ex
|
scripbox/ex_audit
|
6478d72816e9357c9ba4eb5eeafd0244010133b4
|
[
"MIT"
] | null | null | null |
lib/diff/patch.ex
|
scripbox/ex_audit
|
6478d72816e9357c9ba4eb5eeafd0244010133b4
|
[
"MIT"
] | null | null | null |
defmodule ExAudit.Patch do
@doc """
Applies the patch to the given term
"""
def patch(_, {:primitive_change, _, b}) do
b
end
def patch(a, :not_changed) do
a
end
def patch(list, changes) when is_list(list) and is_list(changes) do
changes
|> Enum.reverse()
|> Enum.reduce(list, fn
{:added_to_list, i, el}, list ->
List.insert_at(list, i, el)
{:removed_from_list, i, _}, list ->
List.delete_at(list, i)
{:changed_in_list, i, change}, list ->
List.update_at(list, i, &patch(&1, change))
end)
end
def patch(map, changes) when is_map(map) and is_map(changes) do
changes
|> Enum.reduce(map, fn
{key, {:added, b}}, map ->
Map.put(map, key, b)
{key, {:removed, _}}, map ->
Map.delete(map, key)
{key, {:changed, changes}}, map ->
Map.update!(map, key, &patch(&1, changes))
end)
end
end
| 24.891892
| 69
| 0.571118
|
939ef844bc375ce018d548d5b200777133c3f9f7
| 78
|
exs
|
Elixir
|
banking_challenge_stone_umbrella/apps/banking_challenge_web/test/test_helper.exs
|
douxsalemk/banking_challenge_stone
|
59c2790a0f14b68c2b25851c806ebc553227316d
|
[
"Apache-2.0"
] | null | null | null |
banking_challenge_stone_umbrella/apps/banking_challenge_web/test/test_helper.exs
|
douxsalemk/banking_challenge_stone
|
59c2790a0f14b68c2b25851c806ebc553227316d
|
[
"Apache-2.0"
] | null | null | null |
banking_challenge_stone_umbrella/apps/banking_challenge_web/test/test_helper.exs
|
douxsalemk/banking_challenge_stone
|
59c2790a0f14b68c2b25851c806ebc553227316d
|
[
"Apache-2.0"
] | null | null | null |
ExUnit.start()
Ecto.Adapters.SQL.Sandbox.mode(BankingChallenge.Repo, :manual)
| 26
| 62
| 0.807692
|
939f0a98c4789155584b394e3d09e4212edd3bd1
| 560
|
ex
|
Elixir
|
lib/wong_bejo/email/content.ex
|
fossabot/web.bejoistic
|
edd672a8f125180397b89e1f5ee469b1f2344e7f
|
[
"MIT"
] | null | null | null |
lib/wong_bejo/email/content.ex
|
fossabot/web.bejoistic
|
edd672a8f125180397b89e1f5ee469b1f2344e7f
|
[
"MIT"
] | null | null | null |
lib/wong_bejo/email/content.ex
|
fossabot/web.bejoistic
|
edd672a8f125180397b89e1f5ee469b1f2344e7f
|
[
"MIT"
] | null | null | null |
defmodule WongBejo.Email.Content do
@moduledoc "The content for an email message"
defstruct from_email: nil, to_email: nil, name: nil, message: nil
@type t :: %__MODULE__{
from_email: String.t(),
to_email: String.t(),
name: String.t(),
message: String.t()
}
@spec types :: %{
from_email: :string,
message: :string,
name: :string,
to_email: :string
}
def types do
%{from_email: :string, to_email: :string, name: :string, message: :string}
end
end
| 25.454545
| 78
| 0.571429
|
939f1ee5b54bac297aee1aa437f3c642404c2d5b
| 884
|
ex
|
Elixir
|
clients/datastore/lib/google_api/datastore/v1/metadata.ex
|
yoshi-code-bot/elixir-google-api
|
cdb6032f01fac5ab704803113c39f2207e9e019d
|
[
"Apache-2.0"
] | null | null | null |
clients/datastore/lib/google_api/datastore/v1/metadata.ex
|
yoshi-code-bot/elixir-google-api
|
cdb6032f01fac5ab704803113c39f2207e9e019d
|
[
"Apache-2.0"
] | null | null | null |
clients/datastore/lib/google_api/datastore/v1/metadata.ex
|
yoshi-code-bot/elixir-google-api
|
cdb6032f01fac5ab704803113c39f2207e9e019d
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2020 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.Datastore.V1 do
@moduledoc """
API client metadata for GoogleApi.Datastore.V1.
"""
@discovery_revision "20220524"
def discovery_revision(), do: @discovery_revision
end
| 32.740741
| 74
| 0.75905
|
939f2ad7174a751d9d50924c17077f342435db8f
| 975
|
exs
|
Elixir
|
test/fika/compiler/type_checker/types/union_type_test.exs
|
fika-lang/fika
|
15bffc30daed744670bb2c0fba3e674055adac47
|
[
"Apache-2.0"
] | 220
|
2020-09-12T18:16:29.000Z
|
2022-03-15T14:39:05.000Z
|
test/fika/compiler/type_checker/types/union_type_test.exs
|
fika-lang/fika
|
15bffc30daed744670bb2c0fba3e674055adac47
|
[
"Apache-2.0"
] | 60
|
2020-09-23T14:20:36.000Z
|
2021-03-08T08:55:57.000Z
|
test/fika/compiler/type_checker/types/union_type_test.exs
|
fika-lang/fika
|
15bffc30daed744670bb2c0fba3e674055adac47
|
[
"Apache-2.0"
] | 25
|
2020-09-19T09:06:10.000Z
|
2021-08-24T23:48:39.000Z
|
defmodule Fika.Compiler.TypeChecker.Types.UnionTypeTest do
use ExUnit.Case, async: true
alias Fika.Compiler.TypeChecker.Types.Union
describe "new/1" do
test "handles a flat list" do
expected = MapSet.new([:a, :b, :c])
assert %Union{types: expected} == Union.new([:a, :b, :c])
end
end
describe "flatten_types/1" do
test "handles a list which contains nested Unions" do
expected = MapSet.new([:a, :b, :c, :d])
assert expected == Union.flatten_types([%Union{types: [:a, :b]}, :c, :d])
assert expected == Union.flatten_types([:a, %Union{types: [:b, :c]}, :d])
assert expected == Union.flatten_types([:a, :b, %Union{types: [:c, :d]}])
assert expected ==
Union.flatten_types([
%Union{
types: [
%Union{types: [:a, :b]},
%Union{types: [:c, :d]}
]
}
])
end
end
end
| 29.545455
| 79
| 0.523077
|
939f4377c0f08a3e1a4a9a5634f69ccd031d180f
| 3,260
|
ex
|
Elixir
|
clients/dialogflow/lib/google_api/dialogflow/v2/model/google_longrunning_operation.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_longrunning_operation.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_longrunning_operation.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.GoogleLongrunningOperation do
@moduledoc """
This resource represents a long-running operation that is the result of a network API call.
## Attributes
* `done` (*type:* `boolean()`, *default:* `nil`) - If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.
* `error` (*type:* `GoogleApi.Dialogflow.V2.Model.GoogleRpcStatus.t`, *default:* `nil`) - The error result of the operation in case of failure or cancellation.
* `metadata` (*type:* `map()`, *default:* `nil`) - Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.
* `name` (*type:* `String.t`, *default:* `nil`) - The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
* `response` (*type:* `map()`, *default:* `nil`) - The normal response of the operation in case of success. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:done => boolean() | nil,
:error => GoogleApi.Dialogflow.V2.Model.GoogleRpcStatus.t() | nil,
:metadata => map() | nil,
:name => String.t() | nil,
:response => map() | nil
}
field(:done)
field(:error, as: GoogleApi.Dialogflow.V2.Model.GoogleRpcStatus)
field(:metadata, type: :map)
field(:name)
field(:response, type: :map)
end
defimpl Poison.Decoder, for: GoogleApi.Dialogflow.V2.Model.GoogleLongrunningOperation do
def decode(value, options) do
GoogleApi.Dialogflow.V2.Model.GoogleLongrunningOperation.decode(value, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.Dialogflow.V2.Model.GoogleLongrunningOperation do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 55.254237
| 543
| 0.728834
|
93a011205b239c89f7c319f30a2ff9e2d1ea96ba
| 8,236
|
ex
|
Elixir
|
clients/ad_sense/lib/google_api/ad_sense/v14/api/customchannels.ex
|
ericrwolfe/elixir-google-api
|
3dc0f17edd5e2d6843580c16ddae3bf84b664ffd
|
[
"Apache-2.0"
] | null | null | null |
clients/ad_sense/lib/google_api/ad_sense/v14/api/customchannels.ex
|
ericrwolfe/elixir-google-api
|
3dc0f17edd5e2d6843580c16ddae3bf84b664ffd
|
[
"Apache-2.0"
] | null | null | null |
clients/ad_sense/lib/google_api/ad_sense/v14/api/customchannels.ex
|
ericrwolfe/elixir-google-api
|
3dc0f17edd5e2d6843580c16ddae3bf84b664ffd
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2017 Google Inc.
#
# 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 swagger code generator program.
# https://github.com/swagger-api/swagger-codegen.git
# Do not edit the class manually.
defmodule GoogleApi.AdSense.V14.Api.Customchannels do
@moduledoc """
API calls for all endpoints tagged `Customchannels`.
"""
alias GoogleApi.AdSense.V14.Connection
import GoogleApi.AdSense.V14.RequestBuilder
@doc """
List all ad units in the specified custom channel.
## Parameters
- connection (GoogleApi.AdSense.V14.Connection): Connection to server
- ad_client_id (String): Ad client which contains the custom channel.
- custom_channel_id (String): Custom channel for which to list ad units.
- opts (KeywordList): [optional] Optional parameters
- :alt (String): Data format for the response.
- :fields (String): Selector specifying which fields to include in a partial response.
- :key (String): 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): OAuth 2.0 token for the current user.
- :pretty_print (Boolean): Returns response with indentations and line breaks.
- :quota_user (String): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
- :user_ip (String): IP address of the site where the request originates. Use this if you want to enforce per-user limits.
- :include_inactive (Boolean): Whether to include inactive ad units. Default: true.
- :max_results (Integer): The maximum number of ad units to include in the response, used for paging.
- :page_token (String): A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.
## Returns
{:ok, %GoogleApi.AdSense.V14.Model.AdUnits{}} on success
{:error, info} on failure
"""
@spec adsense_customchannels_adunits_list(Tesla.Env.client(), String.t(), String.t(), keyword()) ::
{:ok, GoogleApi.AdSense.V14.Model.AdUnits.t()} | {:error, Tesla.Env.t()}
def adsense_customchannels_adunits_list(connection, ad_client_id, custom_channel_id, opts \\ []) do
optional_params = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query,
:includeInactive => :query,
:maxResults => :query,
:pageToken => :query
}
%{}
|> method(:get)
|> url("/adclients/{adClientId}/customchannels/{customChannelId}/adunits", %{
"adClientId" => URI.encode_www_form(ad_client_id),
"customChannelId" => URI.encode_www_form(custom_channel_id)
})
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%GoogleApi.AdSense.V14.Model.AdUnits{})
end
@doc """
Get the specified custom channel from the specified ad client.
## Parameters
- connection (GoogleApi.AdSense.V14.Connection): Connection to server
- ad_client_id (String): Ad client which contains the custom channel.
- custom_channel_id (String): Custom channel to retrieve.
- opts (KeywordList): [optional] Optional parameters
- :alt (String): Data format for the response.
- :fields (String): Selector specifying which fields to include in a partial response.
- :key (String): 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): OAuth 2.0 token for the current user.
- :pretty_print (Boolean): Returns response with indentations and line breaks.
- :quota_user (String): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
- :user_ip (String): IP address of the site where the request originates. Use this if you want to enforce per-user limits.
## Returns
{:ok, %GoogleApi.AdSense.V14.Model.CustomChannel{}} on success
{:error, info} on failure
"""
@spec adsense_customchannels_get(Tesla.Env.client(), String.t(), String.t(), keyword()) ::
{:ok, GoogleApi.AdSense.V14.Model.CustomChannel.t()} | {:error, Tesla.Env.t()}
def adsense_customchannels_get(connection, ad_client_id, custom_channel_id, opts \\ []) do
optional_params = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query
}
%{}
|> method(:get)
|> url("/adclients/{adClientId}/customchannels/{customChannelId}", %{
"adClientId" => URI.encode_www_form(ad_client_id),
"customChannelId" => URI.encode_www_form(custom_channel_id)
})
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%GoogleApi.AdSense.V14.Model.CustomChannel{})
end
@doc """
List all custom channels in the specified ad client for this AdSense account.
## Parameters
- connection (GoogleApi.AdSense.V14.Connection): Connection to server
- ad_client_id (String): Ad client for which to list custom channels.
- opts (KeywordList): [optional] Optional parameters
- :alt (String): Data format for the response.
- :fields (String): Selector specifying which fields to include in a partial response.
- :key (String): 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): OAuth 2.0 token for the current user.
- :pretty_print (Boolean): Returns response with indentations and line breaks.
- :quota_user (String): Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.
- :user_ip (String): IP address of the site where the request originates. Use this if you want to enforce per-user limits.
- :max_results (Integer): The maximum number of custom channels to include in the response, used for paging.
- :page_token (String): A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of \"nextPageToken\" from the previous response.
## Returns
{:ok, %GoogleApi.AdSense.V14.Model.CustomChannels{}} on success
{:error, info} on failure
"""
@spec adsense_customchannels_list(Tesla.Env.client(), String.t(), keyword()) ::
{:ok, GoogleApi.AdSense.V14.Model.CustomChannels.t()} | {:error, Tesla.Env.t()}
def adsense_customchannels_list(connection, ad_client_id, opts \\ []) do
optional_params = %{
:alt => :query,
:fields => :query,
:key => :query,
:oauth_token => :query,
:prettyPrint => :query,
:quotaUser => :query,
:userIp => :query,
:maxResults => :query,
:pageToken => :query
}
%{}
|> method(:get)
|> url("/adclients/{adClientId}/customchannels", %{
"adClientId" => URI.encode_www_form(ad_client_id)
})
|> add_optional_params(optional_params, opts)
|> Enum.into([])
|> (&Connection.request(connection, &1)).()
|> decode(%GoogleApi.AdSense.V14.Model.CustomChannels{})
end
end
| 46.795455
| 217
| 0.699126
|
93a0194a10e0afbdf2776db29b6047d38a0770f9
| 4,193
|
ex
|
Elixir
|
priv/templates/whatwasit.install/models/whatwasit/version.ex
|
linges/whatwasit
|
fffa14b2b21bac9903a165ccbb5bc96bdf5cb579
|
[
"MIT"
] | 65
|
2016-07-22T14:07:22.000Z
|
2021-03-23T16:13:17.000Z
|
priv/templates/whatwasit.install/models/whatwasit/version.ex
|
linges/whatwasit
|
fffa14b2b21bac9903a165ccbb5bc96bdf5cb579
|
[
"MIT"
] | 20
|
2016-07-22T04:53:05.000Z
|
2018-02-19T08:26:46.000Z
|
priv/templates/whatwasit.install/models/whatwasit/version.ex
|
linges/whatwasit
|
fffa14b2b21bac9903a165ccbb5bc96bdf5cb579
|
[
"MIT"
] | 11
|
2016-07-24T20:55:37.000Z
|
2019-05-24T22:09:34.000Z
|
defmodule <%= base %>.Whatwasit.Version do
@moduledoc """
Version schema for tracking model versions.
"""
use Ecto.Schema
import Ecto
import Ecto.Changeset
require Ecto.Query
@base Mix.Project.get |> Module.split |> Enum.reverse |> Enum.at(1)
@version_module Module.concat([@base, Whatwasit, Version])
schema "versions" do
field :item_type, :string
field :item_id, :integer
field :action, :string # ~w(update delete)
field :object, :map # versioned schema stored as a map
<%= schema_fields %>
timestamps
end
@doc """
Create a changeset for the version record
"""
def changeset(model, params \\ %{}) do
params = update_in params, [:object], &(remove_fields(&1))
model
|> cast(params, <%= changeset_fields %>)
|> validate_required(~w(item_type item_id object)a)
end
@doc """
Prepare a model for insertion into the database.
Remove standard fields from the model before inserting it into
the database
## Options
* opts -- A list of additional fields
## Examples
remove_fields(%User{}, ~w(password password_confirmation password_hash)a)
"""
def remove_fields(model, opts \\ [])
def remove_fields(%{__meta__: %Ecto.Schema.Metadata{}} = model, opts) do
(model.__struct__.__schema__(:associations) ++ opts)
|> Enum.reduce(model, &(Map.delete(&2, &1)))
|> Map.delete(:__meta__)
|> Map.delete(:__struct__)
end
def remove_fields(model, opts) do
opts
|> Enum.reduce(model, &(Map.delete(&2, &1)))
|> Map.delete(:__struct__)
end
@doc """
Helper function to add Version record on update and delete.
Inserts the version record.
"""
def prepare_version(changeset, opts \\ []) do
changeset
|> Ecto.Changeset.prepare_changes(fn
%{action: :update} = changeset ->
insert_version(changeset, "update", opts)
%{action: :delete} = changeset ->
insert_version(changeset, "delete", opts)
changeset ->
changeset
end)
end
@doc """
Insert a new version record in the database
"""
def insert_version(changeset, action, opts) do
{whodoneit_id, name} = get_whodoneit_name_and_id(opts)
version_changeset(changeset, whodoneit_id, name, action)
|> changeset.repo.insert!
changeset
end
@doc """
Helper function to return a list of versioned records.
## Options
* `:repo` -- The repo module to be used
* `:full_version` -- When true, returns the complete version record
otherwise return a schema (default)
"""
def versions(schema, opts \\ []) do
repo = opts[:repo] || Application.get_env(:whatwasit, :repo)
full_version = Keyword.get(opts, :full_version, false)
id = schema.id
type = Whatwasit.Utils.item_type schema
Ecto.Query.where(@version_module, [a], a.item_id == ^id and a.item_type == ^type)
|> Ecto.Query.order_by(desc: :id)
|> repo.all
|> Enum.map(fn item ->
cast_version(schema, item, full_version)
end)
end
defp cast_version(schema, item, funn_version \\ false)
defp cast_version(schema, item, false) do
Whatwasit.Utils.cast(schema, item.object)
end
defp cast_version(schema, item, true) do
struct(item, object: cast_version(schema, item))
end
@doc false
def version_changeset(struct, whodoneit_id, name, action) do
version_module = @version_module
model = case struct do
%{data: data} -> data
model -> model
end
type = item_type model
version_module.changeset(version_module.__struct__,
%{
item_type: type ,
item_id: model.id,
object: model,
action: "#{action}",
whodoneit_id: whodoneit_id,
whodoneit_name: name
})
end
@doc false
def item_type(%{} = item), do: item_type(item.__struct__)
def item_type(item) do
Module.split(item)
|> Enum.reverse
|> hd
|> to_string
end
@doc false
def get_whodoneit_name_and_id(opts) do
case Keyword.get(opts, :whodoneit) do
nil ->
{nil, nil}
%{} = user ->
id = Map.get(user, user.__struct__.__schema__(:primary_key) |> hd)
{id, opts[:whodoneit_name]}
end
end
end
| 26.537975
| 85
| 0.645123
|
93a04b7ef1ddc1d393a63058af0a12378d498c2d
| 1,817
|
ex
|
Elixir
|
lib/graphql/type/interface.ex
|
seanabrahams/graphql-elixir
|
568a07da317e19621cc0c931d738b4eda75f0a35
|
[
"BSD-3-Clause"
] | null | null | null |
lib/graphql/type/interface.ex
|
seanabrahams/graphql-elixir
|
568a07da317e19621cc0c931d738b4eda75f0a35
|
[
"BSD-3-Clause"
] | null | null | null |
lib/graphql/type/interface.ex
|
seanabrahams/graphql-elixir
|
568a07da317e19621cc0c931d738b4eda75f0a35
|
[
"BSD-3-Clause"
] | null | null | null |
defmodule GraphQL.Type.Interface do
@type t :: %GraphQL.Type.Interface{
name: binary,
description: binary | nil,
fields: Map.t,
resolver: (any -> GraphQL.Type.ObjectType.t) | nil
}
defstruct name: "", description: "", fields: %{}, resolver: nil
def new(map) do
struct(GraphQL.Type.Interface, map)
end
@doc """
Unlike Union, Interfaces don't explicitly declare what Types implement them,
so we have to iterate over a full typemap and filter the Types in the Schema
down to just those that implement the provided interface.
"""
def possible_types(interface, schema) do
# get the complete typemap from this scheme
GraphQL.Schema.reduce_types(schema)
# filter them down to a list of types that implement this interface
|> Enum.filter(fn {_, typedef} -> GraphQL.Type.implements?(typedef, interface) end)
# then return the type, instead of the {name, type} tuple that comes from
# the reduce_types call
|> Enum.map(fn({_,v}) -> v end)
end
defimpl GraphQL.AbstractType do
@doc """
Returns a boolean indicating if the provided type implements the interface
"""
def possible_type?(interface, object) do
GraphQL.Type.implements?(object, interface)
end
@doc """
Returns the typedef of the provided Object using either the Interface's
resolve function (if it exists), or by iterating over all the typedefs that
implement this Interface and returning the first one that matches against
the Object's isTypeOf function.
"""
def get_object_type(interface, object, schema) do
if interface.resolver do
interface.resolver.(object)
else
GraphQL.Type.Interface.possible_types(interface, schema)
|> Enum.find(fn(x) -> x.isTypeOf.(object) end)
end
end
end
end
| 34.283019
| 87
| 0.691249
|
93a099ea50aa7f101ccb9aa3d7d6df9cf1e9bc77
| 3,282
|
exs
|
Elixir
|
apps/ewallet/test/ewallet/web/v1/serializers/key_serializer_test.exs
|
AndonMitev/EWallet
|
898cde38933d6f134734528b3e594eedf5fa50f3
|
[
"Apache-2.0"
] | 322
|
2018-02-28T07:38:44.000Z
|
2020-05-27T23:09:55.000Z
|
apps/ewallet/test/ewallet/web/v1/serializers/key_serializer_test.exs
|
AndonMitev/EWallet
|
898cde38933d6f134734528b3e594eedf5fa50f3
|
[
"Apache-2.0"
] | 643
|
2018-02-28T12:05:20.000Z
|
2020-05-22T08:34:38.000Z
|
apps/ewallet/test/ewallet/web/v1/serializers/key_serializer_test.exs
|
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 EWallet.Web.V1.KeySerializerTest do
use EWallet.Web.SerializerCase, :v1
alias Ecto.Association.NotLoaded
alias EWallet.Web.Paginator
alias EWallet.Web.V1.KeySerializer
alias Utils.Helpers.DateFormatter
describe "serialize/1" do
test "serializes a key into the correct response format" do
key = insert(:key)
expected = %{
object: "key",
id: key.id,
name: key.name,
access_key: key.access_key,
secret_key: key.secret_key,
account_id: nil,
expired: !key.enabled,
enabled: key.enabled,
global_role: key.global_role,
created_at: DateFormatter.to_iso8601(key.inserted_at),
updated_at: DateFormatter.to_iso8601(key.updated_at),
deleted_at: DateFormatter.to_iso8601(key.deleted_at)
}
assert KeySerializer.serialize(key) == expected
end
test "serializes to nil if the key is not loaded" do
assert KeySerializer.serialize(%NotLoaded{}) == nil
end
test "serializes a key paginator into a list object" do
key1 = insert(:key)
key2 = insert(:key)
paginator = %Paginator{
data: [key1, key2],
pagination: %{
current_page: 1,
per_page: 10,
is_first_page: true,
is_last_page: true
}
}
expected = %{
object: "list",
data: [
%{
object: "key",
id: key1.id,
name: key1.name,
access_key: key1.access_key,
secret_key: key1.secret_key,
account_id: nil,
expired: !key1.enabled,
enabled: key1.enabled,
global_role: key1.global_role,
created_at: DateFormatter.to_iso8601(key1.inserted_at),
updated_at: DateFormatter.to_iso8601(key1.updated_at),
deleted_at: DateFormatter.to_iso8601(key1.deleted_at)
},
%{
object: "key",
id: key2.id,
name: key2.name,
access_key: key2.access_key,
secret_key: key2.secret_key,
account_id: nil,
expired: !key2.enabled,
enabled: key2.enabled,
global_role: key2.global_role,
created_at: DateFormatter.to_iso8601(key2.inserted_at),
updated_at: DateFormatter.to_iso8601(key2.updated_at),
deleted_at: DateFormatter.to_iso8601(key2.deleted_at)
}
],
pagination: %{
current_page: 1,
per_page: 10,
is_first_page: true,
is_last_page: true
}
}
assert KeySerializer.serialize(paginator) == expected
end
end
end
| 30.962264
| 74
| 0.615783
|
93a0ada0495ca2bc17431b09973cb3de79e00ca5
| 1,085
|
ex
|
Elixir
|
lib/empty_web/channels/user_socket.ex
|
manojsamanta/empty-app-with-auth
|
e601a7c6ef1b4a992758117e6bf0922a5ce08f04
|
[
"MIT"
] | null | null | null |
lib/empty_web/channels/user_socket.ex
|
manojsamanta/empty-app-with-auth
|
e601a7c6ef1b4a992758117e6bf0922a5ce08f04
|
[
"MIT"
] | null | null | null |
lib/empty_web/channels/user_socket.ex
|
manojsamanta/empty-app-with-auth
|
e601a7c6ef1b4a992758117e6bf0922a5ce08f04
|
[
"MIT"
] | null | null | null |
defmodule EmptyWeb.UserSocket do
use Phoenix.Socket
## Channels
# channel "room:*", EmptyWeb.RoomChannel
# Socket params are passed from the client and can
# be used to verify and authenticate a user. After
# verification, you can put default assigns into
# the socket that will be set for all channels, ie
#
# {:ok, assign(socket, :user_id, verified_user_id)}
#
# To deny connection, return `:error`.
#
# See `Phoenix.Token` documentation for examples in
# performing token verification on connect.
@impl true
def connect(_params, socket, _connect_info) do
{:ok, socket}
end
# Socket id's are topics that allow you to identify all sockets for a given user:
#
# def id(socket), do: "user_socket:#{socket.assigns.user_id}"
#
# Would allow you to broadcast a "disconnect" event and terminate
# all active sockets and channels for a given user:
#
# EmptyWeb.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{})
#
# Returning `nil` makes this socket anonymous.
@impl true
def id(_socket), do: nil
end
| 30.138889
| 83
| 0.693088
|
93a0f9c6d62fe3fba87d1a3928448871732a4bd3
| 721
|
ex
|
Elixir
|
lib/lv_template_web/gettext.ex
|
ustrajunior/lv_template
|
633c85d8c5810a130bbf24077845dda49e82ca3f
|
[
"MIT"
] | null | null | null |
lib/lv_template_web/gettext.ex
|
ustrajunior/lv_template
|
633c85d8c5810a130bbf24077845dda49e82ca3f
|
[
"MIT"
] | null | null | null |
lib/lv_template_web/gettext.ex
|
ustrajunior/lv_template
|
633c85d8c5810a130bbf24077845dda49e82ca3f
|
[
"MIT"
] | null | null | null |
defmodule LvTemplateWeb.Gettext do
@moduledoc """
A module providing Internationalization with a gettext-based API.
By using [Gettext](https://hexdocs.pm/gettext),
your module gains a set of macros for translations, for example:
import LvTemplateWeb.Gettext
# Simple translation
gettext("Here is the string to translate")
# Plural translation
ngettext("Here is the string to translate",
"Here are the strings to translate",
3)
# Domain-based translation
dgettext("errors", "Here is the error message to translate")
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
"""
use Gettext, otp_app: :lv_template
end
| 28.84
| 72
| 0.682386
|
93a103faa445ee124fccecf6f75e325e09fbb84f
| 802
|
exs
|
Elixir
|
apps/ewallet_db/priv/repo/migrations/20171027151209_add_account_id_to_minted_token_table.exs
|
AndonMitev/EWallet
|
898cde38933d6f134734528b3e594eedf5fa50f3
|
[
"Apache-2.0"
] | 322
|
2018-02-28T07:38:44.000Z
|
2020-05-27T23:09:55.000Z
|
apps/ewallet_db/priv/repo/migrations/20171027151209_add_account_id_to_minted_token_table.exs
|
AndonMitev/EWallet
|
898cde38933d6f134734528b3e594eedf5fa50f3
|
[
"Apache-2.0"
] | 643
|
2018-02-28T12:05:20.000Z
|
2020-05-22T08:34:38.000Z
|
apps/ewallet_db/priv/repo/migrations/20171027151209_add_account_id_to_minted_token_table.exs
|
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.Repo.Migrations.AddAccountIdToMintedTokenTable do
use Ecto.Migration
def change do
alter table(:minted_token) do
add :account_id, references(:account, type: :uuid)
end
end
end
| 33.416667
| 74
| 0.758105
|
93a1098956ba26f267689aad2efc1cb87ca5b778
| 15,121
|
exs
|
Elixir
|
test/depot_test.exs
|
lucacorti/depot
|
2406773bbb3523f0a294bd4c8256a35a1444e60a
|
[
"Apache-2.0"
] | 20
|
2020-06-19T20:38:22.000Z
|
2021-09-14T06:57:32.000Z
|
test/depot_test.exs
|
lucacorti/depot
|
2406773bbb3523f0a294bd4c8256a35a1444e60a
|
[
"Apache-2.0"
] | 15
|
2020-06-22T16:37:10.000Z
|
2021-10-18T22:18:50.000Z
|
test/depot_test.exs
|
LostKobrakai/depot
|
2406773bbb3523f0a294bd4c8256a35a1444e60a
|
[
"Apache-2.0"
] | 5
|
2020-06-21T14:07:44.000Z
|
2021-10-05T16:19:45.000Z
|
defmodule DepotTest do
use ExUnit.Case, async: true
defmacrop assert_in_list(list, match) do
quote do
assert Enum.any?(unquote(list), &match?(unquote(match), &1))
end
end
describe "filesystem without own processes" do
@describetag :tmp_dir
test "user can write to filesystem", %{tmp_dir: prefix} do
filesystem = Depot.Adapter.Local.configure(prefix: prefix)
assert :ok = Depot.write(filesystem, "test.txt", "Hello World")
end
test "user can check if files exist on a filesystem", %{tmp_dir: prefix} do
filesystem = Depot.Adapter.Local.configure(prefix: prefix)
:ok = Depot.write(filesystem, "test.txt", "Hello World")
assert {:ok, :exists} = Depot.file_exists(filesystem, "test.txt")
assert {:ok, :missing} = Depot.file_exists(filesystem, "not-test.txt")
end
test "user can read from filesystem", %{tmp_dir: prefix} do
filesystem = Depot.Adapter.Local.configure(prefix: prefix)
:ok = Depot.write(filesystem, "test.txt", "Hello World")
assert {:ok, "Hello World"} = Depot.read(filesystem, "test.txt")
end
test "user can delete from filesystem", %{tmp_dir: prefix} do
filesystem = Depot.Adapter.Local.configure(prefix: prefix)
:ok = Depot.write(filesystem, "test.txt", "Hello World")
:ok = Depot.delete(filesystem, "test.txt")
assert {:error, _} = Depot.read(filesystem, "test.txt")
end
test "user can move files", %{tmp_dir: prefix} do
filesystem = Depot.Adapter.Local.configure(prefix: prefix)
:ok = Depot.write(filesystem, "test.txt", "Hello World")
:ok = Depot.move(filesystem, "test.txt", "not-test.txt")
assert {:error, _} = Depot.read(filesystem, "test.txt")
assert {:ok, "Hello World"} = Depot.read(filesystem, "not-test.txt")
end
test "user can copy files", %{tmp_dir: prefix} do
filesystem = Depot.Adapter.Local.configure(prefix: prefix)
:ok = Depot.write(filesystem, "test.txt", "Hello World")
:ok = Depot.copy(filesystem, "test.txt", "not-test.txt")
assert {:ok, "Hello World"} = Depot.read(filesystem, "test.txt")
assert {:ok, "Hello World"} = Depot.read(filesystem, "not-test.txt")
end
test "user can list files", %{tmp_dir: prefix} do
filesystem = Depot.Adapter.Local.configure(prefix: prefix)
:ok = Depot.write(filesystem, "test.txt", "Hello World")
:ok = Depot.write(filesystem, "test-1.txt", "Hello World")
{:ok, list} = Depot.list_contents(filesystem, ".")
assert length(list) == 2
assert_in_list list, %Depot.Stat.File{name: "test.txt"}
assert_in_list list, %Depot.Stat.File{name: "test-1.txt"}
end
end
describe "module based filesystem without own processes" do
@describetag :tmp_dir
test "user can write to filesystem", %{tmp_dir: prefix} do
defmodule Local.WriteTest do
use Depot.Filesystem,
adapter: Depot.Adapter.Local,
prefix: prefix
end
assert :ok = Local.WriteTest.write("test.txt", "Hello World")
end
test "user can check if files exist on a filesystem", %{tmp_dir: prefix} do
defmodule Local.FileExistsTest do
use Depot.Filesystem,
adapter: Depot.Adapter.Local,
prefix: prefix
end
:ok = Local.FileExistsTest.write("test.txt", "Hello World")
assert {:ok, :exists} = Local.FileExistsTest.file_exists("test.txt")
assert {:ok, :missing} = Local.FileExistsTest.file_exists("not-test.txt")
end
test "user can read from filesystem", %{tmp_dir: prefix} do
defmodule Local.ReadTest do
use Depot.Filesystem,
adapter: Depot.Adapter.Local,
prefix: prefix
end
:ok = Local.ReadTest.write("test.txt", "Hello World")
assert {:ok, "Hello World"} = Local.ReadTest.read("test.txt")
end
test "user can delete from filesystem", %{tmp_dir: prefix} do
defmodule Local.DeleteTest do
use Depot.Filesystem,
adapter: Depot.Adapter.Local,
prefix: prefix
end
:ok = Local.DeleteTest.write("test.txt", "Hello World")
:ok = Local.DeleteTest.delete("test.txt")
assert {:error, _} = Local.DeleteTest.read("test.txt")
end
test "user can move files", %{tmp_dir: prefix} do
defmodule Local.MoveTest do
use Depot.Filesystem,
adapter: Depot.Adapter.Local,
prefix: prefix
end
:ok = Local.MoveTest.write("test.txt", "Hello World")
:ok = Local.MoveTest.move("test.txt", "not-test.txt")
assert {:error, _} = Local.MoveTest.read("test.txt")
assert {:ok, "Hello World"} = Local.MoveTest.read("not-test.txt")
end
test "user can copy files", %{tmp_dir: prefix} do
defmodule Local.CopyTest do
use Depot.Filesystem,
adapter: Depot.Adapter.Local,
prefix: prefix
end
:ok = Local.CopyTest.write("test.txt", "Hello World")
:ok = Local.CopyTest.copy("test.txt", "not-test.txt")
assert {:ok, "Hello World"} = Local.CopyTest.read("test.txt")
assert {:ok, "Hello World"} = Local.CopyTest.read("not-test.txt")
end
test "user can list files", %{tmp_dir: prefix} do
defmodule Local.ListContentsTest do
use Depot.Filesystem,
adapter: Depot.Adapter.Local,
prefix: prefix
end
:ok = Local.ListContentsTest.write("test.txt", "Hello World")
:ok = Local.ListContentsTest.write("test-1.txt", "Hello World")
{:ok, list} = Local.ListContentsTest.list_contents(".")
assert length(list) == 2
assert_in_list list, %Depot.Stat.File{name: "test.txt"}
assert_in_list list, %Depot.Stat.File{name: "test-1.txt"}
end
end
describe "filesystem with own processes" do
test "user can write to filesystem" do
filesystem = Depot.Adapter.InMemory.configure(name: InMemoryTest)
start_supervised(filesystem)
assert :ok = Depot.write(filesystem, "test.txt", "Hello World")
end
test "user can check if files exist on a filesystem" do
filesystem = Depot.Adapter.InMemory.configure(name: InMemoryTest)
start_supervised(filesystem)
:ok = Depot.write(filesystem, "test.txt", "Hello World")
assert {:ok, :exists} = Depot.file_exists(filesystem, "test.txt")
assert {:ok, :missing} = Depot.file_exists(filesystem, "not-test.txt")
end
test "user can read from filesystem" do
filesystem = Depot.Adapter.InMemory.configure(name: InMemoryTest)
start_supervised(filesystem)
:ok = Depot.write(filesystem, "test.txt", "Hello World")
assert {:ok, "Hello World"} = Depot.read(filesystem, "test.txt")
end
test "user can delete from filesystem" do
filesystem = Depot.Adapter.InMemory.configure(name: InMemoryTest)
start_supervised(filesystem)
:ok = Depot.write(filesystem, "test.txt", "Hello World")
:ok = Depot.delete(filesystem, "test.txt")
assert {:error, _} = Depot.read(filesystem, "test.txt")
end
test "user can move files" do
filesystem = Depot.Adapter.InMemory.configure(name: InMemoryTest)
start_supervised(filesystem)
:ok = Depot.write(filesystem, "test.txt", "Hello World")
:ok = Depot.move(filesystem, "test.txt", "not-test.txt")
assert {:error, _} = Depot.read(filesystem, "test.txt")
assert {:ok, "Hello World"} = Depot.read(filesystem, "not-test.txt")
end
test "user can copy files" do
filesystem = Depot.Adapter.InMemory.configure(name: InMemoryTest)
start_supervised(filesystem)
:ok = Depot.write(filesystem, "test.txt", "Hello World")
:ok = Depot.copy(filesystem, "test.txt", "not-test.txt")
assert {:ok, "Hello World"} = Depot.read(filesystem, "test.txt")
assert {:ok, "Hello World"} = Depot.read(filesystem, "not-test.txt")
end
test "user can list files" do
filesystem = Depot.Adapter.InMemory.configure(name: InMemoryTest)
start_supervised(filesystem)
:ok = Depot.write(filesystem, "test.txt", "Hello World")
:ok = Depot.write(filesystem, "test-1.txt", "Hello World")
{:ok, list} = Depot.list_contents(filesystem, ".")
assert length(list) == 2
assert_in_list list, %Depot.Stat.File{name: "test.txt"}
assert_in_list list, %Depot.Stat.File{name: "test-1.txt"}
end
end
describe "module based filesystem with own processes" do
test "user can write to filesystem" do
defmodule InMemory.WriteTest do
use Depot.Filesystem,
adapter: Depot.Adapter.InMemory
end
start_supervised(InMemory.WriteTest)
assert :ok = InMemory.WriteTest.write("test.txt", "Hello World")
end
test "user can check if files exist on a filesystem" do
defmodule InMemory.FileExistsTest do
use Depot.Filesystem,
adapter: Depot.Adapter.InMemory
end
start_supervised(InMemory.FileExistsTest)
:ok = InMemory.FileExistsTest.write("test.txt", "Hello World")
assert {:ok, :exists} = InMemory.FileExistsTest.file_exists("test.txt")
assert {:ok, :missing} = InMemory.FileExistsTest.file_exists("not-test.txt")
end
test "user can read from filesystem" do
defmodule InMemory.ReadTest do
use Depot.Filesystem,
adapter: Depot.Adapter.InMemory
end
start_supervised(InMemory.ReadTest)
:ok = InMemory.ReadTest.write("test.txt", "Hello World")
assert {:ok, "Hello World"} = InMemory.ReadTest.read("test.txt")
end
test "user can delete from filesystem" do
defmodule InMemory.DeleteTest do
use Depot.Filesystem,
adapter: Depot.Adapter.InMemory
end
start_supervised(InMemory.DeleteTest)
:ok = InMemory.DeleteTest.write("test.txt", "Hello World")
:ok = InMemory.DeleteTest.delete("test.txt")
assert {:error, _} = InMemory.DeleteTest.read("test.txt")
end
test "user can move files" do
defmodule InMemory.MoveTest do
use Depot.Filesystem,
adapter: Depot.Adapter.InMemory
end
start_supervised(InMemory.MoveTest)
:ok = InMemory.MoveTest.write("test.txt", "Hello World")
:ok = InMemory.MoveTest.move("test.txt", "not-test.txt")
assert {:error, _} = InMemory.MoveTest.read("test.txt")
assert {:ok, "Hello World"} = InMemory.MoveTest.read("not-test.txt")
end
test "user can copy files" do
defmodule InMemory.CopyTest do
use Depot.Filesystem,
adapter: Depot.Adapter.InMemory
end
start_supervised(InMemory.CopyTest)
:ok = InMemory.CopyTest.write("test.txt", "Hello World")
:ok = InMemory.CopyTest.copy("test.txt", "not-test.txt")
assert {:ok, "Hello World"} = InMemory.CopyTest.read("test.txt")
assert {:ok, "Hello World"} = InMemory.CopyTest.read("not-test.txt")
end
test "user can list files" do
defmodule InMemory.ListContentsTest do
use Depot.Filesystem,
adapter: Depot.Adapter.InMemory
end
start_supervised(InMemory.ListContentsTest)
:ok = InMemory.ListContentsTest.write("test.txt", "Hello World")
:ok = InMemory.ListContentsTest.write("test-1.txt", "Hello World")
{:ok, list} = InMemory.ListContentsTest.list_contents(".")
assert length(list) == 2
assert_in_list list, %Depot.Stat.File{name: "test.txt"}
assert_in_list list, %Depot.Stat.File{name: "test-1.txt"}
end
end
describe "filesystem independant" do
@describetag :tmp_dir
setup %{tmp_dir: prefix} do
filesystem = Depot.Adapter.Local.configure(prefix: prefix)
{:ok, filesystem: filesystem}
end
test "reads configuration from :otp_app", context do
configuration = [
adapter: Depot.Adapter.Local,
prefix: "ziKK7t5LzV5XiJjYh30KxCLorRXqLwwEnZYJ"
]
Application.put_env(:depot_test, DepotTest.AdhocFilesystem, configuration)
defmodule AdhocFilesystem do
use Depot.Filesystem, otp_app: :depot_test
end
{_module, module_config} = DepotTest.AdhocFilesystem.__filesystem__()
assert module_config.prefix == "ziKK7t5LzV5XiJjYh30KxCLorRXqLwwEnZYJ"
end
test "directory traversals are detected and reported", %{filesystem: filesystem} do
{:error, {:path, :traversal}} = Depot.write(filesystem, "../test.txt", "Hello World")
{:error, {:path, :traversal}} = Depot.read(filesystem, "../test.txt")
{:error, {:path, :traversal}} = Depot.delete(filesystem, "../test.txt")
{:error, {:path, :traversal}} = Depot.list_contents(filesystem, "../test")
end
test "relative paths are required", %{filesystem: filesystem} do
{:error, {:path, :absolute}} = Depot.write(filesystem, "/../test.txt", "Hello World")
{:error, {:path, :absolute}} = Depot.read(filesystem, "/../test.txt")
{:error, {:path, :absolute}} = Depot.delete(filesystem, "/../test.txt")
{:error, {:path, :absolute}} = Depot.list_contents(filesystem, "/../test")
end
end
describe "copying between different filesystems" do
@describetag :tmp_dir
setup %{tmp_dir: prefix} do
prefix_a = Path.join(prefix, "a")
prefix_b = Path.join(prefix, "b")
{:ok, prefixes: [prefix_a, prefix_b]}
end
test "direct copy - same adapter", %{prefixes: [prefix_a, prefix_b]} do
filesystem_a = Depot.Adapter.Local.configure(prefix: prefix_a)
filesystem_b = Depot.Adapter.Local.configure(prefix: prefix_b)
:ok = Depot.write(filesystem_a, "test.txt", "Hello World")
assert :ok =
Depot.copy_between_filesystem(
{filesystem_a, "test.txt"},
{filesystem_b, "test.txt"}
)
assert {:ok, :exists} = Depot.file_exists(filesystem_b, "test.txt")
end
test "indirect copy - same adapter" do
filesystem_a = Depot.Adapter.InMemory.configure(name: InMemoryTest.A)
filesystem_b = Depot.Adapter.InMemory.configure(name: InMemoryTest.B)
filesystem_a |> Supervisor.child_spec(id: :a) |> start_supervised()
filesystem_b |> Supervisor.child_spec(id: :b) |> start_supervised()
:ok = Depot.write(filesystem_a, "test.txt", "Hello World")
assert :ok =
Depot.copy_between_filesystem(
{filesystem_a, "test.txt"},
{filesystem_b, "test.txt"}
)
assert {:ok, :exists} = Depot.file_exists(filesystem_b, "test.txt")
end
test "different adapter", %{prefixes: [prefix_a | _]} do
filesystem_a = Depot.Adapter.Local.configure(prefix: prefix_a)
filesystem_b = Depot.Adapter.InMemory.configure(name: InMemoryTest.B)
start_supervised(filesystem_b)
:ok = Depot.write(filesystem_a, "test.txt", "Hello World")
assert :ok =
Depot.copy_between_filesystem(
{filesystem_a, "test.txt"},
{filesystem_b, "test.txt"}
)
assert {:ok, :exists} = Depot.file_exists(filesystem_b, "test.txt")
end
end
end
| 32.871739
| 91
| 0.642418
|
93a10e8067f55479b1b799a7c636171a36fbc200
| 1,864
|
ex
|
Elixir
|
test/support/conn_case.ex
|
manojsamanta/empty-app-with-auth
|
e601a7c6ef1b4a992758117e6bf0922a5ce08f04
|
[
"MIT"
] | null | null | null |
test/support/conn_case.ex
|
manojsamanta/empty-app-with-auth
|
e601a7c6ef1b4a992758117e6bf0922a5ce08f04
|
[
"MIT"
] | null | null | null |
test/support/conn_case.ex
|
manojsamanta/empty-app-with-auth
|
e601a7c6ef1b4a992758117e6bf0922a5ce08f04
|
[
"MIT"
] | null | null | null |
defmodule EmptyWeb.ConnCase do
@moduledoc """
This module defines the test case to be used by
tests that require setting up a connection.
Such tests rely on `Phoenix.ConnTest` and also
import other functionality to make it easier
to build common data structures and query the data layer.
Finally, if the test case interacts with the database,
we enable the SQL sandbox, so changes done to the database
are reverted at the end of every test. If you are using
PostgreSQL, you can even run database tests asynchronously
by setting `use EmptyWeb.ConnCase, async: true`, although
this option is not recommended for other databases.
"""
use ExUnit.CaseTemplate
using do
quote do
# Import conveniences for testing with connections
import Plug.Conn
import Phoenix.ConnTest
import EmptyWeb.ConnCase
alias EmptyWeb.Router.Helpers, as: Routes
# The default endpoint for testing
@endpoint EmptyWeb.Endpoint
end
end
setup tags do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Empty.Repo)
unless tags[:async] do
Ecto.Adapters.SQL.Sandbox.mode(Empty.Repo, {:shared, self()})
end
{:ok, conn: Phoenix.ConnTest.build_conn()}
end
@doc """
Setup helper that registers and logs in users.
setup :register_and_log_in_user
It stores an updated connection and a registered user in the
test context.
"""
def register_and_log_in_user(%{conn: conn}) do
user = Empty.AccountsFixtures.user_fixture()
%{conn: log_in_user(conn, user), user: user}
end
@doc """
Logs the given `user` into the `conn`.
It returns an updated `conn`.
"""
def log_in_user(conn, user) do
token = Empty.Accounts.generate_user_session_token(user)
conn
|> Phoenix.ConnTest.init_test_session(%{})
|> Plug.Conn.put_session(:user_token, token)
end
end
| 26.628571
| 67
| 0.709227
|
93a1255696186f7cf2edea86be383a30837ed3ce
| 14,213
|
ex
|
Elixir
|
clients/dfa_reporting/lib/google_api/dfa_reporting/v34/model/ad.ex
|
MasashiYokota/elixir-google-api
|
975dccbff395c16afcb62e7a8e411fbb58e9ab01
|
[
"Apache-2.0"
] | null | null | null |
clients/dfa_reporting/lib/google_api/dfa_reporting/v34/model/ad.ex
|
MasashiYokota/elixir-google-api
|
975dccbff395c16afcb62e7a8e411fbb58e9ab01
|
[
"Apache-2.0"
] | 1
|
2020-12-18T09:25:12.000Z
|
2020-12-18T09:25:12.000Z
|
clients/dfa_reporting/lib/google_api/dfa_reporting/v34/model/ad.ex
|
MasashiYokota/elixir-google-api
|
975dccbff395c16afcb62e7a8e411fbb58e9ab01
|
[
"Apache-2.0"
] | 1
|
2020-10-04T10:12:44.000Z
|
2020-10-04T10:12:44.000Z
|
# 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.DFAReporting.V34.Model.Ad do
@moduledoc """
Contains properties of a Campaign Manager ad.
## Attributes
* `defaultClickThroughEventTagProperties` (*type:* `GoogleApi.DFAReporting.V34.Model.DefaultClickThroughEventTagProperties.t`, *default:* `nil`) - Default click-through event tag properties for this ad.
* `advertiserId` (*type:* `String.t`, *default:* `nil`) - Advertiser ID of this ad. This is a required field on insertion.
* `size` (*type:* `GoogleApi.DFAReporting.V34.Model.Size.t`, *default:* `nil`) - Size of this ad. Applicable when type is AD_SERVING_DEFAULT_AD.
* `subaccountId` (*type:* `String.t`, *default:* `nil`) - Subaccount ID of this ad. This is a read-only field that can be left blank.
* `lastModifiedInfo` (*type:* `GoogleApi.DFAReporting.V34.Model.LastModifiedInfo.t`, *default:* `nil`) - Information about the most recent modification of this ad. This is a read-only field.
* `accountId` (*type:* `String.t`, *default:* `nil`) - Account ID of this ad. This is a read-only field that can be left blank.
* `languageTargeting` (*type:* `GoogleApi.DFAReporting.V34.Model.LanguageTargeting.t`, *default:* `nil`) - Language targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD.
* `startTime` (*type:* `DateTime.t`, *default:* `nil`) -
* `advertiserIdDimensionValue` (*type:* `GoogleApi.DFAReporting.V34.Model.DimensionValue.t`, *default:* `nil`) - Dimension value for the ID of the advertiser. This is a read-only, auto-generated field.
* `deliverySchedule` (*type:* `GoogleApi.DFAReporting.V34.Model.DeliverySchedule.t`, *default:* `nil`) - Delivery schedule information for this ad. Applicable when type is AD_SERVING_STANDARD_AD or AD_SERVING_TRACKING. This field along with subfields priority and impressionRatio are required on insertion when type is AD_SERVING_STANDARD_AD.
* `audienceSegmentId` (*type:* `String.t`, *default:* `nil`) - Audience segment ID that is being targeted for this ad. Applicable when type is AD_SERVING_STANDARD_AD.
* `creativeRotation` (*type:* `GoogleApi.DFAReporting.V34.Model.CreativeRotation.t`, *default:* `nil`) - Creative rotation for this ad. Applicable when type is AD_SERVING_DEFAULT_AD, AD_SERVING_STANDARD_AD, or AD_SERVING_TRACKING. When type is AD_SERVING_DEFAULT_AD, this field should have exactly one creativeAssignment .
* `createInfo` (*type:* `GoogleApi.DFAReporting.V34.Model.LastModifiedInfo.t`, *default:* `nil`) - Information about the creation of this ad. This is a read-only field.
* `kind` (*type:* `String.t`, *default:* `nil`) - Identifies what kind of resource this is. Value: the fixed string "dfareporting#ad".
* `eventTagOverrides` (*type:* `list(GoogleApi.DFAReporting.V34.Model.EventTagOverride.t)`, *default:* `nil`) - Event tag overrides for this ad.
* `keyValueTargetingExpression` (*type:* `GoogleApi.DFAReporting.V34.Model.KeyValueTargetingExpression.t`, *default:* `nil`) - Key-value targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD.
* `campaignId` (*type:* `String.t`, *default:* `nil`) - Campaign ID of this ad. This is a required field on insertion.
* `geoTargeting` (*type:* `GoogleApi.DFAReporting.V34.Model.GeoTargeting.t`, *default:* `nil`) - Geographical targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD.
* `name` (*type:* `String.t`, *default:* `nil`) - Name of this ad. This is a required field and must be less than 256 characters long.
* `campaignIdDimensionValue` (*type:* `GoogleApi.DFAReporting.V34.Model.DimensionValue.t`, *default:* `nil`) - Dimension value for the ID of the campaign. This is a read-only, auto-generated field.
* `dayPartTargeting` (*type:* `GoogleApi.DFAReporting.V34.Model.DayPartTargeting.t`, *default:* `nil`) - Time and day targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD.
* `comments` (*type:* `String.t`, *default:* `nil`) - Comments for this ad.
* `clickThroughUrlSuffixProperties` (*type:* `GoogleApi.DFAReporting.V34.Model.ClickThroughUrlSuffixProperties.t`, *default:* `nil`) - Click-through URL suffix properties for this ad. Applies to the URL in the ad or (if overriding ad properties) the URL in the creative.
* `archived` (*type:* `boolean()`, *default:* `nil`) - Whether this ad is archived. When true, active must be false.
* `idDimensionValue` (*type:* `GoogleApi.DFAReporting.V34.Model.DimensionValue.t`, *default:* `nil`) - Dimension value for the ID of this ad. This is a read-only, auto-generated field.
* `endTime` (*type:* `DateTime.t`, *default:* `nil`) -
* `type` (*type:* `String.t`, *default:* `nil`) - Type of ad. This is a required field on insertion. Note that default ads ( AD_SERVING_DEFAULT_AD) cannot be created directly (see Creative resource).
* `dynamicClickTracker` (*type:* `boolean()`, *default:* `nil`) - Whether this ad is a dynamic click tracker. Applicable when type is AD_SERVING_CLICK_TRACKER. This is a required field on insert, and is read-only after insert.
* `active` (*type:* `boolean()`, *default:* `nil`) - Whether this ad is active. When true, archived must be false.
* `compatibility` (*type:* `String.t`, *default:* `nil`) - Compatibility of this ad. Applicable when type is AD_SERVING_DEFAULT_AD. DISPLAY and DISPLAY_INTERSTITIAL refer to either rendering on desktop or on mobile devices or in mobile apps for regular or interstitial ads, respectively. APP and APP_INTERSTITIAL are only used for existing default ads. New mobile placements must be assigned DISPLAY or DISPLAY_INTERSTITIAL and default ads created for those placements will be limited to those compatibility types. IN_STREAM_VIDEO refers to rendering in-stream video ads developed with the VAST standard.
* `id` (*type:* `String.t`, *default:* `nil`) - ID of this ad. This is a read-only, auto-generated field.
* `technologyTargeting` (*type:* `GoogleApi.DFAReporting.V34.Model.TechnologyTargeting.t`, *default:* `nil`) - Technology platform targeting information for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD.
* `creativeGroupAssignments` (*type:* `list(GoogleApi.DFAReporting.V34.Model.CreativeGroupAssignment.t)`, *default:* `nil`) - Creative group assignments for this ad. Applicable when type is AD_SERVING_CLICK_TRACKER. Only one assignment per creative group number is allowed for a maximum of two assignments.
* `sslRequired` (*type:* `boolean()`, *default:* `nil`) - Whether this ad requires ssl. This is a read-only field that is auto-generated when the ad is inserted or updated.
* `sslCompliant` (*type:* `boolean()`, *default:* `nil`) - Whether this ad is ssl compliant. This is a read-only field that is auto-generated when the ad is inserted or updated.
* `remarketingListExpression` (*type:* `GoogleApi.DFAReporting.V34.Model.ListTargetingExpression.t`, *default:* `nil`) - Remarketing list targeting expression for this ad. This field must be left blank if the ad is using a targeting template. Applicable when type is AD_SERVING_STANDARD_AD.
* `targetingTemplateId` (*type:* `String.t`, *default:* `nil`) - Targeting template ID, used to apply preconfigured targeting information to this ad. This cannot be set while any of dayPartTargeting, geoTargeting, keyValueTargetingExpression, languageTargeting, remarketingListExpression, or technologyTargeting are set. Applicable when type is AD_SERVING_STANDARD_AD.
* `clickThroughUrl` (*type:* `GoogleApi.DFAReporting.V34.Model.ClickThroughUrl.t`, *default:* `nil`) - Click-through URL for this ad. This is a required field on insertion. Applicable when type is AD_SERVING_CLICK_TRACKER.
* `placementAssignments` (*type:* `list(GoogleApi.DFAReporting.V34.Model.PlacementAssignment.t)`, *default:* `nil`) - Placement assignments for this ad.
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:defaultClickThroughEventTagProperties =>
GoogleApi.DFAReporting.V34.Model.DefaultClickThroughEventTagProperties.t(),
:advertiserId => String.t(),
:size => GoogleApi.DFAReporting.V34.Model.Size.t(),
:subaccountId => String.t(),
:lastModifiedInfo => GoogleApi.DFAReporting.V34.Model.LastModifiedInfo.t(),
:accountId => String.t(),
:languageTargeting => GoogleApi.DFAReporting.V34.Model.LanguageTargeting.t(),
:startTime => DateTime.t(),
:advertiserIdDimensionValue => GoogleApi.DFAReporting.V34.Model.DimensionValue.t(),
:deliverySchedule => GoogleApi.DFAReporting.V34.Model.DeliverySchedule.t(),
:audienceSegmentId => String.t(),
:creativeRotation => GoogleApi.DFAReporting.V34.Model.CreativeRotation.t(),
:createInfo => GoogleApi.DFAReporting.V34.Model.LastModifiedInfo.t(),
:kind => String.t(),
:eventTagOverrides => list(GoogleApi.DFAReporting.V34.Model.EventTagOverride.t()),
:keyValueTargetingExpression =>
GoogleApi.DFAReporting.V34.Model.KeyValueTargetingExpression.t(),
:campaignId => String.t(),
:geoTargeting => GoogleApi.DFAReporting.V34.Model.GeoTargeting.t(),
:name => String.t(),
:campaignIdDimensionValue => GoogleApi.DFAReporting.V34.Model.DimensionValue.t(),
:dayPartTargeting => GoogleApi.DFAReporting.V34.Model.DayPartTargeting.t(),
:comments => String.t(),
:clickThroughUrlSuffixProperties =>
GoogleApi.DFAReporting.V34.Model.ClickThroughUrlSuffixProperties.t(),
:archived => boolean(),
:idDimensionValue => GoogleApi.DFAReporting.V34.Model.DimensionValue.t(),
:endTime => DateTime.t(),
:type => String.t(),
:dynamicClickTracker => boolean(),
:active => boolean(),
:compatibility => String.t(),
:id => String.t(),
:technologyTargeting => GoogleApi.DFAReporting.V34.Model.TechnologyTargeting.t(),
:creativeGroupAssignments =>
list(GoogleApi.DFAReporting.V34.Model.CreativeGroupAssignment.t()),
:sslRequired => boolean(),
:sslCompliant => boolean(),
:remarketingListExpression =>
GoogleApi.DFAReporting.V34.Model.ListTargetingExpression.t(),
:targetingTemplateId => String.t(),
:clickThroughUrl => GoogleApi.DFAReporting.V34.Model.ClickThroughUrl.t(),
:placementAssignments => list(GoogleApi.DFAReporting.V34.Model.PlacementAssignment.t())
}
field(:defaultClickThroughEventTagProperties,
as: GoogleApi.DFAReporting.V34.Model.DefaultClickThroughEventTagProperties
)
field(:advertiserId)
field(:size, as: GoogleApi.DFAReporting.V34.Model.Size)
field(:subaccountId)
field(:lastModifiedInfo, as: GoogleApi.DFAReporting.V34.Model.LastModifiedInfo)
field(:accountId)
field(:languageTargeting, as: GoogleApi.DFAReporting.V34.Model.LanguageTargeting)
field(:startTime, as: DateTime)
field(:advertiserIdDimensionValue, as: GoogleApi.DFAReporting.V34.Model.DimensionValue)
field(:deliverySchedule, as: GoogleApi.DFAReporting.V34.Model.DeliverySchedule)
field(:audienceSegmentId)
field(:creativeRotation, as: GoogleApi.DFAReporting.V34.Model.CreativeRotation)
field(:createInfo, as: GoogleApi.DFAReporting.V34.Model.LastModifiedInfo)
field(:kind)
field(:eventTagOverrides, as: GoogleApi.DFAReporting.V34.Model.EventTagOverride, type: :list)
field(:keyValueTargetingExpression,
as: GoogleApi.DFAReporting.V34.Model.KeyValueTargetingExpression
)
field(:campaignId)
field(:geoTargeting, as: GoogleApi.DFAReporting.V34.Model.GeoTargeting)
field(:name)
field(:campaignIdDimensionValue, as: GoogleApi.DFAReporting.V34.Model.DimensionValue)
field(:dayPartTargeting, as: GoogleApi.DFAReporting.V34.Model.DayPartTargeting)
field(:comments)
field(:clickThroughUrlSuffixProperties,
as: GoogleApi.DFAReporting.V34.Model.ClickThroughUrlSuffixProperties
)
field(:archived)
field(:idDimensionValue, as: GoogleApi.DFAReporting.V34.Model.DimensionValue)
field(:endTime, as: DateTime)
field(:type)
field(:dynamicClickTracker)
field(:active)
field(:compatibility)
field(:id)
field(:technologyTargeting, as: GoogleApi.DFAReporting.V34.Model.TechnologyTargeting)
field(:creativeGroupAssignments,
as: GoogleApi.DFAReporting.V34.Model.CreativeGroupAssignment,
type: :list
)
field(:sslRequired)
field(:sslCompliant)
field(:remarketingListExpression, as: GoogleApi.DFAReporting.V34.Model.ListTargetingExpression)
field(:targetingTemplateId)
field(:clickThroughUrl, as: GoogleApi.DFAReporting.V34.Model.ClickThroughUrl)
field(:placementAssignments,
as: GoogleApi.DFAReporting.V34.Model.PlacementAssignment,
type: :list
)
end
defimpl Poison.Decoder, for: GoogleApi.DFAReporting.V34.Model.Ad do
def decode(value, options) do
GoogleApi.DFAReporting.V34.Model.Ad.decode(value, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.DFAReporting.V34.Model.Ad do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 76.413978
| 608
| 0.735242
|
93a176ead266f9b72fd823f9486daf9a3fe1dc4a
| 2,348
|
ex
|
Elixir
|
lib/std_json_io.ex
|
AirX-Inc/std_json_io
|
8f189628385240c4386d3086be542e4a89e850fb
|
[
"MIT"
] | 1
|
2021-01-19T04:55:37.000Z
|
2021-01-19T04:55:37.000Z
|
lib/std_json_io.ex
|
cavagrill/std_json_io
|
b7dcc61152febca040b54a68ea93fccd606a5b68
|
[
"MIT"
] | null | null | null |
lib/std_json_io.ex
|
cavagrill/std_json_io
|
b7dcc61152febca040b54a68ea93fccd606a5b68
|
[
"MIT"
] | null | null | null |
defmodule StdJsonIo do
defmacro __using__(opts) do
otp_app = Keyword.get(opts, :otp_app)
if !otp_app do
raise "StdJsonIo requires an otp_app"
end
quote do
use Supervisor
@pool_name Module.concat(__MODULE__, Pool)
@options Keyword.merge(unquote(opts), (Application.get_env(unquote(otp_app), __MODULE__) || []))
def start_link(opts \\ []) do
Supervisor.start_link(__MODULE__, :ok, name: __MODULE__)
end
def init(:ok) do
pool_options = [
name: {:local, @pool_name},
worker_module: StdJsonIo.Worker,
size: Keyword.get(@options, :pool_size, 5),
max_overflow: Keyword.get(@options, :max_overflow, 10)
]
script = Keyword.get(@options, :script)
children = [:poolboy.child_spec(@pool_name, pool_options, [script: script])]
files = Keyword.get(@options, :watch_files)
if files && length(files) > 0 do
Application.ensure_started(:fs, :permanent)
reloader_spec = worker(
StdJsonIo.Reloader,
[__MODULE__, Enum.map(files, &Path.expand/1)],
[]
)
children = [reloader_spec | children]
end
supervise(children, strategy: :one_for_one, name: __MODULE__)
end
def restart_io_workers! do
case Process.whereis(@pool_name) do
nil ->
Supervisor.restart_child(__MODULE__, @pool_name)
_pid ->
Supervisor.terminate_child(__MODULE__, @pool_name)
Supervisor.restart_child(__MODULE__, @pool_name)
end
end
def json_call!(map, timeout \\ 10000) do
case json_call(map, timeout) do
{:ok, data} -> data
{:error, reason } -> raise "Failed to call to json service #{__MODULE__} #{to_string(reason)}"
end
end
def json_call(map, timeout \\ 10000) do
result = :poolboy.transaction(@pool_name, fn worker ->
GenServer.call(worker, {:json, map}, timeout)
end)
case result do
{:ok, json} ->
{:ok, data} = Poison.decode(json)
if data["error"] do
{:error, Map.get(data, "error")}
else
{:ok, data}
end
other -> other
end
end
end
end
end
| 27.623529
| 104
| 0.566865
|
93a1eb021aac9093a4a3a23d6e6b2a5c0ad1df77
| 3,627
|
exs
|
Elixir
|
server/test/realtime/replication_poller_test.exs
|
Omneedia/realtime
|
90a72170aa1502e211c9f5cbf638c60add6faaf6
|
[
"Apache-2.0"
] | null | null | null |
server/test/realtime/replication_poller_test.exs
|
Omneedia/realtime
|
90a72170aa1502e211c9f5cbf638c60add6faaf6
|
[
"Apache-2.0"
] | null | null | null |
server/test/realtime/replication_poller_test.exs
|
Omneedia/realtime
|
90a72170aa1502e211c9f5cbf638c60add6faaf6
|
[
"Apache-2.0"
] | null | null | null |
defmodule Realtime.ReplicationPollerTest do
use ExUnit.Case
import Realtime.RLS.ReplicationPoller, only: [generate_record: 1]
alias Realtime.Adapters.Changes.{
DeletedRecord,
NewRecord,
UpdatedRecord
}
@columns [
%{"name" => "id", "type" => "int8"},
%{"name" => "details", "type" => "text"},
%{"name" => "user_id", "type" => "int8"}
]
@ts "2021-11-05T17:20:51.52406+00:00"
test "generate_record/1, INSERT" do
record = [
{"wal",
%{
"columns" => @columns,
"commit_timestamp" => @ts,
"record" => %{"details" => "test", "id" => 12, "user_id" => 1},
"schema" => "public",
"table" => "todos",
"type" => "INSERT"
}},
{"is_rls_enabled", false},
{"users", ["some_user_id"]},
{"errors", []}
]
expected = %NewRecord{
columns: @columns,
commit_timestamp: @ts,
is_rls_enabled: false,
schema: "public",
table: "todos",
type: "INSERT",
users: MapSet.new(["some_user_id"]),
record: %{"details" => "test", "id" => 12, "user_id" => 1},
errors: nil
}
assert expected == generate_record(record)
end
test "generate_record/1, INSERT, errors present" do
record = [
{"wal",
%{
"columns" => @columns,
"commit_timestamp" => @ts,
"record" => %{"details" => "test", "id" => 12, "user_id" => 1},
"schema" => "public",
"table" => "todos",
"type" => "INSERT"
}},
{"is_rls_enabled", false},
{"users", ["some_user_id"]},
{"errors", ["Error 413: Payload Too Large"]}
]
expected = %NewRecord{
columns: @columns,
commit_timestamp: @ts,
is_rls_enabled: false,
schema: "public",
table: "todos",
type: "INSERT",
users: MapSet.new(["some_user_id"]),
record: %{"details" => "test", "id" => 12, "user_id" => 1},
errors: ["Error 413: Payload Too Large"]
}
assert expected == generate_record(record)
end
test "generate_record/1, UPDATE" do
record = [
{"wal",
%{
"columns" => @columns,
"commit_timestamp" => @ts,
"old_record" => %{"id" => 12},
"record" => %{"details" => "test1", "id" => 12, "user_id" => 1},
"schema" => "public",
"table" => "todos",
"type" => "UPDATE"
}},
{"is_rls_enabled", false},
{"users", ["some_user_id"]},
{"errors", []}
]
expected = %UpdatedRecord{
columns: @columns,
commit_timestamp: @ts,
is_rls_enabled: false,
schema: "public",
table: "todos",
type: "UPDATE",
users: MapSet.new(["some_user_id"]),
old_record: %{"id" => 12},
record: %{"details" => "test1", "id" => 12, "user_id" => 1},
errors: nil
}
assert expected == generate_record(record)
end
test "generate_record/1, DELETE" do
record = [
{"wal",
%{
"columns" => @columns,
"commit_timestamp" => @ts,
"old_record" => %{"id" => 15},
"schema" => "public",
"table" => "todos",
"type" => "DELETE"
}},
{"is_rls_enabled", false},
{"users", ["some_user_id"]},
{"errors", []}
]
expected = %DeletedRecord{
columns: @columns,
commit_timestamp: @ts,
is_rls_enabled: false,
schema: "public",
table: "todos",
type: "DELETE",
users: MapSet.new(["some_user_id"]),
old_record: %{"id" => 15},
errors: nil
}
assert expected == generate_record(record)
end
end
| 24.842466
| 73
| 0.501241
|
93a1f18b3c3871bed49ee03c1d8f90704fb0021c
| 208
|
ex
|
Elixir
|
api/lib/grook/web/views/member_view.ex
|
ukita/grook
|
add716bf92fcde35b941ea8067933c28c192e01e
|
[
"MIT"
] | 3
|
2017-05-22T13:28:13.000Z
|
2018-06-29T16:39:19.000Z
|
api/lib/grook/web/views/member_view.ex
|
ukita/grook
|
add716bf92fcde35b941ea8067933c28c192e01e
|
[
"MIT"
] | null | null | null |
api/lib/grook/web/views/member_view.ex
|
ukita/grook
|
add716bf92fcde35b941ea8067933c28c192e01e
|
[
"MIT"
] | null | null | null |
defmodule Grook.Web.MemberView do
use Grook.Web, :view
alias Grook.Web.UserView
def render("index.json", %{members: members}) do
%{members: render_many(members, UserView, "user.json")}
end
end
| 23.111111
| 59
| 0.701923
|
93a21858174fb5a9838d6a36f1b44dd042aff276
| 1,399
|
exs
|
Elixir
|
spec/ex_ndjson/serializer_spec.exs
|
marceldegraaf/ex_ndjson
|
f7cdaf57a0eb1aefe257f81881edb673c2939ca6
|
[
"MIT"
] | 6
|
2018-09-29T11:30:15.000Z
|
2022-01-16T21:44:08.000Z
|
spec/ex_ndjson/serializer_spec.exs
|
marceldegraaf/ex_ndjson
|
f7cdaf57a0eb1aefe257f81881edb673c2939ca6
|
[
"MIT"
] | 2
|
2020-05-05T12:12:30.000Z
|
2021-02-02T20:50:45.000Z
|
spec/ex_ndjson/serializer_spec.exs
|
marceldegraaf/ex_ndjson
|
f7cdaf57a0eb1aefe257f81881edb673c2939ca6
|
[
"MIT"
] | 1
|
2019-06-27T08:42:05.000Z
|
2019-06-27T08:42:05.000Z
|
defmodule ExNdjson.SerializerSpec do
@moduledoc false
use ESpec
use Agent
import ExNdjson.Serializer
example_group do
describe "write!/2" do
context "Given a chunk of any supported type" do
it "Encodes and writes the chunk to the buffer and appends a newline to it" do
buffer =
start()
|> write!([%{name: "elixir", version: "1.7"}, [2, 4, 6]])
expect(is_pid(buffer)) |> to(be_true())
expect(Agent.get(buffer, fn state -> state end))
|> to(eql([["[{\"name\":\"elixir\",\"version\":\"1.7\"},[2,4,6]]", "\n"]]))
expect(Agent.stop(buffer)) |> to(eql(:ok))
end
end
context "Given a chunk of non supported type" do
it "Raises an exception" do
buffer = start()
expect(fn -> write!(buffer, {2, 4, 6}) end)
|> to(raise_exception(ExNdjson.SerializeError))
expect(Agent.stop(buffer)) |> to(eql(:ok))
end
end
end
describe "serialize/1" do
context "Given any supported term" do
it "serializes it to NDJSON format" do
output =
start()
|> write!([%{name: "elixir", version: "1.7"}, [2, 4, 6]])
|> serialize()
expect(output)
|> to(eql("[{\"name\":\"elixir\",\"version\":\"1.7\"},[2,4,6]]\n"))
end
end
end
end
end
| 26.903846
| 86
| 0.523231
|
93a21c3b86d39e46648ffcac268911bf2f80eb5c
| 361
|
exs
|
Elixir
|
priv/repo/seeds.exs
|
rgovaerts/tackle_box_cds_api
|
332cda4d576c469748677b9952a0d7fdf77d61c2
|
[
"MIT"
] | null | null | null |
priv/repo/seeds.exs
|
rgovaerts/tackle_box_cds_api
|
332cda4d576c469748677b9952a0d7fdf77d61c2
|
[
"MIT"
] | null | null | null |
priv/repo/seeds.exs
|
rgovaerts/tackle_box_cds_api
|
332cda4d576c469748677b9952a0d7fdf77d61c2
|
[
"MIT"
] | null | null | null |
# 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:
#
# TackleBoxCds.Repo.insert!(%TackleBoxCds.SomeSchema{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as they will fail if something goes wrong.
| 30.083333
| 61
| 0.714681
|
93a25216ef3fd61777c5473e902ba8dae1b62bd6
| 216,507
|
ex
|
Elixir
|
lib/codes/codes_s12.ex
|
badubizzle/icd_code
|
4c625733f92b7b1d616e272abc3009bb8b916c0c
|
[
"Apache-2.0"
] | null | null | null |
lib/codes/codes_s12.ex
|
badubizzle/icd_code
|
4c625733f92b7b1d616e272abc3009bb8b916c0c
|
[
"Apache-2.0"
] | null | null | null |
lib/codes/codes_s12.ex
|
badubizzle/icd_code
|
4c625733f92b7b1d616e272abc3009bb8b916c0c
|
[
"Apache-2.0"
] | null | null | null |
defmodule IcdCode.ICDCode.Codes_S12 do
alias IcdCode.ICDCode
def _S12000A do
%ICDCode{full_code: "S12000A",
category_code: "S12",
short_code: "000A",
full_name: "Unspecified displaced fracture of first cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified displaced fracture of first cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified displaced fracture of first cervical vertebra, initial encounter for closed fracture"
}
end
def _S12000B do
%ICDCode{full_code: "S12000B",
category_code: "S12",
short_code: "000B",
full_name: "Unspecified displaced fracture of first cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified displaced fracture of first cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified displaced fracture of first cervical vertebra, initial encounter for open fracture"
}
end
def _S12000D do
%ICDCode{full_code: "S12000D",
category_code: "S12",
short_code: "000D",
full_name: "Unspecified displaced fracture of first cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified displaced fracture of first cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified displaced fracture of first cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12000G do
%ICDCode{full_code: "S12000G",
category_code: "S12",
short_code: "000G",
full_name: "Unspecified displaced fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified displaced fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified displaced fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12000K do
%ICDCode{full_code: "S12000K",
category_code: "S12",
short_code: "000K",
full_name: "Unspecified displaced fracture of first cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified displaced fracture of first cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified displaced fracture of first cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12000S do
%ICDCode{full_code: "S12000S",
category_code: "S12",
short_code: "000S",
full_name: "Unspecified displaced fracture of first cervical vertebra, sequela",
short_name: "Unspecified displaced fracture of first cervical vertebra, sequela",
category_name: "Unspecified displaced fracture of first cervical vertebra, sequela"
}
end
def _S12001A do
%ICDCode{full_code: "S12001A",
category_code: "S12",
short_code: "001A",
full_name: "Unspecified nondisplaced fracture of first cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified nondisplaced fracture of first cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified nondisplaced fracture of first cervical vertebra, initial encounter for closed fracture"
}
end
def _S12001B do
%ICDCode{full_code: "S12001B",
category_code: "S12",
short_code: "001B",
full_name: "Unspecified nondisplaced fracture of first cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified nondisplaced fracture of first cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified nondisplaced fracture of first cervical vertebra, initial encounter for open fracture"
}
end
def _S12001D do
%ICDCode{full_code: "S12001D",
category_code: "S12",
short_code: "001D",
full_name: "Unspecified nondisplaced fracture of first cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified nondisplaced fracture of first cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified nondisplaced fracture of first cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12001G do
%ICDCode{full_code: "S12001G",
category_code: "S12",
short_code: "001G",
full_name: "Unspecified nondisplaced fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified nondisplaced fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified nondisplaced fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12001K do
%ICDCode{full_code: "S12001K",
category_code: "S12",
short_code: "001K",
full_name: "Unspecified nondisplaced fracture of first cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified nondisplaced fracture of first cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified nondisplaced fracture of first cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12001S do
%ICDCode{full_code: "S12001S",
category_code: "S12",
short_code: "001S",
full_name: "Unspecified nondisplaced fracture of first cervical vertebra, sequela",
short_name: "Unspecified nondisplaced fracture of first cervical vertebra, sequela",
category_name: "Unspecified nondisplaced fracture of first cervical vertebra, sequela"
}
end
def _S1201XA do
%ICDCode{full_code: "S1201XA",
category_code: "S12",
short_code: "01XA",
full_name: "Stable burst fracture of first cervical vertebra, initial encounter for closed fracture",
short_name: "Stable burst fracture of first cervical vertebra, initial encounter for closed fracture",
category_name: "Stable burst fracture of first cervical vertebra, initial encounter for closed fracture"
}
end
def _S1201XB do
%ICDCode{full_code: "S1201XB",
category_code: "S12",
short_code: "01XB",
full_name: "Stable burst fracture of first cervical vertebra, initial encounter for open fracture",
short_name: "Stable burst fracture of first cervical vertebra, initial encounter for open fracture",
category_name: "Stable burst fracture of first cervical vertebra, initial encounter for open fracture"
}
end
def _S1201XD do
%ICDCode{full_code: "S1201XD",
category_code: "S12",
short_code: "01XD",
full_name: "Stable burst fracture of first cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Stable burst fracture of first cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Stable burst fracture of first cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S1201XG do
%ICDCode{full_code: "S1201XG",
category_code: "S12",
short_code: "01XG",
full_name: "Stable burst fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Stable burst fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Stable burst fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S1201XK do
%ICDCode{full_code: "S1201XK",
category_code: "S12",
short_code: "01XK",
full_name: "Stable burst fracture of first cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Stable burst fracture of first cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Stable burst fracture of first cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S1201XS do
%ICDCode{full_code: "S1201XS",
category_code: "S12",
short_code: "01XS",
full_name: "Stable burst fracture of first cervical vertebra, sequela",
short_name: "Stable burst fracture of first cervical vertebra, sequela",
category_name: "Stable burst fracture of first cervical vertebra, sequela"
}
end
def _S1202XA do
%ICDCode{full_code: "S1202XA",
category_code: "S12",
short_code: "02XA",
full_name: "Unstable burst fracture of first cervical vertebra, initial encounter for closed fracture",
short_name: "Unstable burst fracture of first cervical vertebra, initial encounter for closed fracture",
category_name: "Unstable burst fracture of first cervical vertebra, initial encounter for closed fracture"
}
end
def _S1202XB do
%ICDCode{full_code: "S1202XB",
category_code: "S12",
short_code: "02XB",
full_name: "Unstable burst fracture of first cervical vertebra, initial encounter for open fracture",
short_name: "Unstable burst fracture of first cervical vertebra, initial encounter for open fracture",
category_name: "Unstable burst fracture of first cervical vertebra, initial encounter for open fracture"
}
end
def _S1202XD do
%ICDCode{full_code: "S1202XD",
category_code: "S12",
short_code: "02XD",
full_name: "Unstable burst fracture of first cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unstable burst fracture of first cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unstable burst fracture of first cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S1202XG do
%ICDCode{full_code: "S1202XG",
category_code: "S12",
short_code: "02XG",
full_name: "Unstable burst fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unstable burst fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unstable burst fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S1202XK do
%ICDCode{full_code: "S1202XK",
category_code: "S12",
short_code: "02XK",
full_name: "Unstable burst fracture of first cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unstable burst fracture of first cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unstable burst fracture of first cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S1202XS do
%ICDCode{full_code: "S1202XS",
category_code: "S12",
short_code: "02XS",
full_name: "Unstable burst fracture of first cervical vertebra, sequela",
short_name: "Unstable burst fracture of first cervical vertebra, sequela",
category_name: "Unstable burst fracture of first cervical vertebra, sequela"
}
end
def _S12030A do
%ICDCode{full_code: "S12030A",
category_code: "S12",
short_code: "030A",
full_name: "Displaced posterior arch fracture of first cervical vertebra, initial encounter for closed fracture",
short_name: "Displaced posterior arch fracture of first cervical vertebra, initial encounter for closed fracture",
category_name: "Displaced posterior arch fracture of first cervical vertebra, initial encounter for closed fracture"
}
end
def _S12030B do
%ICDCode{full_code: "S12030B",
category_code: "S12",
short_code: "030B",
full_name: "Displaced posterior arch fracture of first cervical vertebra, initial encounter for open fracture",
short_name: "Displaced posterior arch fracture of first cervical vertebra, initial encounter for open fracture",
category_name: "Displaced posterior arch fracture of first cervical vertebra, initial encounter for open fracture"
}
end
def _S12030D do
%ICDCode{full_code: "S12030D",
category_code: "S12",
short_code: "030D",
full_name: "Displaced posterior arch fracture of first cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Displaced posterior arch fracture of first cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Displaced posterior arch fracture of first cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12030G do
%ICDCode{full_code: "S12030G",
category_code: "S12",
short_code: "030G",
full_name: "Displaced posterior arch fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Displaced posterior arch fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Displaced posterior arch fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12030K do
%ICDCode{full_code: "S12030K",
category_code: "S12",
short_code: "030K",
full_name: "Displaced posterior arch fracture of first cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Displaced posterior arch fracture of first cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Displaced posterior arch fracture of first cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12030S do
%ICDCode{full_code: "S12030S",
category_code: "S12",
short_code: "030S",
full_name: "Displaced posterior arch fracture of first cervical vertebra, sequela",
short_name: "Displaced posterior arch fracture of first cervical vertebra, sequela",
category_name: "Displaced posterior arch fracture of first cervical vertebra, sequela"
}
end
def _S12031A do
%ICDCode{full_code: "S12031A",
category_code: "S12",
short_code: "031A",
full_name: "Nondisplaced posterior arch fracture of first cervical vertebra, initial encounter for closed fracture",
short_name: "Nondisplaced posterior arch fracture of first cervical vertebra, initial encounter for closed fracture",
category_name: "Nondisplaced posterior arch fracture of first cervical vertebra, initial encounter for closed fracture"
}
end
def _S12031B do
%ICDCode{full_code: "S12031B",
category_code: "S12",
short_code: "031B",
full_name: "Nondisplaced posterior arch fracture of first cervical vertebra, initial encounter for open fracture",
short_name: "Nondisplaced posterior arch fracture of first cervical vertebra, initial encounter for open fracture",
category_name: "Nondisplaced posterior arch fracture of first cervical vertebra, initial encounter for open fracture"
}
end
def _S12031D do
%ICDCode{full_code: "S12031D",
category_code: "S12",
short_code: "031D",
full_name: "Nondisplaced posterior arch fracture of first cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Nondisplaced posterior arch fracture of first cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Nondisplaced posterior arch fracture of first cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12031G do
%ICDCode{full_code: "S12031G",
category_code: "S12",
short_code: "031G",
full_name: "Nondisplaced posterior arch fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Nondisplaced posterior arch fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Nondisplaced posterior arch fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12031K do
%ICDCode{full_code: "S12031K",
category_code: "S12",
short_code: "031K",
full_name: "Nondisplaced posterior arch fracture of first cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Nondisplaced posterior arch fracture of first cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Nondisplaced posterior arch fracture of first cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12031S do
%ICDCode{full_code: "S12031S",
category_code: "S12",
short_code: "031S",
full_name: "Nondisplaced posterior arch fracture of first cervical vertebra, sequela",
short_name: "Nondisplaced posterior arch fracture of first cervical vertebra, sequela",
category_name: "Nondisplaced posterior arch fracture of first cervical vertebra, sequela"
}
end
def _S12040A do
%ICDCode{full_code: "S12040A",
category_code: "S12",
short_code: "040A",
full_name: "Displaced lateral mass fracture of first cervical vertebra, initial encounter for closed fracture",
short_name: "Displaced lateral mass fracture of first cervical vertebra, initial encounter for closed fracture",
category_name: "Displaced lateral mass fracture of first cervical vertebra, initial encounter for closed fracture"
}
end
def _S12040B do
%ICDCode{full_code: "S12040B",
category_code: "S12",
short_code: "040B",
full_name: "Displaced lateral mass fracture of first cervical vertebra, initial encounter for open fracture",
short_name: "Displaced lateral mass fracture of first cervical vertebra, initial encounter for open fracture",
category_name: "Displaced lateral mass fracture of first cervical vertebra, initial encounter for open fracture"
}
end
def _S12040D do
%ICDCode{full_code: "S12040D",
category_code: "S12",
short_code: "040D",
full_name: "Displaced lateral mass fracture of first cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Displaced lateral mass fracture of first cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Displaced lateral mass fracture of first cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12040G do
%ICDCode{full_code: "S12040G",
category_code: "S12",
short_code: "040G",
full_name: "Displaced lateral mass fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Displaced lateral mass fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Displaced lateral mass fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12040K do
%ICDCode{full_code: "S12040K",
category_code: "S12",
short_code: "040K",
full_name: "Displaced lateral mass fracture of first cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Displaced lateral mass fracture of first cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Displaced lateral mass fracture of first cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12040S do
%ICDCode{full_code: "S12040S",
category_code: "S12",
short_code: "040S",
full_name: "Displaced lateral mass fracture of first cervical vertebra, sequela",
short_name: "Displaced lateral mass fracture of first cervical vertebra, sequela",
category_name: "Displaced lateral mass fracture of first cervical vertebra, sequela"
}
end
def _S12041A do
%ICDCode{full_code: "S12041A",
category_code: "S12",
short_code: "041A",
full_name: "Nondisplaced lateral mass fracture of first cervical vertebra, initial encounter for closed fracture",
short_name: "Nondisplaced lateral mass fracture of first cervical vertebra, initial encounter for closed fracture",
category_name: "Nondisplaced lateral mass fracture of first cervical vertebra, initial encounter for closed fracture"
}
end
def _S12041B do
%ICDCode{full_code: "S12041B",
category_code: "S12",
short_code: "041B",
full_name: "Nondisplaced lateral mass fracture of first cervical vertebra, initial encounter for open fracture",
short_name: "Nondisplaced lateral mass fracture of first cervical vertebra, initial encounter for open fracture",
category_name: "Nondisplaced lateral mass fracture of first cervical vertebra, initial encounter for open fracture"
}
end
def _S12041D do
%ICDCode{full_code: "S12041D",
category_code: "S12",
short_code: "041D",
full_name: "Nondisplaced lateral mass fracture of first cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Nondisplaced lateral mass fracture of first cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Nondisplaced lateral mass fracture of first cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12041G do
%ICDCode{full_code: "S12041G",
category_code: "S12",
short_code: "041G",
full_name: "Nondisplaced lateral mass fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Nondisplaced lateral mass fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Nondisplaced lateral mass fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12041K do
%ICDCode{full_code: "S12041K",
category_code: "S12",
short_code: "041K",
full_name: "Nondisplaced lateral mass fracture of first cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Nondisplaced lateral mass fracture of first cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Nondisplaced lateral mass fracture of first cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12041S do
%ICDCode{full_code: "S12041S",
category_code: "S12",
short_code: "041S",
full_name: "Nondisplaced lateral mass fracture of first cervical vertebra, sequela",
short_name: "Nondisplaced lateral mass fracture of first cervical vertebra, sequela",
category_name: "Nondisplaced lateral mass fracture of first cervical vertebra, sequela"
}
end
def _S12090A do
%ICDCode{full_code: "S12090A",
category_code: "S12",
short_code: "090A",
full_name: "Other displaced fracture of first cervical vertebra, initial encounter for closed fracture",
short_name: "Other displaced fracture of first cervical vertebra, initial encounter for closed fracture",
category_name: "Other displaced fracture of first cervical vertebra, initial encounter for closed fracture"
}
end
def _S12090B do
%ICDCode{full_code: "S12090B",
category_code: "S12",
short_code: "090B",
full_name: "Other displaced fracture of first cervical vertebra, initial encounter for open fracture",
short_name: "Other displaced fracture of first cervical vertebra, initial encounter for open fracture",
category_name: "Other displaced fracture of first cervical vertebra, initial encounter for open fracture"
}
end
def _S12090D do
%ICDCode{full_code: "S12090D",
category_code: "S12",
short_code: "090D",
full_name: "Other displaced fracture of first cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other displaced fracture of first cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other displaced fracture of first cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12090G do
%ICDCode{full_code: "S12090G",
category_code: "S12",
short_code: "090G",
full_name: "Other displaced fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other displaced fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other displaced fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12090K do
%ICDCode{full_code: "S12090K",
category_code: "S12",
short_code: "090K",
full_name: "Other displaced fracture of first cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other displaced fracture of first cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other displaced fracture of first cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12090S do
%ICDCode{full_code: "S12090S",
category_code: "S12",
short_code: "090S",
full_name: "Other displaced fracture of first cervical vertebra, sequela",
short_name: "Other displaced fracture of first cervical vertebra, sequela",
category_name: "Other displaced fracture of first cervical vertebra, sequela"
}
end
def _S12091A do
%ICDCode{full_code: "S12091A",
category_code: "S12",
short_code: "091A",
full_name: "Other nondisplaced fracture of first cervical vertebra, initial encounter for closed fracture",
short_name: "Other nondisplaced fracture of first cervical vertebra, initial encounter for closed fracture",
category_name: "Other nondisplaced fracture of first cervical vertebra, initial encounter for closed fracture"
}
end
def _S12091B do
%ICDCode{full_code: "S12091B",
category_code: "S12",
short_code: "091B",
full_name: "Other nondisplaced fracture of first cervical vertebra, initial encounter for open fracture",
short_name: "Other nondisplaced fracture of first cervical vertebra, initial encounter for open fracture",
category_name: "Other nondisplaced fracture of first cervical vertebra, initial encounter for open fracture"
}
end
def _S12091D do
%ICDCode{full_code: "S12091D",
category_code: "S12",
short_code: "091D",
full_name: "Other nondisplaced fracture of first cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other nondisplaced fracture of first cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other nondisplaced fracture of first cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12091G do
%ICDCode{full_code: "S12091G",
category_code: "S12",
short_code: "091G",
full_name: "Other nondisplaced fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other nondisplaced fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other nondisplaced fracture of first cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12091K do
%ICDCode{full_code: "S12091K",
category_code: "S12",
short_code: "091K",
full_name: "Other nondisplaced fracture of first cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other nondisplaced fracture of first cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other nondisplaced fracture of first cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12091S do
%ICDCode{full_code: "S12091S",
category_code: "S12",
short_code: "091S",
full_name: "Other nondisplaced fracture of first cervical vertebra, sequela",
short_name: "Other nondisplaced fracture of first cervical vertebra, sequela",
category_name: "Other nondisplaced fracture of first cervical vertebra, sequela"
}
end
def _S12100A do
%ICDCode{full_code: "S12100A",
category_code: "S12",
short_code: "100A",
full_name: "Unspecified displaced fracture of second cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified displaced fracture of second cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified displaced fracture of second cervical vertebra, initial encounter for closed fracture"
}
end
def _S12100B do
%ICDCode{full_code: "S12100B",
category_code: "S12",
short_code: "100B",
full_name: "Unspecified displaced fracture of second cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified displaced fracture of second cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified displaced fracture of second cervical vertebra, initial encounter for open fracture"
}
end
def _S12100D do
%ICDCode{full_code: "S12100D",
category_code: "S12",
short_code: "100D",
full_name: "Unspecified displaced fracture of second cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified displaced fracture of second cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified displaced fracture of second cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12100G do
%ICDCode{full_code: "S12100G",
category_code: "S12",
short_code: "100G",
full_name: "Unspecified displaced fracture of second cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified displaced fracture of second cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified displaced fracture of second cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12100K do
%ICDCode{full_code: "S12100K",
category_code: "S12",
short_code: "100K",
full_name: "Unspecified displaced fracture of second cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified displaced fracture of second cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified displaced fracture of second cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12100S do
%ICDCode{full_code: "S12100S",
category_code: "S12",
short_code: "100S",
full_name: "Unspecified displaced fracture of second cervical vertebra, sequela",
short_name: "Unspecified displaced fracture of second cervical vertebra, sequela",
category_name: "Unspecified displaced fracture of second cervical vertebra, sequela"
}
end
def _S12101A do
%ICDCode{full_code: "S12101A",
category_code: "S12",
short_code: "101A",
full_name: "Unspecified nondisplaced fracture of second cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified nondisplaced fracture of second cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified nondisplaced fracture of second cervical vertebra, initial encounter for closed fracture"
}
end
def _S12101B do
%ICDCode{full_code: "S12101B",
category_code: "S12",
short_code: "101B",
full_name: "Unspecified nondisplaced fracture of second cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified nondisplaced fracture of second cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified nondisplaced fracture of second cervical vertebra, initial encounter for open fracture"
}
end
def _S12101D do
%ICDCode{full_code: "S12101D",
category_code: "S12",
short_code: "101D",
full_name: "Unspecified nondisplaced fracture of second cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified nondisplaced fracture of second cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified nondisplaced fracture of second cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12101G do
%ICDCode{full_code: "S12101G",
category_code: "S12",
short_code: "101G",
full_name: "Unspecified nondisplaced fracture of second cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified nondisplaced fracture of second cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified nondisplaced fracture of second cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12101K do
%ICDCode{full_code: "S12101K",
category_code: "S12",
short_code: "101K",
full_name: "Unspecified nondisplaced fracture of second cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified nondisplaced fracture of second cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified nondisplaced fracture of second cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12101S do
%ICDCode{full_code: "S12101S",
category_code: "S12",
short_code: "101S",
full_name: "Unspecified nondisplaced fracture of second cervical vertebra, sequela",
short_name: "Unspecified nondisplaced fracture of second cervical vertebra, sequela",
category_name: "Unspecified nondisplaced fracture of second cervical vertebra, sequela"
}
end
def _S12110A do
%ICDCode{full_code: "S12110A",
category_code: "S12",
short_code: "110A",
full_name: "Anterior displaced Type II dens fracture, initial encounter for closed fracture",
short_name: "Anterior displaced Type II dens fracture, initial encounter for closed fracture",
category_name: "Anterior displaced Type II dens fracture, initial encounter for closed fracture"
}
end
def _S12110B do
%ICDCode{full_code: "S12110B",
category_code: "S12",
short_code: "110B",
full_name: "Anterior displaced Type II dens fracture, initial encounter for open fracture",
short_name: "Anterior displaced Type II dens fracture, initial encounter for open fracture",
category_name: "Anterior displaced Type II dens fracture, initial encounter for open fracture"
}
end
def _S12110D do
%ICDCode{full_code: "S12110D",
category_code: "S12",
short_code: "110D",
full_name: "Anterior displaced Type II dens fracture, subsequent encounter for fracture with routine healing",
short_name: "Anterior displaced Type II dens fracture, subsequent encounter for fracture with routine healing",
category_name: "Anterior displaced Type II dens fracture, subsequent encounter for fracture with routine healing"
}
end
def _S12110G do
%ICDCode{full_code: "S12110G",
category_code: "S12",
short_code: "110G",
full_name: "Anterior displaced Type II dens fracture, subsequent encounter for fracture with delayed healing",
short_name: "Anterior displaced Type II dens fracture, subsequent encounter for fracture with delayed healing",
category_name: "Anterior displaced Type II dens fracture, subsequent encounter for fracture with delayed healing"
}
end
def _S12110K do
%ICDCode{full_code: "S12110K",
category_code: "S12",
short_code: "110K",
full_name: "Anterior displaced Type II dens fracture, subsequent encounter for fracture with nonunion",
short_name: "Anterior displaced Type II dens fracture, subsequent encounter for fracture with nonunion",
category_name: "Anterior displaced Type II dens fracture, subsequent encounter for fracture with nonunion"
}
end
def _S12110S do
%ICDCode{full_code: "S12110S",
category_code: "S12",
short_code: "110S",
full_name: "Anterior displaced Type II dens fracture, sequela",
short_name: "Anterior displaced Type II dens fracture, sequela",
category_name: "Anterior displaced Type II dens fracture, sequela"
}
end
def _S12111A do
%ICDCode{full_code: "S12111A",
category_code: "S12",
short_code: "111A",
full_name: "Posterior displaced Type II dens fracture, initial encounter for closed fracture",
short_name: "Posterior displaced Type II dens fracture, initial encounter for closed fracture",
category_name: "Posterior displaced Type II dens fracture, initial encounter for closed fracture"
}
end
def _S12111B do
%ICDCode{full_code: "S12111B",
category_code: "S12",
short_code: "111B",
full_name: "Posterior displaced Type II dens fracture, initial encounter for open fracture",
short_name: "Posterior displaced Type II dens fracture, initial encounter for open fracture",
category_name: "Posterior displaced Type II dens fracture, initial encounter for open fracture"
}
end
def _S12111D do
%ICDCode{full_code: "S12111D",
category_code: "S12",
short_code: "111D",
full_name: "Posterior displaced Type II dens fracture, subsequent encounter for fracture with routine healing",
short_name: "Posterior displaced Type II dens fracture, subsequent encounter for fracture with routine healing",
category_name: "Posterior displaced Type II dens fracture, subsequent encounter for fracture with routine healing"
}
end
def _S12111G do
%ICDCode{full_code: "S12111G",
category_code: "S12",
short_code: "111G",
full_name: "Posterior displaced Type II dens fracture, subsequent encounter for fracture with delayed healing",
short_name: "Posterior displaced Type II dens fracture, subsequent encounter for fracture with delayed healing",
category_name: "Posterior displaced Type II dens fracture, subsequent encounter for fracture with delayed healing"
}
end
def _S12111K do
%ICDCode{full_code: "S12111K",
category_code: "S12",
short_code: "111K",
full_name: "Posterior displaced Type II dens fracture, subsequent encounter for fracture with nonunion",
short_name: "Posterior displaced Type II dens fracture, subsequent encounter for fracture with nonunion",
category_name: "Posterior displaced Type II dens fracture, subsequent encounter for fracture with nonunion"
}
end
def _S12111S do
%ICDCode{full_code: "S12111S",
category_code: "S12",
short_code: "111S",
full_name: "Posterior displaced Type II dens fracture, sequela",
short_name: "Posterior displaced Type II dens fracture, sequela",
category_name: "Posterior displaced Type II dens fracture, sequela"
}
end
def _S12112A do
%ICDCode{full_code: "S12112A",
category_code: "S12",
short_code: "112A",
full_name: "Nondisplaced Type II dens fracture, initial encounter for closed fracture",
short_name: "Nondisplaced Type II dens fracture, initial encounter for closed fracture",
category_name: "Nondisplaced Type II dens fracture, initial encounter for closed fracture"
}
end
def _S12112B do
%ICDCode{full_code: "S12112B",
category_code: "S12",
short_code: "112B",
full_name: "Nondisplaced Type II dens fracture, initial encounter for open fracture",
short_name: "Nondisplaced Type II dens fracture, initial encounter for open fracture",
category_name: "Nondisplaced Type II dens fracture, initial encounter for open fracture"
}
end
def _S12112D do
%ICDCode{full_code: "S12112D",
category_code: "S12",
short_code: "112D",
full_name: "Nondisplaced Type II dens fracture, subsequent encounter for fracture with routine healing",
short_name: "Nondisplaced Type II dens fracture, subsequent encounter for fracture with routine healing",
category_name: "Nondisplaced Type II dens fracture, subsequent encounter for fracture with routine healing"
}
end
def _S12112G do
%ICDCode{full_code: "S12112G",
category_code: "S12",
short_code: "112G",
full_name: "Nondisplaced Type II dens fracture, subsequent encounter for fracture with delayed healing",
short_name: "Nondisplaced Type II dens fracture, subsequent encounter for fracture with delayed healing",
category_name: "Nondisplaced Type II dens fracture, subsequent encounter for fracture with delayed healing"
}
end
def _S12112K do
%ICDCode{full_code: "S12112K",
category_code: "S12",
short_code: "112K",
full_name: "Nondisplaced Type II dens fracture, subsequent encounter for fracture with nonunion",
short_name: "Nondisplaced Type II dens fracture, subsequent encounter for fracture with nonunion",
category_name: "Nondisplaced Type II dens fracture, subsequent encounter for fracture with nonunion"
}
end
def _S12112S do
%ICDCode{full_code: "S12112S",
category_code: "S12",
short_code: "112S",
full_name: "Nondisplaced Type II dens fracture, sequela",
short_name: "Nondisplaced Type II dens fracture, sequela",
category_name: "Nondisplaced Type II dens fracture, sequela"
}
end
def _S12120A do
%ICDCode{full_code: "S12120A",
category_code: "S12",
short_code: "120A",
full_name: "Other displaced dens fracture, initial encounter for closed fracture",
short_name: "Other displaced dens fracture, initial encounter for closed fracture",
category_name: "Other displaced dens fracture, initial encounter for closed fracture"
}
end
def _S12120B do
%ICDCode{full_code: "S12120B",
category_code: "S12",
short_code: "120B",
full_name: "Other displaced dens fracture, initial encounter for open fracture",
short_name: "Other displaced dens fracture, initial encounter for open fracture",
category_name: "Other displaced dens fracture, initial encounter for open fracture"
}
end
def _S12120D do
%ICDCode{full_code: "S12120D",
category_code: "S12",
short_code: "120D",
full_name: "Other displaced dens fracture, subsequent encounter for fracture with routine healing",
short_name: "Other displaced dens fracture, subsequent encounter for fracture with routine healing",
category_name: "Other displaced dens fracture, subsequent encounter for fracture with routine healing"
}
end
def _S12120G do
%ICDCode{full_code: "S12120G",
category_code: "S12",
short_code: "120G",
full_name: "Other displaced dens fracture, subsequent encounter for fracture with delayed healing",
short_name: "Other displaced dens fracture, subsequent encounter for fracture with delayed healing",
category_name: "Other displaced dens fracture, subsequent encounter for fracture with delayed healing"
}
end
def _S12120K do
%ICDCode{full_code: "S12120K",
category_code: "S12",
short_code: "120K",
full_name: "Other displaced dens fracture, subsequent encounter for fracture with nonunion",
short_name: "Other displaced dens fracture, subsequent encounter for fracture with nonunion",
category_name: "Other displaced dens fracture, subsequent encounter for fracture with nonunion"
}
end
def _S12120S do
%ICDCode{full_code: "S12120S",
category_code: "S12",
short_code: "120S",
full_name: "Other displaced dens fracture, sequela",
short_name: "Other displaced dens fracture, sequela",
category_name: "Other displaced dens fracture, sequela"
}
end
def _S12121A do
%ICDCode{full_code: "S12121A",
category_code: "S12",
short_code: "121A",
full_name: "Other nondisplaced dens fracture, initial encounter for closed fracture",
short_name: "Other nondisplaced dens fracture, initial encounter for closed fracture",
category_name: "Other nondisplaced dens fracture, initial encounter for closed fracture"
}
end
def _S12121B do
%ICDCode{full_code: "S12121B",
category_code: "S12",
short_code: "121B",
full_name: "Other nondisplaced dens fracture, initial encounter for open fracture",
short_name: "Other nondisplaced dens fracture, initial encounter for open fracture",
category_name: "Other nondisplaced dens fracture, initial encounter for open fracture"
}
end
def _S12121D do
%ICDCode{full_code: "S12121D",
category_code: "S12",
short_code: "121D",
full_name: "Other nondisplaced dens fracture, subsequent encounter for fracture with routine healing",
short_name: "Other nondisplaced dens fracture, subsequent encounter for fracture with routine healing",
category_name: "Other nondisplaced dens fracture, subsequent encounter for fracture with routine healing"
}
end
def _S12121G do
%ICDCode{full_code: "S12121G",
category_code: "S12",
short_code: "121G",
full_name: "Other nondisplaced dens fracture, subsequent encounter for fracture with delayed healing",
short_name: "Other nondisplaced dens fracture, subsequent encounter for fracture with delayed healing",
category_name: "Other nondisplaced dens fracture, subsequent encounter for fracture with delayed healing"
}
end
def _S12121K do
%ICDCode{full_code: "S12121K",
category_code: "S12",
short_code: "121K",
full_name: "Other nondisplaced dens fracture, subsequent encounter for fracture with nonunion",
short_name: "Other nondisplaced dens fracture, subsequent encounter for fracture with nonunion",
category_name: "Other nondisplaced dens fracture, subsequent encounter for fracture with nonunion"
}
end
def _S12121S do
%ICDCode{full_code: "S12121S",
category_code: "S12",
short_code: "121S",
full_name: "Other nondisplaced dens fracture, sequela",
short_name: "Other nondisplaced dens fracture, sequela",
category_name: "Other nondisplaced dens fracture, sequela"
}
end
def _S12130A do
%ICDCode{full_code: "S12130A",
category_code: "S12",
short_code: "130A",
full_name: "Unspecified traumatic displaced spondylolisthesis of second cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified traumatic displaced spondylolisthesis of second cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified traumatic displaced spondylolisthesis of second cervical vertebra, initial encounter for closed fracture"
}
end
def _S12130B do
%ICDCode{full_code: "S12130B",
category_code: "S12",
short_code: "130B",
full_name: "Unspecified traumatic displaced spondylolisthesis of second cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified traumatic displaced spondylolisthesis of second cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified traumatic displaced spondylolisthesis of second cervical vertebra, initial encounter for open fracture"
}
end
def _S12130D do
%ICDCode{full_code: "S12130D",
category_code: "S12",
short_code: "130D",
full_name: "Unspecified traumatic displaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified traumatic displaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified traumatic displaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12130G do
%ICDCode{full_code: "S12130G",
category_code: "S12",
short_code: "130G",
full_name: "Unspecified traumatic displaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified traumatic displaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified traumatic displaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12130K do
%ICDCode{full_code: "S12130K",
category_code: "S12",
short_code: "130K",
full_name: "Unspecified traumatic displaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified traumatic displaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified traumatic displaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12130S do
%ICDCode{full_code: "S12130S",
category_code: "S12",
short_code: "130S",
full_name: "Unspecified traumatic displaced spondylolisthesis of second cervical vertebra, sequela",
short_name: "Unspecified traumatic displaced spondylolisthesis of second cervical vertebra, sequela",
category_name: "Unspecified traumatic displaced spondylolisthesis of second cervical vertebra, sequela"
}
end
def _S12131A do
%ICDCode{full_code: "S12131A",
category_code: "S12",
short_code: "131A",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of second cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of second cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of second cervical vertebra, initial encounter for closed fracture"
}
end
def _S12131B do
%ICDCode{full_code: "S12131B",
category_code: "S12",
short_code: "131B",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of second cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of second cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of second cervical vertebra, initial encounter for open fracture"
}
end
def _S12131D do
%ICDCode{full_code: "S12131D",
category_code: "S12",
short_code: "131D",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12131G do
%ICDCode{full_code: "S12131G",
category_code: "S12",
short_code: "131G",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12131K do
%ICDCode{full_code: "S12131K",
category_code: "S12",
short_code: "131K",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12131S do
%ICDCode{full_code: "S12131S",
category_code: "S12",
short_code: "131S",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of second cervical vertebra, sequela",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of second cervical vertebra, sequela",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of second cervical vertebra, sequela"
}
end
def _S1214XA do
%ICDCode{full_code: "S1214XA",
category_code: "S12",
short_code: "14XA",
full_name: "Type III traumatic spondylolisthesis of second cervical vertebra, initial encounter for closed fracture",
short_name: "Type III traumatic spondylolisthesis of second cervical vertebra, initial encounter for closed fracture",
category_name: "Type III traumatic spondylolisthesis of second cervical vertebra, initial encounter for closed fracture"
}
end
def _S1214XB do
%ICDCode{full_code: "S1214XB",
category_code: "S12",
short_code: "14XB",
full_name: "Type III traumatic spondylolisthesis of second cervical vertebra, initial encounter for open fracture",
short_name: "Type III traumatic spondylolisthesis of second cervical vertebra, initial encounter for open fracture",
category_name: "Type III traumatic spondylolisthesis of second cervical vertebra, initial encounter for open fracture"
}
end
def _S1214XD do
%ICDCode{full_code: "S1214XD",
category_code: "S12",
short_code: "14XD",
full_name: "Type III traumatic spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Type III traumatic spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Type III traumatic spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S1214XG do
%ICDCode{full_code: "S1214XG",
category_code: "S12",
short_code: "14XG",
full_name: "Type III traumatic spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Type III traumatic spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Type III traumatic spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S1214XK do
%ICDCode{full_code: "S1214XK",
category_code: "S12",
short_code: "14XK",
full_name: "Type III traumatic spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Type III traumatic spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Type III traumatic spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S1214XS do
%ICDCode{full_code: "S1214XS",
category_code: "S12",
short_code: "14XS",
full_name: "Type III traumatic spondylolisthesis of second cervical vertebra, sequela",
short_name: "Type III traumatic spondylolisthesis of second cervical vertebra, sequela",
category_name: "Type III traumatic spondylolisthesis of second cervical vertebra, sequela"
}
end
def _S12150A do
%ICDCode{full_code: "S12150A",
category_code: "S12",
short_code: "150A",
full_name: "Other traumatic displaced spondylolisthesis of second cervical vertebra, initial encounter for closed fracture",
short_name: "Other traumatic displaced spondylolisthesis of second cervical vertebra, initial encounter for closed fracture",
category_name: "Other traumatic displaced spondylolisthesis of second cervical vertebra, initial encounter for closed fracture"
}
end
def _S12150B do
%ICDCode{full_code: "S12150B",
category_code: "S12",
short_code: "150B",
full_name: "Other traumatic displaced spondylolisthesis of second cervical vertebra, initial encounter for open fracture",
short_name: "Other traumatic displaced spondylolisthesis of second cervical vertebra, initial encounter for open fracture",
category_name: "Other traumatic displaced spondylolisthesis of second cervical vertebra, initial encounter for open fracture"
}
end
def _S12150D do
%ICDCode{full_code: "S12150D",
category_code: "S12",
short_code: "150D",
full_name: "Other traumatic displaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other traumatic displaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other traumatic displaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12150G do
%ICDCode{full_code: "S12150G",
category_code: "S12",
short_code: "150G",
full_name: "Other traumatic displaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other traumatic displaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other traumatic displaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12150K do
%ICDCode{full_code: "S12150K",
category_code: "S12",
short_code: "150K",
full_name: "Other traumatic displaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other traumatic displaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other traumatic displaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12150S do
%ICDCode{full_code: "S12150S",
category_code: "S12",
short_code: "150S",
full_name: "Other traumatic displaced spondylolisthesis of second cervical vertebra, sequela",
short_name: "Other traumatic displaced spondylolisthesis of second cervical vertebra, sequela",
category_name: "Other traumatic displaced spondylolisthesis of second cervical vertebra, sequela"
}
end
def _S12151A do
%ICDCode{full_code: "S12151A",
category_code: "S12",
short_code: "151A",
full_name: "Other traumatic nondisplaced spondylolisthesis of second cervical vertebra, initial encounter for closed fracture",
short_name: "Other traumatic nondisplaced spondylolisthesis of second cervical vertebra, initial encounter for closed fracture",
category_name: "Other traumatic nondisplaced spondylolisthesis of second cervical vertebra, initial encounter for closed fracture"
}
end
def _S12151B do
%ICDCode{full_code: "S12151B",
category_code: "S12",
short_code: "151B",
full_name: "Other traumatic nondisplaced spondylolisthesis of second cervical vertebra, initial encounter for open fracture",
short_name: "Other traumatic nondisplaced spondylolisthesis of second cervical vertebra, initial encounter for open fracture",
category_name: "Other traumatic nondisplaced spondylolisthesis of second cervical vertebra, initial encounter for open fracture"
}
end
def _S12151D do
%ICDCode{full_code: "S12151D",
category_code: "S12",
short_code: "151D",
full_name: "Other traumatic nondisplaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other traumatic nondisplaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other traumatic nondisplaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12151G do
%ICDCode{full_code: "S12151G",
category_code: "S12",
short_code: "151G",
full_name: "Other traumatic nondisplaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other traumatic nondisplaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other traumatic nondisplaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12151K do
%ICDCode{full_code: "S12151K",
category_code: "S12",
short_code: "151K",
full_name: "Other traumatic nondisplaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other traumatic nondisplaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other traumatic nondisplaced spondylolisthesis of second cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12151S do
%ICDCode{full_code: "S12151S",
category_code: "S12",
short_code: "151S",
full_name: "Other traumatic nondisplaced spondylolisthesis of second cervical vertebra, sequela",
short_name: "Other traumatic nondisplaced spondylolisthesis of second cervical vertebra, sequela",
category_name: "Other traumatic nondisplaced spondylolisthesis of second cervical vertebra, sequela"
}
end
def _S12190A do
%ICDCode{full_code: "S12190A",
category_code: "S12",
short_code: "190A",
full_name: "Other displaced fracture of second cervical vertebra, initial encounter for closed fracture",
short_name: "Other displaced fracture of second cervical vertebra, initial encounter for closed fracture",
category_name: "Other displaced fracture of second cervical vertebra, initial encounter for closed fracture"
}
end
def _S12190B do
%ICDCode{full_code: "S12190B",
category_code: "S12",
short_code: "190B",
full_name: "Other displaced fracture of second cervical vertebra, initial encounter for open fracture",
short_name: "Other displaced fracture of second cervical vertebra, initial encounter for open fracture",
category_name: "Other displaced fracture of second cervical vertebra, initial encounter for open fracture"
}
end
def _S12190D do
%ICDCode{full_code: "S12190D",
category_code: "S12",
short_code: "190D",
full_name: "Other displaced fracture of second cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other displaced fracture of second cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other displaced fracture of second cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12190G do
%ICDCode{full_code: "S12190G",
category_code: "S12",
short_code: "190G",
full_name: "Other displaced fracture of second cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other displaced fracture of second cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other displaced fracture of second cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12190K do
%ICDCode{full_code: "S12190K",
category_code: "S12",
short_code: "190K",
full_name: "Other displaced fracture of second cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other displaced fracture of second cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other displaced fracture of second cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12190S do
%ICDCode{full_code: "S12190S",
category_code: "S12",
short_code: "190S",
full_name: "Other displaced fracture of second cervical vertebra, sequela",
short_name: "Other displaced fracture of second cervical vertebra, sequela",
category_name: "Other displaced fracture of second cervical vertebra, sequela"
}
end
def _S12191A do
%ICDCode{full_code: "S12191A",
category_code: "S12",
short_code: "191A",
full_name: "Other nondisplaced fracture of second cervical vertebra, initial encounter for closed fracture",
short_name: "Other nondisplaced fracture of second cervical vertebra, initial encounter for closed fracture",
category_name: "Other nondisplaced fracture of second cervical vertebra, initial encounter for closed fracture"
}
end
def _S12191B do
%ICDCode{full_code: "S12191B",
category_code: "S12",
short_code: "191B",
full_name: "Other nondisplaced fracture of second cervical vertebra, initial encounter for open fracture",
short_name: "Other nondisplaced fracture of second cervical vertebra, initial encounter for open fracture",
category_name: "Other nondisplaced fracture of second cervical vertebra, initial encounter for open fracture"
}
end
def _S12191D do
%ICDCode{full_code: "S12191D",
category_code: "S12",
short_code: "191D",
full_name: "Other nondisplaced fracture of second cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other nondisplaced fracture of second cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other nondisplaced fracture of second cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12191G do
%ICDCode{full_code: "S12191G",
category_code: "S12",
short_code: "191G",
full_name: "Other nondisplaced fracture of second cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other nondisplaced fracture of second cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other nondisplaced fracture of second cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12191K do
%ICDCode{full_code: "S12191K",
category_code: "S12",
short_code: "191K",
full_name: "Other nondisplaced fracture of second cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other nondisplaced fracture of second cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other nondisplaced fracture of second cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12191S do
%ICDCode{full_code: "S12191S",
category_code: "S12",
short_code: "191S",
full_name: "Other nondisplaced fracture of second cervical vertebra, sequela",
short_name: "Other nondisplaced fracture of second cervical vertebra, sequela",
category_name: "Other nondisplaced fracture of second cervical vertebra, sequela"
}
end
def _S12200A do
%ICDCode{full_code: "S12200A",
category_code: "S12",
short_code: "200A",
full_name: "Unspecified displaced fracture of third cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified displaced fracture of third cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified displaced fracture of third cervical vertebra, initial encounter for closed fracture"
}
end
def _S12200B do
%ICDCode{full_code: "S12200B",
category_code: "S12",
short_code: "200B",
full_name: "Unspecified displaced fracture of third cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified displaced fracture of third cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified displaced fracture of third cervical vertebra, initial encounter for open fracture"
}
end
def _S12200D do
%ICDCode{full_code: "S12200D",
category_code: "S12",
short_code: "200D",
full_name: "Unspecified displaced fracture of third cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified displaced fracture of third cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified displaced fracture of third cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12200G do
%ICDCode{full_code: "S12200G",
category_code: "S12",
short_code: "200G",
full_name: "Unspecified displaced fracture of third cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified displaced fracture of third cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified displaced fracture of third cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12200K do
%ICDCode{full_code: "S12200K",
category_code: "S12",
short_code: "200K",
full_name: "Unspecified displaced fracture of third cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified displaced fracture of third cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified displaced fracture of third cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12200S do
%ICDCode{full_code: "S12200S",
category_code: "S12",
short_code: "200S",
full_name: "Unspecified displaced fracture of third cervical vertebra, sequela",
short_name: "Unspecified displaced fracture of third cervical vertebra, sequela",
category_name: "Unspecified displaced fracture of third cervical vertebra, sequela"
}
end
def _S12201A do
%ICDCode{full_code: "S12201A",
category_code: "S12",
short_code: "201A",
full_name: "Unspecified nondisplaced fracture of third cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified nondisplaced fracture of third cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified nondisplaced fracture of third cervical vertebra, initial encounter for closed fracture"
}
end
def _S12201B do
%ICDCode{full_code: "S12201B",
category_code: "S12",
short_code: "201B",
full_name: "Unspecified nondisplaced fracture of third cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified nondisplaced fracture of third cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified nondisplaced fracture of third cervical vertebra, initial encounter for open fracture"
}
end
def _S12201D do
%ICDCode{full_code: "S12201D",
category_code: "S12",
short_code: "201D",
full_name: "Unspecified nondisplaced fracture of third cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified nondisplaced fracture of third cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified nondisplaced fracture of third cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12201G do
%ICDCode{full_code: "S12201G",
category_code: "S12",
short_code: "201G",
full_name: "Unspecified nondisplaced fracture of third cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified nondisplaced fracture of third cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified nondisplaced fracture of third cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12201K do
%ICDCode{full_code: "S12201K",
category_code: "S12",
short_code: "201K",
full_name: "Unspecified nondisplaced fracture of third cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified nondisplaced fracture of third cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified nondisplaced fracture of third cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12201S do
%ICDCode{full_code: "S12201S",
category_code: "S12",
short_code: "201S",
full_name: "Unspecified nondisplaced fracture of third cervical vertebra, sequela",
short_name: "Unspecified nondisplaced fracture of third cervical vertebra, sequela",
category_name: "Unspecified nondisplaced fracture of third cervical vertebra, sequela"
}
end
def _S12230A do
%ICDCode{full_code: "S12230A",
category_code: "S12",
short_code: "230A",
full_name: "Unspecified traumatic displaced spondylolisthesis of third cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified traumatic displaced spondylolisthesis of third cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified traumatic displaced spondylolisthesis of third cervical vertebra, initial encounter for closed fracture"
}
end
def _S12230B do
%ICDCode{full_code: "S12230B",
category_code: "S12",
short_code: "230B",
full_name: "Unspecified traumatic displaced spondylolisthesis of third cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified traumatic displaced spondylolisthesis of third cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified traumatic displaced spondylolisthesis of third cervical vertebra, initial encounter for open fracture"
}
end
def _S12230D do
%ICDCode{full_code: "S12230D",
category_code: "S12",
short_code: "230D",
full_name: "Unspecified traumatic displaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified traumatic displaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified traumatic displaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12230G do
%ICDCode{full_code: "S12230G",
category_code: "S12",
short_code: "230G",
full_name: "Unspecified traumatic displaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified traumatic displaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified traumatic displaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12230K do
%ICDCode{full_code: "S12230K",
category_code: "S12",
short_code: "230K",
full_name: "Unspecified traumatic displaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified traumatic displaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified traumatic displaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12230S do
%ICDCode{full_code: "S12230S",
category_code: "S12",
short_code: "230S",
full_name: "Unspecified traumatic displaced spondylolisthesis of third cervical vertebra, sequela",
short_name: "Unspecified traumatic displaced spondylolisthesis of third cervical vertebra, sequela",
category_name: "Unspecified traumatic displaced spondylolisthesis of third cervical vertebra, sequela"
}
end
def _S12231A do
%ICDCode{full_code: "S12231A",
category_code: "S12",
short_code: "231A",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of third cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of third cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of third cervical vertebra, initial encounter for closed fracture"
}
end
def _S12231B do
%ICDCode{full_code: "S12231B",
category_code: "S12",
short_code: "231B",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of third cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of third cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of third cervical vertebra, initial encounter for open fracture"
}
end
def _S12231D do
%ICDCode{full_code: "S12231D",
category_code: "S12",
short_code: "231D",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12231G do
%ICDCode{full_code: "S12231G",
category_code: "S12",
short_code: "231G",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12231K do
%ICDCode{full_code: "S12231K",
category_code: "S12",
short_code: "231K",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12231S do
%ICDCode{full_code: "S12231S",
category_code: "S12",
short_code: "231S",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of third cervical vertebra, sequela",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of third cervical vertebra, sequela",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of third cervical vertebra, sequela"
}
end
def _S1224XA do
%ICDCode{full_code: "S1224XA",
category_code: "S12",
short_code: "24XA",
full_name: "Type III traumatic spondylolisthesis of third cervical vertebra, initial encounter for closed fracture",
short_name: "Type III traumatic spondylolisthesis of third cervical vertebra, initial encounter for closed fracture",
category_name: "Type III traumatic spondylolisthesis of third cervical vertebra, initial encounter for closed fracture"
}
end
def _S1224XB do
%ICDCode{full_code: "S1224XB",
category_code: "S12",
short_code: "24XB",
full_name: "Type III traumatic spondylolisthesis of third cervical vertebra, initial encounter for open fracture",
short_name: "Type III traumatic spondylolisthesis of third cervical vertebra, initial encounter for open fracture",
category_name: "Type III traumatic spondylolisthesis of third cervical vertebra, initial encounter for open fracture"
}
end
def _S1224XD do
%ICDCode{full_code: "S1224XD",
category_code: "S12",
short_code: "24XD",
full_name: "Type III traumatic spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Type III traumatic spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Type III traumatic spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S1224XG do
%ICDCode{full_code: "S1224XG",
category_code: "S12",
short_code: "24XG",
full_name: "Type III traumatic spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Type III traumatic spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Type III traumatic spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S1224XK do
%ICDCode{full_code: "S1224XK",
category_code: "S12",
short_code: "24XK",
full_name: "Type III traumatic spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Type III traumatic spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Type III traumatic spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S1224XS do
%ICDCode{full_code: "S1224XS",
category_code: "S12",
short_code: "24XS",
full_name: "Type III traumatic spondylolisthesis of third cervical vertebra, sequela",
short_name: "Type III traumatic spondylolisthesis of third cervical vertebra, sequela",
category_name: "Type III traumatic spondylolisthesis of third cervical vertebra, sequela"
}
end
def _S12250A do
%ICDCode{full_code: "S12250A",
category_code: "S12",
short_code: "250A",
full_name: "Other traumatic displaced spondylolisthesis of third cervical vertebra, initial encounter for closed fracture",
short_name: "Other traumatic displaced spondylolisthesis of third cervical vertebra, initial encounter for closed fracture",
category_name: "Other traumatic displaced spondylolisthesis of third cervical vertebra, initial encounter for closed fracture"
}
end
def _S12250B do
%ICDCode{full_code: "S12250B",
category_code: "S12",
short_code: "250B",
full_name: "Other traumatic displaced spondylolisthesis of third cervical vertebra, initial encounter for open fracture",
short_name: "Other traumatic displaced spondylolisthesis of third cervical vertebra, initial encounter for open fracture",
category_name: "Other traumatic displaced spondylolisthesis of third cervical vertebra, initial encounter for open fracture"
}
end
def _S12250D do
%ICDCode{full_code: "S12250D",
category_code: "S12",
short_code: "250D",
full_name: "Other traumatic displaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other traumatic displaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other traumatic displaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12250G do
%ICDCode{full_code: "S12250G",
category_code: "S12",
short_code: "250G",
full_name: "Other traumatic displaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other traumatic displaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other traumatic displaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12250K do
%ICDCode{full_code: "S12250K",
category_code: "S12",
short_code: "250K",
full_name: "Other traumatic displaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other traumatic displaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other traumatic displaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12250S do
%ICDCode{full_code: "S12250S",
category_code: "S12",
short_code: "250S",
full_name: "Other traumatic displaced spondylolisthesis of third cervical vertebra, sequela",
short_name: "Other traumatic displaced spondylolisthesis of third cervical vertebra, sequela",
category_name: "Other traumatic displaced spondylolisthesis of third cervical vertebra, sequela"
}
end
def _S12251A do
%ICDCode{full_code: "S12251A",
category_code: "S12",
short_code: "251A",
full_name: "Other traumatic nondisplaced spondylolisthesis of third cervical vertebra, initial encounter for closed fracture",
short_name: "Other traumatic nondisplaced spondylolisthesis of third cervical vertebra, initial encounter for closed fracture",
category_name: "Other traumatic nondisplaced spondylolisthesis of third cervical vertebra, initial encounter for closed fracture"
}
end
def _S12251B do
%ICDCode{full_code: "S12251B",
category_code: "S12",
short_code: "251B",
full_name: "Other traumatic nondisplaced spondylolisthesis of third cervical vertebra, initial encounter for open fracture",
short_name: "Other traumatic nondisplaced spondylolisthesis of third cervical vertebra, initial encounter for open fracture",
category_name: "Other traumatic nondisplaced spondylolisthesis of third cervical vertebra, initial encounter for open fracture"
}
end
def _S12251D do
%ICDCode{full_code: "S12251D",
category_code: "S12",
short_code: "251D",
full_name: "Other traumatic nondisplaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other traumatic nondisplaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other traumatic nondisplaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12251G do
%ICDCode{full_code: "S12251G",
category_code: "S12",
short_code: "251G",
full_name: "Other traumatic nondisplaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other traumatic nondisplaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other traumatic nondisplaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12251K do
%ICDCode{full_code: "S12251K",
category_code: "S12",
short_code: "251K",
full_name: "Other traumatic nondisplaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other traumatic nondisplaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other traumatic nondisplaced spondylolisthesis of third cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12251S do
%ICDCode{full_code: "S12251S",
category_code: "S12",
short_code: "251S",
full_name: "Other traumatic nondisplaced spondylolisthesis of third cervical vertebra, sequela",
short_name: "Other traumatic nondisplaced spondylolisthesis of third cervical vertebra, sequela",
category_name: "Other traumatic nondisplaced spondylolisthesis of third cervical vertebra, sequela"
}
end
def _S12290A do
%ICDCode{full_code: "S12290A",
category_code: "S12",
short_code: "290A",
full_name: "Other displaced fracture of third cervical vertebra, initial encounter for closed fracture",
short_name: "Other displaced fracture of third cervical vertebra, initial encounter for closed fracture",
category_name: "Other displaced fracture of third cervical vertebra, initial encounter for closed fracture"
}
end
def _S12290B do
%ICDCode{full_code: "S12290B",
category_code: "S12",
short_code: "290B",
full_name: "Other displaced fracture of third cervical vertebra, initial encounter for open fracture",
short_name: "Other displaced fracture of third cervical vertebra, initial encounter for open fracture",
category_name: "Other displaced fracture of third cervical vertebra, initial encounter for open fracture"
}
end
def _S12290D do
%ICDCode{full_code: "S12290D",
category_code: "S12",
short_code: "290D",
full_name: "Other displaced fracture of third cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other displaced fracture of third cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other displaced fracture of third cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12290G do
%ICDCode{full_code: "S12290G",
category_code: "S12",
short_code: "290G",
full_name: "Other displaced fracture of third cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other displaced fracture of third cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other displaced fracture of third cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12290K do
%ICDCode{full_code: "S12290K",
category_code: "S12",
short_code: "290K",
full_name: "Other displaced fracture of third cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other displaced fracture of third cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other displaced fracture of third cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12290S do
%ICDCode{full_code: "S12290S",
category_code: "S12",
short_code: "290S",
full_name: "Other displaced fracture of third cervical vertebra, sequela",
short_name: "Other displaced fracture of third cervical vertebra, sequela",
category_name: "Other displaced fracture of third cervical vertebra, sequela"
}
end
def _S12291A do
%ICDCode{full_code: "S12291A",
category_code: "S12",
short_code: "291A",
full_name: "Other nondisplaced fracture of third cervical vertebra, initial encounter for closed fracture",
short_name: "Other nondisplaced fracture of third cervical vertebra, initial encounter for closed fracture",
category_name: "Other nondisplaced fracture of third cervical vertebra, initial encounter for closed fracture"
}
end
def _S12291B do
%ICDCode{full_code: "S12291B",
category_code: "S12",
short_code: "291B",
full_name: "Other nondisplaced fracture of third cervical vertebra, initial encounter for open fracture",
short_name: "Other nondisplaced fracture of third cervical vertebra, initial encounter for open fracture",
category_name: "Other nondisplaced fracture of third cervical vertebra, initial encounter for open fracture"
}
end
def _S12291D do
%ICDCode{full_code: "S12291D",
category_code: "S12",
short_code: "291D",
full_name: "Other nondisplaced fracture of third cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other nondisplaced fracture of third cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other nondisplaced fracture of third cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12291G do
%ICDCode{full_code: "S12291G",
category_code: "S12",
short_code: "291G",
full_name: "Other nondisplaced fracture of third cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other nondisplaced fracture of third cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other nondisplaced fracture of third cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12291K do
%ICDCode{full_code: "S12291K",
category_code: "S12",
short_code: "291K",
full_name: "Other nondisplaced fracture of third cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other nondisplaced fracture of third cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other nondisplaced fracture of third cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12291S do
%ICDCode{full_code: "S12291S",
category_code: "S12",
short_code: "291S",
full_name: "Other nondisplaced fracture of third cervical vertebra, sequela",
short_name: "Other nondisplaced fracture of third cervical vertebra, sequela",
category_name: "Other nondisplaced fracture of third cervical vertebra, sequela"
}
end
def _S12300A do
%ICDCode{full_code: "S12300A",
category_code: "S12",
short_code: "300A",
full_name: "Unspecified displaced fracture of fourth cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified displaced fracture of fourth cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified displaced fracture of fourth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12300B do
%ICDCode{full_code: "S12300B",
category_code: "S12",
short_code: "300B",
full_name: "Unspecified displaced fracture of fourth cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified displaced fracture of fourth cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified displaced fracture of fourth cervical vertebra, initial encounter for open fracture"
}
end
def _S12300D do
%ICDCode{full_code: "S12300D",
category_code: "S12",
short_code: "300D",
full_name: "Unspecified displaced fracture of fourth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified displaced fracture of fourth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified displaced fracture of fourth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12300G do
%ICDCode{full_code: "S12300G",
category_code: "S12",
short_code: "300G",
full_name: "Unspecified displaced fracture of fourth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified displaced fracture of fourth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified displaced fracture of fourth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12300K do
%ICDCode{full_code: "S12300K",
category_code: "S12",
short_code: "300K",
full_name: "Unspecified displaced fracture of fourth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified displaced fracture of fourth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified displaced fracture of fourth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12300S do
%ICDCode{full_code: "S12300S",
category_code: "S12",
short_code: "300S",
full_name: "Unspecified displaced fracture of fourth cervical vertebra, sequela",
short_name: "Unspecified displaced fracture of fourth cervical vertebra, sequela",
category_name: "Unspecified displaced fracture of fourth cervical vertebra, sequela"
}
end
def _S12301A do
%ICDCode{full_code: "S12301A",
category_code: "S12",
short_code: "301A",
full_name: "Unspecified nondisplaced fracture of fourth cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified nondisplaced fracture of fourth cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified nondisplaced fracture of fourth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12301B do
%ICDCode{full_code: "S12301B",
category_code: "S12",
short_code: "301B",
full_name: "Unspecified nondisplaced fracture of fourth cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified nondisplaced fracture of fourth cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified nondisplaced fracture of fourth cervical vertebra, initial encounter for open fracture"
}
end
def _S12301D do
%ICDCode{full_code: "S12301D",
category_code: "S12",
short_code: "301D",
full_name: "Unspecified nondisplaced fracture of fourth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified nondisplaced fracture of fourth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified nondisplaced fracture of fourth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12301G do
%ICDCode{full_code: "S12301G",
category_code: "S12",
short_code: "301G",
full_name: "Unspecified nondisplaced fracture of fourth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified nondisplaced fracture of fourth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified nondisplaced fracture of fourth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12301K do
%ICDCode{full_code: "S12301K",
category_code: "S12",
short_code: "301K",
full_name: "Unspecified nondisplaced fracture of fourth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified nondisplaced fracture of fourth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified nondisplaced fracture of fourth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12301S do
%ICDCode{full_code: "S12301S",
category_code: "S12",
short_code: "301S",
full_name: "Unspecified nondisplaced fracture of fourth cervical vertebra, sequela",
short_name: "Unspecified nondisplaced fracture of fourth cervical vertebra, sequela",
category_name: "Unspecified nondisplaced fracture of fourth cervical vertebra, sequela"
}
end
def _S12330A do
%ICDCode{full_code: "S12330A",
category_code: "S12",
short_code: "330A",
full_name: "Unspecified traumatic displaced spondylolisthesis of fourth cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified traumatic displaced spondylolisthesis of fourth cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified traumatic displaced spondylolisthesis of fourth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12330B do
%ICDCode{full_code: "S12330B",
category_code: "S12",
short_code: "330B",
full_name: "Unspecified traumatic displaced spondylolisthesis of fourth cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified traumatic displaced spondylolisthesis of fourth cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified traumatic displaced spondylolisthesis of fourth cervical vertebra, initial encounter for open fracture"
}
end
def _S12330D do
%ICDCode{full_code: "S12330D",
category_code: "S12",
short_code: "330D",
full_name: "Unspecified traumatic displaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified traumatic displaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified traumatic displaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12330G do
%ICDCode{full_code: "S12330G",
category_code: "S12",
short_code: "330G",
full_name: "Unspecified traumatic displaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified traumatic displaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified traumatic displaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12330K do
%ICDCode{full_code: "S12330K",
category_code: "S12",
short_code: "330K",
full_name: "Unspecified traumatic displaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified traumatic displaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified traumatic displaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12330S do
%ICDCode{full_code: "S12330S",
category_code: "S12",
short_code: "330S",
full_name: "Unspecified traumatic displaced spondylolisthesis of fourth cervical vertebra, sequela",
short_name: "Unspecified traumatic displaced spondylolisthesis of fourth cervical vertebra, sequela",
category_name: "Unspecified traumatic displaced spondylolisthesis of fourth cervical vertebra, sequela"
}
end
def _S12331A do
%ICDCode{full_code: "S12331A",
category_code: "S12",
short_code: "331A",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12331B do
%ICDCode{full_code: "S12331B",
category_code: "S12",
short_code: "331B",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, initial encounter for open fracture"
}
end
def _S12331D do
%ICDCode{full_code: "S12331D",
category_code: "S12",
short_code: "331D",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12331G do
%ICDCode{full_code: "S12331G",
category_code: "S12",
short_code: "331G",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12331K do
%ICDCode{full_code: "S12331K",
category_code: "S12",
short_code: "331K",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12331S do
%ICDCode{full_code: "S12331S",
category_code: "S12",
short_code: "331S",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, sequela",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, sequela",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, sequela"
}
end
def _S1234XA do
%ICDCode{full_code: "S1234XA",
category_code: "S12",
short_code: "34XA",
full_name: "Type III traumatic spondylolisthesis of fourth cervical vertebra, initial encounter for closed fracture",
short_name: "Type III traumatic spondylolisthesis of fourth cervical vertebra, initial encounter for closed fracture",
category_name: "Type III traumatic spondylolisthesis of fourth cervical vertebra, initial encounter for closed fracture"
}
end
def _S1234XB do
%ICDCode{full_code: "S1234XB",
category_code: "S12",
short_code: "34XB",
full_name: "Type III traumatic spondylolisthesis of fourth cervical vertebra, initial encounter for open fracture",
short_name: "Type III traumatic spondylolisthesis of fourth cervical vertebra, initial encounter for open fracture",
category_name: "Type III traumatic spondylolisthesis of fourth cervical vertebra, initial encounter for open fracture"
}
end
def _S1234XD do
%ICDCode{full_code: "S1234XD",
category_code: "S12",
short_code: "34XD",
full_name: "Type III traumatic spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Type III traumatic spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Type III traumatic spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S1234XG do
%ICDCode{full_code: "S1234XG",
category_code: "S12",
short_code: "34XG",
full_name: "Type III traumatic spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Type III traumatic spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Type III traumatic spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S1234XK do
%ICDCode{full_code: "S1234XK",
category_code: "S12",
short_code: "34XK",
full_name: "Type III traumatic spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Type III traumatic spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Type III traumatic spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S1234XS do
%ICDCode{full_code: "S1234XS",
category_code: "S12",
short_code: "34XS",
full_name: "Type III traumatic spondylolisthesis of fourth cervical vertebra, sequela",
short_name: "Type III traumatic spondylolisthesis of fourth cervical vertebra, sequela",
category_name: "Type III traumatic spondylolisthesis of fourth cervical vertebra, sequela"
}
end
def _S12350A do
%ICDCode{full_code: "S12350A",
category_code: "S12",
short_code: "350A",
full_name: "Other traumatic displaced spondylolisthesis of fourth cervical vertebra, initial encounter for closed fracture",
short_name: "Other traumatic displaced spondylolisthesis of fourth cervical vertebra, initial encounter for closed fracture",
category_name: "Other traumatic displaced spondylolisthesis of fourth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12350B do
%ICDCode{full_code: "S12350B",
category_code: "S12",
short_code: "350B",
full_name: "Other traumatic displaced spondylolisthesis of fourth cervical vertebra, initial encounter for open fracture",
short_name: "Other traumatic displaced spondylolisthesis of fourth cervical vertebra, initial encounter for open fracture",
category_name: "Other traumatic displaced spondylolisthesis of fourth cervical vertebra, initial encounter for open fracture"
}
end
def _S12350D do
%ICDCode{full_code: "S12350D",
category_code: "S12",
short_code: "350D",
full_name: "Other traumatic displaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other traumatic displaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other traumatic displaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12350G do
%ICDCode{full_code: "S12350G",
category_code: "S12",
short_code: "350G",
full_name: "Other traumatic displaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other traumatic displaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other traumatic displaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12350K do
%ICDCode{full_code: "S12350K",
category_code: "S12",
short_code: "350K",
full_name: "Other traumatic displaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other traumatic displaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other traumatic displaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12350S do
%ICDCode{full_code: "S12350S",
category_code: "S12",
short_code: "350S",
full_name: "Other traumatic displaced spondylolisthesis of fourth cervical vertebra, sequela",
short_name: "Other traumatic displaced spondylolisthesis of fourth cervical vertebra, sequela",
category_name: "Other traumatic displaced spondylolisthesis of fourth cervical vertebra, sequela"
}
end
def _S12351A do
%ICDCode{full_code: "S12351A",
category_code: "S12",
short_code: "351A",
full_name: "Other traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, initial encounter for closed fracture",
short_name: "Other traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, initial encounter for closed fracture",
category_name: "Other traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12351B do
%ICDCode{full_code: "S12351B",
category_code: "S12",
short_code: "351B",
full_name: "Other traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, initial encounter for open fracture",
short_name: "Other traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, initial encounter for open fracture",
category_name: "Other traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, initial encounter for open fracture"
}
end
def _S12351D do
%ICDCode{full_code: "S12351D",
category_code: "S12",
short_code: "351D",
full_name: "Other traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12351G do
%ICDCode{full_code: "S12351G",
category_code: "S12",
short_code: "351G",
full_name: "Other traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12351K do
%ICDCode{full_code: "S12351K",
category_code: "S12",
short_code: "351K",
full_name: "Other traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12351S do
%ICDCode{full_code: "S12351S",
category_code: "S12",
short_code: "351S",
full_name: "Other traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, sequela",
short_name: "Other traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, sequela",
category_name: "Other traumatic nondisplaced spondylolisthesis of fourth cervical vertebra, sequela"
}
end
def _S12390A do
%ICDCode{full_code: "S12390A",
category_code: "S12",
short_code: "390A",
full_name: "Other displaced fracture of fourth cervical vertebra, initial encounter for closed fracture",
short_name: "Other displaced fracture of fourth cervical vertebra, initial encounter for closed fracture",
category_name: "Other displaced fracture of fourth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12390B do
%ICDCode{full_code: "S12390B",
category_code: "S12",
short_code: "390B",
full_name: "Other displaced fracture of fourth cervical vertebra, initial encounter for open fracture",
short_name: "Other displaced fracture of fourth cervical vertebra, initial encounter for open fracture",
category_name: "Other displaced fracture of fourth cervical vertebra, initial encounter for open fracture"
}
end
def _S12390D do
%ICDCode{full_code: "S12390D",
category_code: "S12",
short_code: "390D",
full_name: "Other displaced fracture of fourth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other displaced fracture of fourth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other displaced fracture of fourth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12390G do
%ICDCode{full_code: "S12390G",
category_code: "S12",
short_code: "390G",
full_name: "Other displaced fracture of fourth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other displaced fracture of fourth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other displaced fracture of fourth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12390K do
%ICDCode{full_code: "S12390K",
category_code: "S12",
short_code: "390K",
full_name: "Other displaced fracture of fourth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other displaced fracture of fourth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other displaced fracture of fourth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12390S do
%ICDCode{full_code: "S12390S",
category_code: "S12",
short_code: "390S",
full_name: "Other displaced fracture of fourth cervical vertebra, sequela",
short_name: "Other displaced fracture of fourth cervical vertebra, sequela",
category_name: "Other displaced fracture of fourth cervical vertebra, sequela"
}
end
def _S12391A do
%ICDCode{full_code: "S12391A",
category_code: "S12",
short_code: "391A",
full_name: "Other nondisplaced fracture of fourth cervical vertebra, initial encounter for closed fracture",
short_name: "Other nondisplaced fracture of fourth cervical vertebra, initial encounter for closed fracture",
category_name: "Other nondisplaced fracture of fourth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12391B do
%ICDCode{full_code: "S12391B",
category_code: "S12",
short_code: "391B",
full_name: "Other nondisplaced fracture of fourth cervical vertebra, initial encounter for open fracture",
short_name: "Other nondisplaced fracture of fourth cervical vertebra, initial encounter for open fracture",
category_name: "Other nondisplaced fracture of fourth cervical vertebra, initial encounter for open fracture"
}
end
def _S12391D do
%ICDCode{full_code: "S12391D",
category_code: "S12",
short_code: "391D",
full_name: "Other nondisplaced fracture of fourth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other nondisplaced fracture of fourth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other nondisplaced fracture of fourth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12391G do
%ICDCode{full_code: "S12391G",
category_code: "S12",
short_code: "391G",
full_name: "Other nondisplaced fracture of fourth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other nondisplaced fracture of fourth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other nondisplaced fracture of fourth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12391K do
%ICDCode{full_code: "S12391K",
category_code: "S12",
short_code: "391K",
full_name: "Other nondisplaced fracture of fourth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other nondisplaced fracture of fourth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other nondisplaced fracture of fourth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12391S do
%ICDCode{full_code: "S12391S",
category_code: "S12",
short_code: "391S",
full_name: "Other nondisplaced fracture of fourth cervical vertebra, sequela",
short_name: "Other nondisplaced fracture of fourth cervical vertebra, sequela",
category_name: "Other nondisplaced fracture of fourth cervical vertebra, sequela"
}
end
def _S12400A do
%ICDCode{full_code: "S12400A",
category_code: "S12",
short_code: "400A",
full_name: "Unspecified displaced fracture of fifth cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified displaced fracture of fifth cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified displaced fracture of fifth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12400B do
%ICDCode{full_code: "S12400B",
category_code: "S12",
short_code: "400B",
full_name: "Unspecified displaced fracture of fifth cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified displaced fracture of fifth cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified displaced fracture of fifth cervical vertebra, initial encounter for open fracture"
}
end
def _S12400D do
%ICDCode{full_code: "S12400D",
category_code: "S12",
short_code: "400D",
full_name: "Unspecified displaced fracture of fifth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified displaced fracture of fifth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified displaced fracture of fifth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12400G do
%ICDCode{full_code: "S12400G",
category_code: "S12",
short_code: "400G",
full_name: "Unspecified displaced fracture of fifth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified displaced fracture of fifth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified displaced fracture of fifth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12400K do
%ICDCode{full_code: "S12400K",
category_code: "S12",
short_code: "400K",
full_name: "Unspecified displaced fracture of fifth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified displaced fracture of fifth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified displaced fracture of fifth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12400S do
%ICDCode{full_code: "S12400S",
category_code: "S12",
short_code: "400S",
full_name: "Unspecified displaced fracture of fifth cervical vertebra, sequela",
short_name: "Unspecified displaced fracture of fifth cervical vertebra, sequela",
category_name: "Unspecified displaced fracture of fifth cervical vertebra, sequela"
}
end
def _S12401A do
%ICDCode{full_code: "S12401A",
category_code: "S12",
short_code: "401A",
full_name: "Unspecified nondisplaced fracture of fifth cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified nondisplaced fracture of fifth cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified nondisplaced fracture of fifth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12401B do
%ICDCode{full_code: "S12401B",
category_code: "S12",
short_code: "401B",
full_name: "Unspecified nondisplaced fracture of fifth cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified nondisplaced fracture of fifth cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified nondisplaced fracture of fifth cervical vertebra, initial encounter for open fracture"
}
end
def _S12401D do
%ICDCode{full_code: "S12401D",
category_code: "S12",
short_code: "401D",
full_name: "Unspecified nondisplaced fracture of fifth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified nondisplaced fracture of fifth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified nondisplaced fracture of fifth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12401G do
%ICDCode{full_code: "S12401G",
category_code: "S12",
short_code: "401G",
full_name: "Unspecified nondisplaced fracture of fifth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified nondisplaced fracture of fifth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified nondisplaced fracture of fifth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12401K do
%ICDCode{full_code: "S12401K",
category_code: "S12",
short_code: "401K",
full_name: "Unspecified nondisplaced fracture of fifth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified nondisplaced fracture of fifth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified nondisplaced fracture of fifth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12401S do
%ICDCode{full_code: "S12401S",
category_code: "S12",
short_code: "401S",
full_name: "Unspecified nondisplaced fracture of fifth cervical vertebra, sequela",
short_name: "Unspecified nondisplaced fracture of fifth cervical vertebra, sequela",
category_name: "Unspecified nondisplaced fracture of fifth cervical vertebra, sequela"
}
end
def _S12430A do
%ICDCode{full_code: "S12430A",
category_code: "S12",
short_code: "430A",
full_name: "Unspecified traumatic displaced spondylolisthesis of fifth cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified traumatic displaced spondylolisthesis of fifth cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified traumatic displaced spondylolisthesis of fifth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12430B do
%ICDCode{full_code: "S12430B",
category_code: "S12",
short_code: "430B",
full_name: "Unspecified traumatic displaced spondylolisthesis of fifth cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified traumatic displaced spondylolisthesis of fifth cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified traumatic displaced spondylolisthesis of fifth cervical vertebra, initial encounter for open fracture"
}
end
def _S12430D do
%ICDCode{full_code: "S12430D",
category_code: "S12",
short_code: "430D",
full_name: "Unspecified traumatic displaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified traumatic displaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified traumatic displaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12430G do
%ICDCode{full_code: "S12430G",
category_code: "S12",
short_code: "430G",
full_name: "Unspecified traumatic displaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified traumatic displaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified traumatic displaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12430K do
%ICDCode{full_code: "S12430K",
category_code: "S12",
short_code: "430K",
full_name: "Unspecified traumatic displaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified traumatic displaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified traumatic displaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12430S do
%ICDCode{full_code: "S12430S",
category_code: "S12",
short_code: "430S",
full_name: "Unspecified traumatic displaced spondylolisthesis of fifth cervical vertebra, sequela",
short_name: "Unspecified traumatic displaced spondylolisthesis of fifth cervical vertebra, sequela",
category_name: "Unspecified traumatic displaced spondylolisthesis of fifth cervical vertebra, sequela"
}
end
def _S12431A do
%ICDCode{full_code: "S12431A",
category_code: "S12",
short_code: "431A",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12431B do
%ICDCode{full_code: "S12431B",
category_code: "S12",
short_code: "431B",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, initial encounter for open fracture"
}
end
def _S12431D do
%ICDCode{full_code: "S12431D",
category_code: "S12",
short_code: "431D",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12431G do
%ICDCode{full_code: "S12431G",
category_code: "S12",
short_code: "431G",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12431K do
%ICDCode{full_code: "S12431K",
category_code: "S12",
short_code: "431K",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12431S do
%ICDCode{full_code: "S12431S",
category_code: "S12",
short_code: "431S",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, sequela",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, sequela",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, sequela"
}
end
def _S1244XA do
%ICDCode{full_code: "S1244XA",
category_code: "S12",
short_code: "44XA",
full_name: "Type III traumatic spondylolisthesis of fifth cervical vertebra, initial encounter for closed fracture",
short_name: "Type III traumatic spondylolisthesis of fifth cervical vertebra, initial encounter for closed fracture",
category_name: "Type III traumatic spondylolisthesis of fifth cervical vertebra, initial encounter for closed fracture"
}
end
def _S1244XB do
%ICDCode{full_code: "S1244XB",
category_code: "S12",
short_code: "44XB",
full_name: "Type III traumatic spondylolisthesis of fifth cervical vertebra, initial encounter for open fracture",
short_name: "Type III traumatic spondylolisthesis of fifth cervical vertebra, initial encounter for open fracture",
category_name: "Type III traumatic spondylolisthesis of fifth cervical vertebra, initial encounter for open fracture"
}
end
def _S1244XD do
%ICDCode{full_code: "S1244XD",
category_code: "S12",
short_code: "44XD",
full_name: "Type III traumatic spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Type III traumatic spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Type III traumatic spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S1244XG do
%ICDCode{full_code: "S1244XG",
category_code: "S12",
short_code: "44XG",
full_name: "Type III traumatic spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Type III traumatic spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Type III traumatic spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S1244XK do
%ICDCode{full_code: "S1244XK",
category_code: "S12",
short_code: "44XK",
full_name: "Type III traumatic spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Type III traumatic spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Type III traumatic spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S1244XS do
%ICDCode{full_code: "S1244XS",
category_code: "S12",
short_code: "44XS",
full_name: "Type III traumatic spondylolisthesis of fifth cervical vertebra, sequela",
short_name: "Type III traumatic spondylolisthesis of fifth cervical vertebra, sequela",
category_name: "Type III traumatic spondylolisthesis of fifth cervical vertebra, sequela"
}
end
def _S12450A do
%ICDCode{full_code: "S12450A",
category_code: "S12",
short_code: "450A",
full_name: "Other traumatic displaced spondylolisthesis of fifth cervical vertebra, initial encounter for closed fracture",
short_name: "Other traumatic displaced spondylolisthesis of fifth cervical vertebra, initial encounter for closed fracture",
category_name: "Other traumatic displaced spondylolisthesis of fifth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12450B do
%ICDCode{full_code: "S12450B",
category_code: "S12",
short_code: "450B",
full_name: "Other traumatic displaced spondylolisthesis of fifth cervical vertebra, initial encounter for open fracture",
short_name: "Other traumatic displaced spondylolisthesis of fifth cervical vertebra, initial encounter for open fracture",
category_name: "Other traumatic displaced spondylolisthesis of fifth cervical vertebra, initial encounter for open fracture"
}
end
def _S12450D do
%ICDCode{full_code: "S12450D",
category_code: "S12",
short_code: "450D",
full_name: "Other traumatic displaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other traumatic displaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other traumatic displaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12450G do
%ICDCode{full_code: "S12450G",
category_code: "S12",
short_code: "450G",
full_name: "Other traumatic displaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other traumatic displaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other traumatic displaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12450K do
%ICDCode{full_code: "S12450K",
category_code: "S12",
short_code: "450K",
full_name: "Other traumatic displaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other traumatic displaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other traumatic displaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12450S do
%ICDCode{full_code: "S12450S",
category_code: "S12",
short_code: "450S",
full_name: "Other traumatic displaced spondylolisthesis of fifth cervical vertebra, sequela",
short_name: "Other traumatic displaced spondylolisthesis of fifth cervical vertebra, sequela",
category_name: "Other traumatic displaced spondylolisthesis of fifth cervical vertebra, sequela"
}
end
def _S12451A do
%ICDCode{full_code: "S12451A",
category_code: "S12",
short_code: "451A",
full_name: "Other traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, initial encounter for closed fracture",
short_name: "Other traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, initial encounter for closed fracture",
category_name: "Other traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12451B do
%ICDCode{full_code: "S12451B",
category_code: "S12",
short_code: "451B",
full_name: "Other traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, initial encounter for open fracture",
short_name: "Other traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, initial encounter for open fracture",
category_name: "Other traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, initial encounter for open fracture"
}
end
def _S12451D do
%ICDCode{full_code: "S12451D",
category_code: "S12",
short_code: "451D",
full_name: "Other traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12451G do
%ICDCode{full_code: "S12451G",
category_code: "S12",
short_code: "451G",
full_name: "Other traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12451K do
%ICDCode{full_code: "S12451K",
category_code: "S12",
short_code: "451K",
full_name: "Other traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12451S do
%ICDCode{full_code: "S12451S",
category_code: "S12",
short_code: "451S",
full_name: "Other traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, sequela",
short_name: "Other traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, sequela",
category_name: "Other traumatic nondisplaced spondylolisthesis of fifth cervical vertebra, sequela"
}
end
def _S12490A do
%ICDCode{full_code: "S12490A",
category_code: "S12",
short_code: "490A",
full_name: "Other displaced fracture of fifth cervical vertebra, initial encounter for closed fracture",
short_name: "Other displaced fracture of fifth cervical vertebra, initial encounter for closed fracture",
category_name: "Other displaced fracture of fifth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12490B do
%ICDCode{full_code: "S12490B",
category_code: "S12",
short_code: "490B",
full_name: "Other displaced fracture of fifth cervical vertebra, initial encounter for open fracture",
short_name: "Other displaced fracture of fifth cervical vertebra, initial encounter for open fracture",
category_name: "Other displaced fracture of fifth cervical vertebra, initial encounter for open fracture"
}
end
def _S12490D do
%ICDCode{full_code: "S12490D",
category_code: "S12",
short_code: "490D",
full_name: "Other displaced fracture of fifth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other displaced fracture of fifth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other displaced fracture of fifth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12490G do
%ICDCode{full_code: "S12490G",
category_code: "S12",
short_code: "490G",
full_name: "Other displaced fracture of fifth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other displaced fracture of fifth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other displaced fracture of fifth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12490K do
%ICDCode{full_code: "S12490K",
category_code: "S12",
short_code: "490K",
full_name: "Other displaced fracture of fifth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other displaced fracture of fifth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other displaced fracture of fifth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12490S do
%ICDCode{full_code: "S12490S",
category_code: "S12",
short_code: "490S",
full_name: "Other displaced fracture of fifth cervical vertebra, sequela",
short_name: "Other displaced fracture of fifth cervical vertebra, sequela",
category_name: "Other displaced fracture of fifth cervical vertebra, sequela"
}
end
def _S12491A do
%ICDCode{full_code: "S12491A",
category_code: "S12",
short_code: "491A",
full_name: "Other nondisplaced fracture of fifth cervical vertebra, initial encounter for closed fracture",
short_name: "Other nondisplaced fracture of fifth cervical vertebra, initial encounter for closed fracture",
category_name: "Other nondisplaced fracture of fifth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12491B do
%ICDCode{full_code: "S12491B",
category_code: "S12",
short_code: "491B",
full_name: "Other nondisplaced fracture of fifth cervical vertebra, initial encounter for open fracture",
short_name: "Other nondisplaced fracture of fifth cervical vertebra, initial encounter for open fracture",
category_name: "Other nondisplaced fracture of fifth cervical vertebra, initial encounter for open fracture"
}
end
def _S12491D do
%ICDCode{full_code: "S12491D",
category_code: "S12",
short_code: "491D",
full_name: "Other nondisplaced fracture of fifth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other nondisplaced fracture of fifth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other nondisplaced fracture of fifth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12491G do
%ICDCode{full_code: "S12491G",
category_code: "S12",
short_code: "491G",
full_name: "Other nondisplaced fracture of fifth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other nondisplaced fracture of fifth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other nondisplaced fracture of fifth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12491K do
%ICDCode{full_code: "S12491K",
category_code: "S12",
short_code: "491K",
full_name: "Other nondisplaced fracture of fifth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other nondisplaced fracture of fifth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other nondisplaced fracture of fifth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12491S do
%ICDCode{full_code: "S12491S",
category_code: "S12",
short_code: "491S",
full_name: "Other nondisplaced fracture of fifth cervical vertebra, sequela",
short_name: "Other nondisplaced fracture of fifth cervical vertebra, sequela",
category_name: "Other nondisplaced fracture of fifth cervical vertebra, sequela"
}
end
def _S12500A do
%ICDCode{full_code: "S12500A",
category_code: "S12",
short_code: "500A",
full_name: "Unspecified displaced fracture of sixth cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified displaced fracture of sixth cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified displaced fracture of sixth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12500B do
%ICDCode{full_code: "S12500B",
category_code: "S12",
short_code: "500B",
full_name: "Unspecified displaced fracture of sixth cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified displaced fracture of sixth cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified displaced fracture of sixth cervical vertebra, initial encounter for open fracture"
}
end
def _S12500D do
%ICDCode{full_code: "S12500D",
category_code: "S12",
short_code: "500D",
full_name: "Unspecified displaced fracture of sixth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified displaced fracture of sixth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified displaced fracture of sixth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12500G do
%ICDCode{full_code: "S12500G",
category_code: "S12",
short_code: "500G",
full_name: "Unspecified displaced fracture of sixth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified displaced fracture of sixth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified displaced fracture of sixth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12500K do
%ICDCode{full_code: "S12500K",
category_code: "S12",
short_code: "500K",
full_name: "Unspecified displaced fracture of sixth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified displaced fracture of sixth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified displaced fracture of sixth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12500S do
%ICDCode{full_code: "S12500S",
category_code: "S12",
short_code: "500S",
full_name: "Unspecified displaced fracture of sixth cervical vertebra, sequela",
short_name: "Unspecified displaced fracture of sixth cervical vertebra, sequela",
category_name: "Unspecified displaced fracture of sixth cervical vertebra, sequela"
}
end
def _S12501A do
%ICDCode{full_code: "S12501A",
category_code: "S12",
short_code: "501A",
full_name: "Unspecified nondisplaced fracture of sixth cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified nondisplaced fracture of sixth cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified nondisplaced fracture of sixth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12501B do
%ICDCode{full_code: "S12501B",
category_code: "S12",
short_code: "501B",
full_name: "Unspecified nondisplaced fracture of sixth cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified nondisplaced fracture of sixth cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified nondisplaced fracture of sixth cervical vertebra, initial encounter for open fracture"
}
end
def _S12501D do
%ICDCode{full_code: "S12501D",
category_code: "S12",
short_code: "501D",
full_name: "Unspecified nondisplaced fracture of sixth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified nondisplaced fracture of sixth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified nondisplaced fracture of sixth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12501G do
%ICDCode{full_code: "S12501G",
category_code: "S12",
short_code: "501G",
full_name: "Unspecified nondisplaced fracture of sixth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified nondisplaced fracture of sixth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified nondisplaced fracture of sixth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12501K do
%ICDCode{full_code: "S12501K",
category_code: "S12",
short_code: "501K",
full_name: "Unspecified nondisplaced fracture of sixth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified nondisplaced fracture of sixth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified nondisplaced fracture of sixth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12501S do
%ICDCode{full_code: "S12501S",
category_code: "S12",
short_code: "501S",
full_name: "Unspecified nondisplaced fracture of sixth cervical vertebra, sequela",
short_name: "Unspecified nondisplaced fracture of sixth cervical vertebra, sequela",
category_name: "Unspecified nondisplaced fracture of sixth cervical vertebra, sequela"
}
end
def _S12530A do
%ICDCode{full_code: "S12530A",
category_code: "S12",
short_code: "530A",
full_name: "Unspecified traumatic displaced spondylolisthesis of sixth cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified traumatic displaced spondylolisthesis of sixth cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified traumatic displaced spondylolisthesis of sixth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12530B do
%ICDCode{full_code: "S12530B",
category_code: "S12",
short_code: "530B",
full_name: "Unspecified traumatic displaced spondylolisthesis of sixth cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified traumatic displaced spondylolisthesis of sixth cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified traumatic displaced spondylolisthesis of sixth cervical vertebra, initial encounter for open fracture"
}
end
def _S12530D do
%ICDCode{full_code: "S12530D",
category_code: "S12",
short_code: "530D",
full_name: "Unspecified traumatic displaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified traumatic displaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified traumatic displaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12530G do
%ICDCode{full_code: "S12530G",
category_code: "S12",
short_code: "530G",
full_name: "Unspecified traumatic displaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified traumatic displaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified traumatic displaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12530K do
%ICDCode{full_code: "S12530K",
category_code: "S12",
short_code: "530K",
full_name: "Unspecified traumatic displaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified traumatic displaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified traumatic displaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12530S do
%ICDCode{full_code: "S12530S",
category_code: "S12",
short_code: "530S",
full_name: "Unspecified traumatic displaced spondylolisthesis of sixth cervical vertebra, sequela",
short_name: "Unspecified traumatic displaced spondylolisthesis of sixth cervical vertebra, sequela",
category_name: "Unspecified traumatic displaced spondylolisthesis of sixth cervical vertebra, sequela"
}
end
def _S12531A do
%ICDCode{full_code: "S12531A",
category_code: "S12",
short_code: "531A",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12531B do
%ICDCode{full_code: "S12531B",
category_code: "S12",
short_code: "531B",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, initial encounter for open fracture"
}
end
def _S12531D do
%ICDCode{full_code: "S12531D",
category_code: "S12",
short_code: "531D",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12531G do
%ICDCode{full_code: "S12531G",
category_code: "S12",
short_code: "531G",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12531K do
%ICDCode{full_code: "S12531K",
category_code: "S12",
short_code: "531K",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12531S do
%ICDCode{full_code: "S12531S",
category_code: "S12",
short_code: "531S",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, sequela",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, sequela",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, sequela"
}
end
def _S1254XA do
%ICDCode{full_code: "S1254XA",
category_code: "S12",
short_code: "54XA",
full_name: "Type III traumatic spondylolisthesis of sixth cervical vertebra, initial encounter for closed fracture",
short_name: "Type III traumatic spondylolisthesis of sixth cervical vertebra, initial encounter for closed fracture",
category_name: "Type III traumatic spondylolisthesis of sixth cervical vertebra, initial encounter for closed fracture"
}
end
def _S1254XB do
%ICDCode{full_code: "S1254XB",
category_code: "S12",
short_code: "54XB",
full_name: "Type III traumatic spondylolisthesis of sixth cervical vertebra, initial encounter for open fracture",
short_name: "Type III traumatic spondylolisthesis of sixth cervical vertebra, initial encounter for open fracture",
category_name: "Type III traumatic spondylolisthesis of sixth cervical vertebra, initial encounter for open fracture"
}
end
def _S1254XD do
%ICDCode{full_code: "S1254XD",
category_code: "S12",
short_code: "54XD",
full_name: "Type III traumatic spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Type III traumatic spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Type III traumatic spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S1254XG do
%ICDCode{full_code: "S1254XG",
category_code: "S12",
short_code: "54XG",
full_name: "Type III traumatic spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Type III traumatic spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Type III traumatic spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S1254XK do
%ICDCode{full_code: "S1254XK",
category_code: "S12",
short_code: "54XK",
full_name: "Type III traumatic spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Type III traumatic spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Type III traumatic spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S1254XS do
%ICDCode{full_code: "S1254XS",
category_code: "S12",
short_code: "54XS",
full_name: "Type III traumatic spondylolisthesis of sixth cervical vertebra, sequela",
short_name: "Type III traumatic spondylolisthesis of sixth cervical vertebra, sequela",
category_name: "Type III traumatic spondylolisthesis of sixth cervical vertebra, sequela"
}
end
def _S12550A do
%ICDCode{full_code: "S12550A",
category_code: "S12",
short_code: "550A",
full_name: "Other traumatic displaced spondylolisthesis of sixth cervical vertebra, initial encounter for closed fracture",
short_name: "Other traumatic displaced spondylolisthesis of sixth cervical vertebra, initial encounter for closed fracture",
category_name: "Other traumatic displaced spondylolisthesis of sixth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12550B do
%ICDCode{full_code: "S12550B",
category_code: "S12",
short_code: "550B",
full_name: "Other traumatic displaced spondylolisthesis of sixth cervical vertebra, initial encounter for open fracture",
short_name: "Other traumatic displaced spondylolisthesis of sixth cervical vertebra, initial encounter for open fracture",
category_name: "Other traumatic displaced spondylolisthesis of sixth cervical vertebra, initial encounter for open fracture"
}
end
def _S12550D do
%ICDCode{full_code: "S12550D",
category_code: "S12",
short_code: "550D",
full_name: "Other traumatic displaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other traumatic displaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other traumatic displaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12550G do
%ICDCode{full_code: "S12550G",
category_code: "S12",
short_code: "550G",
full_name: "Other traumatic displaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other traumatic displaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other traumatic displaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12550K do
%ICDCode{full_code: "S12550K",
category_code: "S12",
short_code: "550K",
full_name: "Other traumatic displaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other traumatic displaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other traumatic displaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12550S do
%ICDCode{full_code: "S12550S",
category_code: "S12",
short_code: "550S",
full_name: "Other traumatic displaced spondylolisthesis of sixth cervical vertebra, sequela",
short_name: "Other traumatic displaced spondylolisthesis of sixth cervical vertebra, sequela",
category_name: "Other traumatic displaced spondylolisthesis of sixth cervical vertebra, sequela"
}
end
def _S12551A do
%ICDCode{full_code: "S12551A",
category_code: "S12",
short_code: "551A",
full_name: "Other traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, initial encounter for closed fracture",
short_name: "Other traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, initial encounter for closed fracture",
category_name: "Other traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12551B do
%ICDCode{full_code: "S12551B",
category_code: "S12",
short_code: "551B",
full_name: "Other traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, initial encounter for open fracture",
short_name: "Other traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, initial encounter for open fracture",
category_name: "Other traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, initial encounter for open fracture"
}
end
def _S12551D do
%ICDCode{full_code: "S12551D",
category_code: "S12",
short_code: "551D",
full_name: "Other traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12551G do
%ICDCode{full_code: "S12551G",
category_code: "S12",
short_code: "551G",
full_name: "Other traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12551K do
%ICDCode{full_code: "S12551K",
category_code: "S12",
short_code: "551K",
full_name: "Other traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12551S do
%ICDCode{full_code: "S12551S",
category_code: "S12",
short_code: "551S",
full_name: "Other traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, sequela",
short_name: "Other traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, sequela",
category_name: "Other traumatic nondisplaced spondylolisthesis of sixth cervical vertebra, sequela"
}
end
def _S12590A do
%ICDCode{full_code: "S12590A",
category_code: "S12",
short_code: "590A",
full_name: "Other displaced fracture of sixth cervical vertebra, initial encounter for closed fracture",
short_name: "Other displaced fracture of sixth cervical vertebra, initial encounter for closed fracture",
category_name: "Other displaced fracture of sixth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12590B do
%ICDCode{full_code: "S12590B",
category_code: "S12",
short_code: "590B",
full_name: "Other displaced fracture of sixth cervical vertebra, initial encounter for open fracture",
short_name: "Other displaced fracture of sixth cervical vertebra, initial encounter for open fracture",
category_name: "Other displaced fracture of sixth cervical vertebra, initial encounter for open fracture"
}
end
def _S12590D do
%ICDCode{full_code: "S12590D",
category_code: "S12",
short_code: "590D",
full_name: "Other displaced fracture of sixth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other displaced fracture of sixth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other displaced fracture of sixth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12590G do
%ICDCode{full_code: "S12590G",
category_code: "S12",
short_code: "590G",
full_name: "Other displaced fracture of sixth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other displaced fracture of sixth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other displaced fracture of sixth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12590K do
%ICDCode{full_code: "S12590K",
category_code: "S12",
short_code: "590K",
full_name: "Other displaced fracture of sixth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other displaced fracture of sixth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other displaced fracture of sixth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12590S do
%ICDCode{full_code: "S12590S",
category_code: "S12",
short_code: "590S",
full_name: "Other displaced fracture of sixth cervical vertebra, sequela",
short_name: "Other displaced fracture of sixth cervical vertebra, sequela",
category_name: "Other displaced fracture of sixth cervical vertebra, sequela"
}
end
def _S12591A do
%ICDCode{full_code: "S12591A",
category_code: "S12",
short_code: "591A",
full_name: "Other nondisplaced fracture of sixth cervical vertebra, initial encounter for closed fracture",
short_name: "Other nondisplaced fracture of sixth cervical vertebra, initial encounter for closed fracture",
category_name: "Other nondisplaced fracture of sixth cervical vertebra, initial encounter for closed fracture"
}
end
def _S12591B do
%ICDCode{full_code: "S12591B",
category_code: "S12",
short_code: "591B",
full_name: "Other nondisplaced fracture of sixth cervical vertebra, initial encounter for open fracture",
short_name: "Other nondisplaced fracture of sixth cervical vertebra, initial encounter for open fracture",
category_name: "Other nondisplaced fracture of sixth cervical vertebra, initial encounter for open fracture"
}
end
def _S12591D do
%ICDCode{full_code: "S12591D",
category_code: "S12",
short_code: "591D",
full_name: "Other nondisplaced fracture of sixth cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other nondisplaced fracture of sixth cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other nondisplaced fracture of sixth cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12591G do
%ICDCode{full_code: "S12591G",
category_code: "S12",
short_code: "591G",
full_name: "Other nondisplaced fracture of sixth cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other nondisplaced fracture of sixth cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other nondisplaced fracture of sixth cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12591K do
%ICDCode{full_code: "S12591K",
category_code: "S12",
short_code: "591K",
full_name: "Other nondisplaced fracture of sixth cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other nondisplaced fracture of sixth cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other nondisplaced fracture of sixth cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12591S do
%ICDCode{full_code: "S12591S",
category_code: "S12",
short_code: "591S",
full_name: "Other nondisplaced fracture of sixth cervical vertebra, sequela",
short_name: "Other nondisplaced fracture of sixth cervical vertebra, sequela",
category_name: "Other nondisplaced fracture of sixth cervical vertebra, sequela"
}
end
def _S12600A do
%ICDCode{full_code: "S12600A",
category_code: "S12",
short_code: "600A",
full_name: "Unspecified displaced fracture of seventh cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified displaced fracture of seventh cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified displaced fracture of seventh cervical vertebra, initial encounter for closed fracture"
}
end
def _S12600B do
%ICDCode{full_code: "S12600B",
category_code: "S12",
short_code: "600B",
full_name: "Unspecified displaced fracture of seventh cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified displaced fracture of seventh cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified displaced fracture of seventh cervical vertebra, initial encounter for open fracture"
}
end
def _S12600D do
%ICDCode{full_code: "S12600D",
category_code: "S12",
short_code: "600D",
full_name: "Unspecified displaced fracture of seventh cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified displaced fracture of seventh cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified displaced fracture of seventh cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12600G do
%ICDCode{full_code: "S12600G",
category_code: "S12",
short_code: "600G",
full_name: "Unspecified displaced fracture of seventh cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified displaced fracture of seventh cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified displaced fracture of seventh cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12600K do
%ICDCode{full_code: "S12600K",
category_code: "S12",
short_code: "600K",
full_name: "Unspecified displaced fracture of seventh cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified displaced fracture of seventh cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified displaced fracture of seventh cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12600S do
%ICDCode{full_code: "S12600S",
category_code: "S12",
short_code: "600S",
full_name: "Unspecified displaced fracture of seventh cervical vertebra, sequela",
short_name: "Unspecified displaced fracture of seventh cervical vertebra, sequela",
category_name: "Unspecified displaced fracture of seventh cervical vertebra, sequela"
}
end
def _S12601A do
%ICDCode{full_code: "S12601A",
category_code: "S12",
short_code: "601A",
full_name: "Unspecified nondisplaced fracture of seventh cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified nondisplaced fracture of seventh cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified nondisplaced fracture of seventh cervical vertebra, initial encounter for closed fracture"
}
end
def _S12601B do
%ICDCode{full_code: "S12601B",
category_code: "S12",
short_code: "601B",
full_name: "Unspecified nondisplaced fracture of seventh cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified nondisplaced fracture of seventh cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified nondisplaced fracture of seventh cervical vertebra, initial encounter for open fracture"
}
end
def _S12601D do
%ICDCode{full_code: "S12601D",
category_code: "S12",
short_code: "601D",
full_name: "Unspecified nondisplaced fracture of seventh cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified nondisplaced fracture of seventh cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified nondisplaced fracture of seventh cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12601G do
%ICDCode{full_code: "S12601G",
category_code: "S12",
short_code: "601G",
full_name: "Unspecified nondisplaced fracture of seventh cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified nondisplaced fracture of seventh cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified nondisplaced fracture of seventh cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12601K do
%ICDCode{full_code: "S12601K",
category_code: "S12",
short_code: "601K",
full_name: "Unspecified nondisplaced fracture of seventh cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified nondisplaced fracture of seventh cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified nondisplaced fracture of seventh cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12601S do
%ICDCode{full_code: "S12601S",
category_code: "S12",
short_code: "601S",
full_name: "Unspecified nondisplaced fracture of seventh cervical vertebra, sequela",
short_name: "Unspecified nondisplaced fracture of seventh cervical vertebra, sequela",
category_name: "Unspecified nondisplaced fracture of seventh cervical vertebra, sequela"
}
end
def _S12630A do
%ICDCode{full_code: "S12630A",
category_code: "S12",
short_code: "630A",
full_name: "Unspecified traumatic displaced spondylolisthesis of seventh cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified traumatic displaced spondylolisthesis of seventh cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified traumatic displaced spondylolisthesis of seventh cervical vertebra, initial encounter for closed fracture"
}
end
def _S12630B do
%ICDCode{full_code: "S12630B",
category_code: "S12",
short_code: "630B",
full_name: "Unspecified traumatic displaced spondylolisthesis of seventh cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified traumatic displaced spondylolisthesis of seventh cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified traumatic displaced spondylolisthesis of seventh cervical vertebra, initial encounter for open fracture"
}
end
def _S12630D do
%ICDCode{full_code: "S12630D",
category_code: "S12",
short_code: "630D",
full_name: "Unspecified traumatic displaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified traumatic displaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified traumatic displaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12630G do
%ICDCode{full_code: "S12630G",
category_code: "S12",
short_code: "630G",
full_name: "Unspecified traumatic displaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified traumatic displaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified traumatic displaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12630K do
%ICDCode{full_code: "S12630K",
category_code: "S12",
short_code: "630K",
full_name: "Unspecified traumatic displaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified traumatic displaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified traumatic displaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12630S do
%ICDCode{full_code: "S12630S",
category_code: "S12",
short_code: "630S",
full_name: "Unspecified traumatic displaced spondylolisthesis of seventh cervical vertebra, sequela",
short_name: "Unspecified traumatic displaced spondylolisthesis of seventh cervical vertebra, sequela",
category_name: "Unspecified traumatic displaced spondylolisthesis of seventh cervical vertebra, sequela"
}
end
def _S12631A do
%ICDCode{full_code: "S12631A",
category_code: "S12",
short_code: "631A",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, initial encounter for closed fracture",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, initial encounter for closed fracture",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, initial encounter for closed fracture"
}
end
def _S12631B do
%ICDCode{full_code: "S12631B",
category_code: "S12",
short_code: "631B",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, initial encounter for open fracture",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, initial encounter for open fracture",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, initial encounter for open fracture"
}
end
def _S12631D do
%ICDCode{full_code: "S12631D",
category_code: "S12",
short_code: "631D",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12631G do
%ICDCode{full_code: "S12631G",
category_code: "S12",
short_code: "631G",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12631K do
%ICDCode{full_code: "S12631K",
category_code: "S12",
short_code: "631K",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12631S do
%ICDCode{full_code: "S12631S",
category_code: "S12",
short_code: "631S",
full_name: "Unspecified traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, sequela",
short_name: "Unspecified traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, sequela",
category_name: "Unspecified traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, sequela"
}
end
def _S1264XA do
%ICDCode{full_code: "S1264XA",
category_code: "S12",
short_code: "64XA",
full_name: "Type III traumatic spondylolisthesis of seventh cervical vertebra, initial encounter for closed fracture",
short_name: "Type III traumatic spondylolisthesis of seventh cervical vertebra, initial encounter for closed fracture",
category_name: "Type III traumatic spondylolisthesis of seventh cervical vertebra, initial encounter for closed fracture"
}
end
def _S1264XB do
%ICDCode{full_code: "S1264XB",
category_code: "S12",
short_code: "64XB",
full_name: "Type III traumatic spondylolisthesis of seventh cervical vertebra, initial encounter for open fracture",
short_name: "Type III traumatic spondylolisthesis of seventh cervical vertebra, initial encounter for open fracture",
category_name: "Type III traumatic spondylolisthesis of seventh cervical vertebra, initial encounter for open fracture"
}
end
def _S1264XD do
%ICDCode{full_code: "S1264XD",
category_code: "S12",
short_code: "64XD",
full_name: "Type III traumatic spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Type III traumatic spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Type III traumatic spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S1264XG do
%ICDCode{full_code: "S1264XG",
category_code: "S12",
short_code: "64XG",
full_name: "Type III traumatic spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Type III traumatic spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Type III traumatic spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S1264XK do
%ICDCode{full_code: "S1264XK",
category_code: "S12",
short_code: "64XK",
full_name: "Type III traumatic spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Type III traumatic spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Type III traumatic spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S1264XS do
%ICDCode{full_code: "S1264XS",
category_code: "S12",
short_code: "64XS",
full_name: "Type III traumatic spondylolisthesis of seventh cervical vertebra, sequela",
short_name: "Type III traumatic spondylolisthesis of seventh cervical vertebra, sequela",
category_name: "Type III traumatic spondylolisthesis of seventh cervical vertebra, sequela"
}
end
def _S12650A do
%ICDCode{full_code: "S12650A",
category_code: "S12",
short_code: "650A",
full_name: "Other traumatic displaced spondylolisthesis of seventh cervical vertebra, initial encounter for closed fracture",
short_name: "Other traumatic displaced spondylolisthesis of seventh cervical vertebra, initial encounter for closed fracture",
category_name: "Other traumatic displaced spondylolisthesis of seventh cervical vertebra, initial encounter for closed fracture"
}
end
def _S12650B do
%ICDCode{full_code: "S12650B",
category_code: "S12",
short_code: "650B",
full_name: "Other traumatic displaced spondylolisthesis of seventh cervical vertebra, initial encounter for open fracture",
short_name: "Other traumatic displaced spondylolisthesis of seventh cervical vertebra, initial encounter for open fracture",
category_name: "Other traumatic displaced spondylolisthesis of seventh cervical vertebra, initial encounter for open fracture"
}
end
def _S12650D do
%ICDCode{full_code: "S12650D",
category_code: "S12",
short_code: "650D",
full_name: "Other traumatic displaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other traumatic displaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other traumatic displaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12650G do
%ICDCode{full_code: "S12650G",
category_code: "S12",
short_code: "650G",
full_name: "Other traumatic displaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other traumatic displaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other traumatic displaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12650K do
%ICDCode{full_code: "S12650K",
category_code: "S12",
short_code: "650K",
full_name: "Other traumatic displaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other traumatic displaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other traumatic displaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12650S do
%ICDCode{full_code: "S12650S",
category_code: "S12",
short_code: "650S",
full_name: "Other traumatic displaced spondylolisthesis of seventh cervical vertebra, sequela",
short_name: "Other traumatic displaced spondylolisthesis of seventh cervical vertebra, sequela",
category_name: "Other traumatic displaced spondylolisthesis of seventh cervical vertebra, sequela"
}
end
def _S12651A do
%ICDCode{full_code: "S12651A",
category_code: "S12",
short_code: "651A",
full_name: "Other traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, initial encounter for closed fracture",
short_name: "Other traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, initial encounter for closed fracture",
category_name: "Other traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, initial encounter for closed fracture"
}
end
def _S12651B do
%ICDCode{full_code: "S12651B",
category_code: "S12",
short_code: "651B",
full_name: "Other traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, initial encounter for open fracture",
short_name: "Other traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, initial encounter for open fracture",
category_name: "Other traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, initial encounter for open fracture"
}
end
def _S12651D do
%ICDCode{full_code: "S12651D",
category_code: "S12",
short_code: "651D",
full_name: "Other traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12651G do
%ICDCode{full_code: "S12651G",
category_code: "S12",
short_code: "651G",
full_name: "Other traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12651K do
%ICDCode{full_code: "S12651K",
category_code: "S12",
short_code: "651K",
full_name: "Other traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12651S do
%ICDCode{full_code: "S12651S",
category_code: "S12",
short_code: "651S",
full_name: "Other traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, sequela",
short_name: "Other traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, sequela",
category_name: "Other traumatic nondisplaced spondylolisthesis of seventh cervical vertebra, sequela"
}
end
def _S12690A do
%ICDCode{full_code: "S12690A",
category_code: "S12",
short_code: "690A",
full_name: "Other displaced fracture of seventh cervical vertebra, initial encounter for closed fracture",
short_name: "Other displaced fracture of seventh cervical vertebra, initial encounter for closed fracture",
category_name: "Other displaced fracture of seventh cervical vertebra, initial encounter for closed fracture"
}
end
def _S12690B do
%ICDCode{full_code: "S12690B",
category_code: "S12",
short_code: "690B",
full_name: "Other displaced fracture of seventh cervical vertebra, initial encounter for open fracture",
short_name: "Other displaced fracture of seventh cervical vertebra, initial encounter for open fracture",
category_name: "Other displaced fracture of seventh cervical vertebra, initial encounter for open fracture"
}
end
def _S12690D do
%ICDCode{full_code: "S12690D",
category_code: "S12",
short_code: "690D",
full_name: "Other displaced fracture of seventh cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other displaced fracture of seventh cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other displaced fracture of seventh cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12690G do
%ICDCode{full_code: "S12690G",
category_code: "S12",
short_code: "690G",
full_name: "Other displaced fracture of seventh cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other displaced fracture of seventh cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other displaced fracture of seventh cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12690K do
%ICDCode{full_code: "S12690K",
category_code: "S12",
short_code: "690K",
full_name: "Other displaced fracture of seventh cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other displaced fracture of seventh cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other displaced fracture of seventh cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12690S do
%ICDCode{full_code: "S12690S",
category_code: "S12",
short_code: "690S",
full_name: "Other displaced fracture of seventh cervical vertebra, sequela",
short_name: "Other displaced fracture of seventh cervical vertebra, sequela",
category_name: "Other displaced fracture of seventh cervical vertebra, sequela"
}
end
def _S12691A do
%ICDCode{full_code: "S12691A",
category_code: "S12",
short_code: "691A",
full_name: "Other nondisplaced fracture of seventh cervical vertebra, initial encounter for closed fracture",
short_name: "Other nondisplaced fracture of seventh cervical vertebra, initial encounter for closed fracture",
category_name: "Other nondisplaced fracture of seventh cervical vertebra, initial encounter for closed fracture"
}
end
def _S12691B do
%ICDCode{full_code: "S12691B",
category_code: "S12",
short_code: "691B",
full_name: "Other nondisplaced fracture of seventh cervical vertebra, initial encounter for open fracture",
short_name: "Other nondisplaced fracture of seventh cervical vertebra, initial encounter for open fracture",
category_name: "Other nondisplaced fracture of seventh cervical vertebra, initial encounter for open fracture"
}
end
def _S12691D do
%ICDCode{full_code: "S12691D",
category_code: "S12",
short_code: "691D",
full_name: "Other nondisplaced fracture of seventh cervical vertebra, subsequent encounter for fracture with routine healing",
short_name: "Other nondisplaced fracture of seventh cervical vertebra, subsequent encounter for fracture with routine healing",
category_name: "Other nondisplaced fracture of seventh cervical vertebra, subsequent encounter for fracture with routine healing"
}
end
def _S12691G do
%ICDCode{full_code: "S12691G",
category_code: "S12",
short_code: "691G",
full_name: "Other nondisplaced fracture of seventh cervical vertebra, subsequent encounter for fracture with delayed healing",
short_name: "Other nondisplaced fracture of seventh cervical vertebra, subsequent encounter for fracture with delayed healing",
category_name: "Other nondisplaced fracture of seventh cervical vertebra, subsequent encounter for fracture with delayed healing"
}
end
def _S12691K do
%ICDCode{full_code: "S12691K",
category_code: "S12",
short_code: "691K",
full_name: "Other nondisplaced fracture of seventh cervical vertebra, subsequent encounter for fracture with nonunion",
short_name: "Other nondisplaced fracture of seventh cervical vertebra, subsequent encounter for fracture with nonunion",
category_name: "Other nondisplaced fracture of seventh cervical vertebra, subsequent encounter for fracture with nonunion"
}
end
def _S12691S do
%ICDCode{full_code: "S12691S",
category_code: "S12",
short_code: "691S",
full_name: "Other nondisplaced fracture of seventh cervical vertebra, sequela",
short_name: "Other nondisplaced fracture of seventh cervical vertebra, sequela",
category_name: "Other nondisplaced fracture of seventh cervical vertebra, sequela"
}
end
def _S128XXA do
%ICDCode{full_code: "S128XXA",
category_code: "S12",
short_code: "8XXA",
full_name: "Fracture of other parts of neck, initial encounter",
short_name: "Fracture of other parts of neck, initial encounter",
category_name: "Fracture of other parts of neck, initial encounter"
}
end
def _S128XXD do
%ICDCode{full_code: "S128XXD",
category_code: "S12",
short_code: "8XXD",
full_name: "Fracture of other parts of neck, subsequent encounter",
short_name: "Fracture of other parts of neck, subsequent encounter",
category_name: "Fracture of other parts of neck, subsequent encounter"
}
end
def _S128XXS do
%ICDCode{full_code: "S128XXS",
category_code: "S12",
short_code: "8XXS",
full_name: "Fracture of other parts of neck, sequela",
short_name: "Fracture of other parts of neck, sequela",
category_name: "Fracture of other parts of neck, sequela"
}
end
def _S129XXA do
%ICDCode{full_code: "S129XXA",
category_code: "S12",
short_code: "9XXA",
full_name: "Fracture of neck, unspecified, initial encounter",
short_name: "Fracture of neck, unspecified, initial encounter",
category_name: "Fracture of neck, unspecified, initial encounter"
}
end
def _S129XXD do
%ICDCode{full_code: "S129XXD",
category_code: "S12",
short_code: "9XXD",
full_name: "Fracture of neck, unspecified, subsequent encounter",
short_name: "Fracture of neck, unspecified, subsequent encounter",
category_name: "Fracture of neck, unspecified, subsequent encounter"
}
end
def _S129XXS do
%ICDCode{full_code: "S129XXS",
category_code: "S12",
short_code: "9XXS",
full_name: "Fracture of neck, unspecified, sequela",
short_name: "Fracture of neck, unspecified, sequela",
category_name: "Fracture of neck, unspecified, sequela"
}
end
end
| 57.171112
| 164
| 0.718046
|
93a2557657479aa83eb5baff8abeeaae8dcb5ad0
| 8,256
|
ex
|
Elixir
|
apps/schema_stitch/lib/query_generator.ex
|
mattbaker/absinthe-schema-stitching-example
|
361b4e374786245dbb5087c3fe297211154fdccd
|
[
"Apache-2.0"
] | 1
|
2020-08-13T05:08:26.000Z
|
2020-08-13T05:08:26.000Z
|
apps/schema_stitch/lib/query_generator.ex
|
mattbaker/absinthe-schema-stitching-example
|
361b4e374786245dbb5087c3fe297211154fdccd
|
[
"Apache-2.0"
] | null | null | null |
apps/schema_stitch/lib/query_generator.ex
|
mattbaker/absinthe-schema-stitching-example
|
361b4e374786245dbb5087c3fe297211154fdccd
|
[
"Apache-2.0"
] | 1
|
2020-08-13T05:06:35.000Z
|
2020-08-13T05:06:35.000Z
|
# Copyright (c) New Relic Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
defmodule SchemaStitch.QueryGenerator do
@moduledoc """
Takes an Absinthe resolution struct and generates the relevant GraphQL query and variables.
"""
alias Absinthe.Blueprint
@typename_field %Blueprint.Document.Field{name: "__typename"}
def render(%{definition: tree, path: path, fragments: fragments}) do
root_operation_node = List.last(path)
used_fragments = gather_fragments(tree, fragments)
used_variables = gather_variables(tree, used_fragments)
query = build_query(tree, root_operation_node, used_variables, used_fragments)
{query, used_variables}
end
defp gather_fragments(tree, fragments) do
used_fragments = gather_tree_fragments(tree, fragments)
Enum.filter(fragments, fn {name, _fragment} -> name in used_fragments end)
|> Enum.into(%{})
end
defp gather_tree_fragments(%{selections: selections}, fragments) do
Enum.flat_map(selections, &gather_tree_fragments(&1, fragments))
end
defp gather_tree_fragments(%Blueprint.Document.Fragment.Spread{name: name}, fragments) do
[name | gather_tree_fragments(fragments[name], fragments)]
end
def gather_variables(tree, fragments) do
(gather_tree_variables(tree) ++ gather_fragment_variables(fragments))
|> Enum.into(%{})
end
defp gather_tree_variables(%Blueprint.Document.Field{arguments: arguments, selections: []}) do
gather_arguments(arguments)
end
defp gather_tree_variables(%Blueprint.Document.Field{
arguments: arguments,
selections: selections
}) do
argument_names = gather_arguments(arguments)
Enum.reduce(selections, argument_names, fn selection, acc ->
acc ++ gather_tree_variables(selection)
end)
end
defp gather_tree_variables(%{selections: selections}) do
Enum.reduce(selections, [], fn selection, acc ->
acc ++ gather_tree_variables(selection)
end)
end
defp gather_tree_variables(_) do
[]
end
defp gather_fragment_variables(fragments) do
Enum.reduce(fragments, [], fn {_name, fragment}, acc ->
acc ++ gather_tree_variables(fragment)
end)
end
def gather_arguments(arguments) do
arguments
|> Enum.map(&select_variable_arguments/1)
|> List.flatten()
|> Enum.reject(&is_nil/1)
end
defp select_variable_arguments(%{
input_value: %{
raw: %Blueprint.Input.RawValue{content: %Blueprint.Input.Variable{name: name}},
data: data
}
}) do
{name, data}
end
defp select_variable_arguments(%{
input_value: %{
normalized: %Absinthe.Blueprint.Input.Object{fields: fields}
}
}) do
Enum.map(fields, &select_variable_arguments(&1))
end
defp select_variable_arguments(_argument) do
nil
end
@indent_increment 2
defp build_query(tree, root_operation_node, used_variables, fragments) do
root_operation_type = build_operation_type(root_operation_node)
root_operation_name = build_operation_name(root_operation_node)
root_operation_variables = build_operation_variables(root_operation_node, used_variables)
field_selection = build_field_selection(tree, @indent_increment)
spread_fragments = build_fragments(fragments)
"#{root_operation_type}#{root_operation_name}#{root_operation_variables} " <>
"{\n#{field_selection}\n}#{spread_fragments}"
end
defp build_operation_type(%Blueprint.Document.Operation{type: operation_type}) do
"#{operation_type}"
end
defp build_operation_name(%Blueprint.Document.Operation{name: nil}) do
""
end
defp build_operation_name(%Blueprint.Document.Operation{name: operation_name}) do
" #{operation_name}"
end
defp build_operation_variables(
%Blueprint.Document.Operation{variable_definitions: variable_definitions},
used_variables
) do
used_variable_names = Map.keys(used_variables)
variable_definitions
|> Enum.filter(&(&1.name in used_variable_names))
|> Enum.map(&build_operation_variable_definition/1)
|> Enum.join(", ")
|> case do
"" -> ""
variables -> "(#{variables})"
end
end
defp build_operation_variable_definition(%Blueprint.Document.VariableDefinition{
name: name,
type: type
}) do
"$#{name}: #{build_variable_typename(type)}"
end
defp build_variable_typename(%Blueprint.TypeReference.NonNull{of_type: of_type}) do
build_variable_typename(of_type) <> "!"
end
defp build_variable_typename(%Blueprint.TypeReference.List{of_type: of_type}) do
"[" <> build_variable_typename(of_type) <> "]"
end
defp build_variable_typename(%Blueprint.TypeReference.Name{name: typename}) do
typename
end
defp build_field_selection(
%Blueprint.Document.Fragment.Inline{
selections: children,
schema_node: %{name: type_name}
},
indent_level
) do
indent = String.duplicate(" ", indent_level)
subtree =
Enum.map(children, &build_field_selection(&1, indent_level + @indent_increment))
|> Enum.join("\n")
"#{indent}... on #{type_name} {\n#{subtree}\n#{indent}}"
end
defp build_field_selection(
%Blueprint.Document.Field{selections: []} = blueprint_node,
indent_level
) do
String.duplicate(" ", indent_level) <> build_field_name(blueprint_node)
end
defp build_field_selection(
%Blueprint.Document.Field{selections: children} = blueprint_node,
indent_level
) do
indent = String.duplicate(" ", indent_level)
field_name = build_field_name(blueprint_node)
subtree =
[@typename_field | children]
|> Enum.map(&build_field_selection(&1, indent_level + @indent_increment))
|> Enum.join("\n")
"#{indent}#{field_name} {\n#{subtree}\n#{indent}}"
end
defp build_field_selection(
%Blueprint.Document.Fragment.Spread{name: fragment_name},
indent_level
) do
indent = String.duplicate(" ", indent_level)
"#{indent}...#{fragment_name}"
end
defp build_field_name(%Blueprint.Document.Field{name: name, arguments: args}) do
args
|> exclude_args_with_default_values
|> case do
[] -> name
used_input_args -> "#{name}(#{build_input_args(used_input_args)})"
end
end
defp exclude_args_with_default_values(args) do
Enum.reject(args, fn
%{
input_value: %Blueprint.Input.Value{
normalized: %Absinthe.Blueprint.Input.Generated{}
}
} ->
true
_ ->
false
end)
end
defp build_input_args(args) do
Enum.map(args, &build_input_arg(&1)) |> Enum.join(", ")
end
defp build_input_arg(%{
name: arg_name,
input_value: input_value
}) do
"#{arg_name}: #{build_input_value(input_value)}"
end
defp build_input_value(%Blueprint.Input.Value{
raw: %Blueprint.Input.RawValue{content: %Blueprint.Input.Variable{name: var_name}}
}) do
"$#{var_name}"
end
defp build_input_value(%Blueprint.Input.Value{
normalized: %Blueprint.Input.String{value: value}
}) do
"\"#{value}\""
end
defp build_input_value(%Blueprint.Input.Value{
normalized: %Blueprint.Input.Object{fields: sub_fields}
}) do
"{ #{build_input_args(sub_fields)} }"
end
defp build_input_value(%Blueprint.Input.Value{
normalized: %Blueprint.Input.List{items: items}
}) do
list_items = Enum.map(items, &build_input_value/1) |> Enum.join(", ")
"[ #{list_items} ]"
end
defp build_input_value(%Blueprint.Input.Value{
normalized: %Blueprint.Input.Null{}
}) do
"null"
end
defp build_input_value(%Blueprint.Input.Value{normalized: %{value: value}}) do
value
end
defp build_fragments(fragments) do
Enum.map(fragments, &build_fragment(&1))
|> Enum.join("")
end
defp build_fragment(
{fragment_name, %{type_condition: %{name: type_name}, selections: children}}
) do
subtree = Enum.map(children, &build_field_selection(&1, @indent_increment)) |> Enum.join("\n")
"\n\nfragment #{fragment_name} on #{type_name} {\n#{subtree}\n}"
end
end
| 28.371134
| 98
| 0.680354
|
93a25eddeb1e940b7a14f1d86cd1cf78a1d2b673
| 350
|
exs
|
Elixir
|
test/controllers/application_controller_test.exs
|
nemanja-m/matrix
|
92298697827f30a2d6ba144004c1668fe70b760e
|
[
"MIT"
] | null | null | null |
test/controllers/application_controller_test.exs
|
nemanja-m/matrix
|
92298697827f30a2d6ba144004c1668fe70b760e
|
[
"MIT"
] | null | null | null |
test/controllers/application_controller_test.exs
|
nemanja-m/matrix
|
92298697827f30a2d6ba144004c1668fe70b760e
|
[
"MIT"
] | null | null | null |
defmodule Matrix.ApplicationControllerTest do
use Matrix.ConnCase
setup %{conn: conn} do
conn = put_req_header(conn, "content-type", "application/json")
{:ok, conn: conn}
end
describe "GET /index" do
it "renders index.html", %{conn: conn} do
conn = get conn, "/"
assert html_response(conn, 200)
end
end
end
| 18.421053
| 67
| 0.648571
|
93a2c3ae83600abb8a744a294fecbef1032d96c4
| 161
|
ex
|
Elixir
|
lib/woolen_sockets_data/position.ex
|
elliotthilaire/woolen-sockets
|
86040cf4aa97ec979db7e15c3cbe84dd4818eaf0
|
[
"MIT"
] | 6
|
2017-09-05T10:34:48.000Z
|
2019-06-20T05:04:52.000Z
|
lib/woolen_sockets_data/position.ex
|
elliotthilaire/woolen-sockets
|
86040cf4aa97ec979db7e15c3cbe84dd4818eaf0
|
[
"MIT"
] | null | null | null |
lib/woolen_sockets_data/position.ex
|
elliotthilaire/woolen-sockets
|
86040cf4aa97ec979db7e15c3cbe84dd4818eaf0
|
[
"MIT"
] | null | null | null |
defmodule WoolenSocketsData.Position do
alias WoolenSocketsData.Position
defstruct [ :x, :y ]
@type t :: %Position{
x: float,
y: float
}
end
| 12.384615
| 39
| 0.652174
|
93a2de2cad89fbd4ad320dcdba95266ae09e2982
| 71
|
ex
|
Elixir
|
web/views/layout_view.ex
|
norikakip/exfile_sample
|
1da5e24ef39d8bac50c44823eaed75dfb6e2dcb6
|
[
"MIT"
] | 1
|
2016-01-23T04:11:44.000Z
|
2016-01-23T04:11:44.000Z
|
web/views/layout_view.ex
|
norikakip/exfile_sample
|
1da5e24ef39d8bac50c44823eaed75dfb6e2dcb6
|
[
"MIT"
] | null | null | null |
web/views/layout_view.ex
|
norikakip/exfile_sample
|
1da5e24ef39d8bac50c44823eaed75dfb6e2dcb6
|
[
"MIT"
] | null | null | null |
defmodule ExfileSample.LayoutView do
use ExfileSample.Web, :view
end
| 17.75
| 36
| 0.816901
|
93a2e5dfe9574ff36ec63b2d1eef9fc3b00e9cc0
| 1,756
|
exs
|
Elixir
|
config/ueberauth-local.exs
|
DaveMuirhead/naboo-server
|
daf15d9b92ad6a3f85eb42bdbe7125c489a079c1
|
[
"Apache-2.0"
] | null | null | null |
config/ueberauth-local.exs
|
DaveMuirhead/naboo-server
|
daf15d9b92ad6a3f85eb42bdbe7125c489a079c1
|
[
"Apache-2.0"
] | null | null | null |
config/ueberauth-local.exs
|
DaveMuirhead/naboo-server
|
daf15d9b92ad6a3f85eb42bdbe7125c489a079c1
|
[
"Apache-2.0"
] | null | null | null |
use Mix.Config
config :ueberauth, Ueberauth,
base_path: "/v1/auth",
providers: [
# facebook: {Ueberauth.Strategy.Facebook, []},
# github: {Ueberauth.Strategy.Github, [default_scope: "user:email"]},
google:
{Ueberauth.Strategy.Google,
[
default_scope: "email profile",
callbak_methods: ["POST"]
]},
identity:
{Ueberauth.Strategy.Identity,
[
uid_field: :email,
callback_methods: ["POST"]
]},
# slack: {Ueberauth.Strategy.Slack, []},
# twitter: {Ueberauth.Strategy.Twitter, []}
]
#config :ueberauth, Ueberauth.Strategy.Facebook.OAuth,
# client_id: System.get_env("FACEBOOK_APP_ID"),
# client_secret: System.get_env("FACEBOOK_APP_SECRET"),
# redirect_uri: System.get_env("FACEBOOK_REDIRECT_URI")
#config :ueberauth, Ueberauth.Strategy.Github.OAuth,
# client_id: System.get_env("GITHUB_CLIENT_ID"),
# client_secret: System.get_env("GITHUB_CLIENT_SECRET")
config :ueberauth, Ueberauth.Strategy.Google.OAuth,
client_id: System.get_env("GOOGLE_CLIENT_ID"),
client_secret: System.get_env("GOOGLE_CLIENT_SECRET")
# redirect_uri: System.get_env("GOOGLE_REDIRECT_URI")
#config :ueberauth, Ueberauth.Strategy.Slack.OAuth,
# client_id: System.get_env("SLACK_CLIENT_ID"),
# client_secret: System.get_env("SLACK_CLIENT_SECRET")
#config :ueberauth, Ueberauth.Strategy.Twitter.OAuth,
# consumer_key: System.get_env("TWITTER_CONSUMER_KEY"),
# consumer_secret: System.get_env("TWITTER_CONSUMER_SECRET")
config :naboo, Naboo.Auth.Guardian,
allowed_algos: ["HS512"],
issuer: "Naboo",
ttl: {2, :days},
allowed_drift: 2000,
verify_issuer: true,
secret_key: "bbOSDNSPINjOJWQNgt3fA9ny3RxLdyd12aaPM202vyjNZ7Rl2zlBtHmGqyHSHReM",
serializer: Naboo.Auth.Guardian
| 32.518519
| 81
| 0.727221
|
93a35d4c7f1f433888220f58e9c686d454d3bdd5
| 122
|
exs
|
Elixir
|
test/elixir_beep_test.exs
|
raphaelahrens/elixir_beep
|
4e94a2aaccb6f2c6b38d3d57bb9e8af4b9392f2d
|
[
"BSD-2-Clause"
] | null | null | null |
test/elixir_beep_test.exs
|
raphaelahrens/elixir_beep
|
4e94a2aaccb6f2c6b38d3d57bb9e8af4b9392f2d
|
[
"BSD-2-Clause"
] | null | null | null |
test/elixir_beep_test.exs
|
raphaelahrens/elixir_beep
|
4e94a2aaccb6f2c6b38d3d57bb9e8af4b9392f2d
|
[
"BSD-2-Clause"
] | null | null | null |
defmodule ElixirBeepTest do
use ExUnit.Case
doctest ElixirBeep
test "the truth" do
assert 1 + 1 == 2
end
end
| 13.555556
| 27
| 0.688525
|
93a369033624501218eab36c9a687fa639680ee7
| 1,573
|
exs
|
Elixir
|
mix.exs
|
skeleton-elixir/skeleton_soft_delete
|
b8333a6b67bd65a7f02a7c9826418095e66ce5c5
|
[
"MIT"
] | 2
|
2020-10-01T22:41:35.000Z
|
2020-10-01T23:01:34.000Z
|
mix.exs
|
skeleton-elixir/skeleton_soft_delete
|
b8333a6b67bd65a7f02a7c9826418095e66ce5c5
|
[
"MIT"
] | 4
|
2020-06-27T20:13:11.000Z
|
2021-02-20T20:04:14.000Z
|
mix.exs
|
skeleton-elixir/skeleton_soft_delete
|
b8333a6b67bd65a7f02a7c9826418095e66ce5c5
|
[
"MIT"
] | null | null | null |
defmodule SkeletonSoftDelete.MixProject do
use Mix.Project
@version "1.0.0"
@source_url "https://github.com/skeleton-elixir/skeleton_soft_delete"
@maintainers [
"Diego Nogueira",
"Jhonathas Matos"
]
def project do
[
name: "SkeletonSoftDelete",
app: :skeleton_soft_delete,
version: @version,
elixir: "~> 1.8",
elixirc_paths: elixirc_paths(Mix.env()),
package: package(),
source_url: @source_url,
maintainers: @maintainers,
description: description(),
start_permanent: Mix.env() == :prod,
deps: deps(),
aliases: aliases()
]
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
[
{:ecto_sql, "~> 3.0"},
{:postgrex, ">= 0.0.0"}
]
end
defp description do
"O Skeleton SoftDelete ajuda no tratamento de dados excluídos em sua aplicação, onde, nada é realmente deletado."
end
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
defp package do
[
maintainers: @maintainers,
licenses: ["MIT"],
files: ~w(lib CHANGELOG.md LICENSE mix.exs README.md),
links: %{
"GitHub" => @source_url,
"Changelog" => "#{@source_url}/blob/master/CHANGELOG.md"
}
]
end
defp aliases do
[
test: [
"ecto.create --quiet",
"ecto.migrate --quiet",
"test"
]
]
end
end
| 21.847222
| 117
| 0.595677
|
93a369baacbbd412574b3710bf4654801a24841e
| 630
|
exs
|
Elixir
|
test/pointing_party_web/controllers/page_controller_test.exs
|
smarinskaya/pointing-party
|
9259d662eb460d9fbd65655f61ed1d78ad69eede
|
[
"Apache-2.0"
] | 11
|
2019-07-27T19:22:22.000Z
|
2020-11-25T05:57:07.000Z
|
test/pointing_party_web/controllers/page_controller_test.exs
|
smarinskaya/pointing-party
|
9259d662eb460d9fbd65655f61ed1d78ad69eede
|
[
"Apache-2.0"
] | 2
|
2019-07-10T20:47:10.000Z
|
2019-08-11T15:04:53.000Z
|
test/pointing_party_web/controllers/page_controller_test.exs
|
smarinskaya/pointing-party
|
9259d662eb460d9fbd65655f61ed1d78ad69eede
|
[
"Apache-2.0"
] | 2
|
2019-08-29T05:18:33.000Z
|
2019-10-05T00:15:39.000Z
|
defmodule PointingPartyWeb.PageControllerTest do
use PointingPartyWeb.ConnCase
@username "test_user"
describe "authenticated user" do
setup %{conn: conn} do
conn = Plug.Conn.assign(conn, :username, @username)
{:ok, %{conn: conn}}
end
test "GET / renders the page with log out link", %{conn: conn} do
conn = get(conn, "/")
assert html_response(conn, 200) =~ "Log Out"
end
end
describe "unauthenticated user" do
test "GET / renders the page with log in link", %{conn: conn} do
conn = get(conn, "/")
assert html_response(conn, 200) =~ "Log In"
end
end
end
| 25.2
| 69
| 0.634921
|
93a36aae50a30e62c232cd37c2ee2684be9cb73d
| 1,618
|
ex
|
Elixir
|
clients/cloud_search/lib/google_api/cloud_search/v1/model/date_property_options.ex
|
medikent/elixir-google-api
|
98a83d4f7bfaeac15b67b04548711bb7e49f9490
|
[
"Apache-2.0"
] | null | null | null |
clients/cloud_search/lib/google_api/cloud_search/v1/model/date_property_options.ex
|
medikent/elixir-google-api
|
98a83d4f7bfaeac15b67b04548711bb7e49f9490
|
[
"Apache-2.0"
] | 1
|
2020-12-18T09:25:12.000Z
|
2020-12-18T09:25:12.000Z
|
clients/cloud_search/lib/google_api/cloud_search/v1/model/date_property_options.ex
|
medikent/elixir-google-api
|
98a83d4f7bfaeac15b67b04548711bb7e49f9490
|
[
"Apache-2.0"
] | 1
|
2020-10-04T10:12:44.000Z
|
2020-10-04T10:12:44.000Z
|
# 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.CloudSearch.V1.Model.DatePropertyOptions do
@moduledoc """
Options for date properties.
## Attributes
* `operatorOptions` (*type:* `GoogleApi.CloudSearch.V1.Model.DateOperatorOptions.t`, *default:* `nil`) - If set, describes how the date should be used as a search operator.
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:operatorOptions => GoogleApi.CloudSearch.V1.Model.DateOperatorOptions.t()
}
field(:operatorOptions, as: GoogleApi.CloudSearch.V1.Model.DateOperatorOptions)
end
defimpl Poison.Decoder, for: GoogleApi.CloudSearch.V1.Model.DatePropertyOptions do
def decode(value, options) do
GoogleApi.CloudSearch.V1.Model.DatePropertyOptions.decode(value, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.CloudSearch.V1.Model.DatePropertyOptions do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| 34.425532
| 176
| 0.757108
|
93a3a1d24e19d13ff8bb5aad3f4f5fd2006c51a6
| 8,942
|
ex
|
Elixir
|
lib/Structs/Guild/guild.ex
|
ElinksFr/alchemy
|
4c64e5c619977a62a5674dbd2b1ef29f76f6f44e
|
[
"MIT"
] | 163
|
2017-03-01T09:02:35.000Z
|
2022-03-09T23:31:48.000Z
|
lib/Structs/Guild/guild.ex
|
ElinksFr/alchemy
|
4c64e5c619977a62a5674dbd2b1ef29f76f6f44e
|
[
"MIT"
] | 91
|
2017-02-23T23:23:35.000Z
|
2021-12-29T23:47:44.000Z
|
lib/Structs/Guild/guild.ex
|
ElinksFr/alchemy
|
4c64e5c619977a62a5674dbd2b1ef29f76f6f44e
|
[
"MIT"
] | 38
|
2017-03-23T13:16:44.000Z
|
2022-02-26T15:53:32.000Z
|
defmodule Alchemy.Guild do
alias Alchemy.{Channel, User, Voice, VoiceState}
alias Alchemy.Guild.{Emoji, GuildMember, Integration, Presence, Role}
import Alchemy.Structs
@moduledoc """
Guilds represent a collection of users in a "server". This module contains
information about the types, and subtypes related to guilds, as well
as some useful functions related to them.
"""
@type snowflake :: String.t()
@typedoc """
An iso_8601 timestamp.
"""
@type timestamp :: String.t()
@typedoc """
Represents a guild.
- `id`
The id of this guild.
- `name`
The name of this guild.
- `icon`
The image hash of the icon image.
- `splash`
The image hash of the splash image. Not a lot of guilds have a hash.
- `owner_id`
The user id of the guild's owner.
- `region`
The region of the guild.
- `afk_channel_id`
The id of the afk channel, if the guild has one.
- `afk_timeout`
The afk timeout in seconds.
- `embed_enabled`
Whether this guild is embeddable.
- `verification_level`
The level of verification this guild requires.
- `default_message_notifications`
The default message notifications level.
- `roles`
A list of the roles in this server.
- `emojis`
A list of custom emojis in this server.
- `features`
A list of guild features.
- `mfa_level`
The required mfa level for the guild.
The following fields will be missing for guilds accessed from outside the Cache:
- `joined_at`
The timestamp of guild creation.
- `large`
Whether or not this guild is considered "large".
- `unavailable`
This should never be true for guilds.
- `member_count`
The number of members a guild contains.
- `voice_states`
A list of voice states of the guild.
- `members`
A list of members in the guild.
- `channels`
A list of channels in the guild.
- `presences`
A list of presences in the guild.
"""
@type t :: %__MODULE__{
id: snowflake,
name: String.t(),
icon: String.t(),
splash: String.t() | nil,
owner_id: snowflake,
region: String.t(),
afk_channel_id: String.t() | nil,
afk_timeout: Integer,
embed_enabled: Boolean,
verification_level: Integer,
default_message_notifications: Integer,
roles: [Guild.role()],
emojis: [emoji],
features: [String.t()],
mfa_level: Integer,
joined_at: timestamp,
large: Boolean,
unavailable: Boolean,
member_count: Integer,
voice_states: [Voice.state()],
members: [member],
channels: [Channel.t()],
presences: [Presence.t()]
}
defstruct [
:id,
:name,
:icon,
:splash,
:owner_id,
:region,
:afk_channel_id,
:afk_timeout,
:embed_enabled,
:verification_level,
:default_message_notifications,
:roles,
:emojis,
:features,
:mfa_level,
:joined_at,
:large,
:unavailable,
:member_count,
:voice_states,
:members,
:channels,
:presences
]
@typedoc """
Represents a member in a guild.
- `user`
A user struct containing information about the underlying user.
- `nick`
An optional nickname for this member.
- `roles`
A list of ids corresponding to roles the member has.
- `joined_at`
The timestamp of when this member joined the guild.
- `deaf`
Whether the user is currently deafened.
- `mute`
Whether the user is currently muted.
"""
@type member :: %GuildMember{
user: User.t(),
nick: String.t() | nil,
roles: [snowflake],
joined_at: timestamp,
deaf: Boolean,
mute: Boolean
}
@typedoc """
Represents a custom emoji in a guild.
The string representation of this struct will be the markdown
necessary to use it. i.e. `Cogs.say("\#{emoji}")` will send the emoji.
- `id`
The id of this emoji.
- `name`
The name of this emoji.
- `roles`
A list of role ids who can use this role.
- `require_colons`
Whether or not this emoji must be wrapped in colons.
- `managed`
Whether or not this emoji is managed.
"""
@type emoji :: %Emoji{
id: String.t(),
name: String.t(),
roles: [String.t()],
require_colons: Boolean,
managed: Boolean
}
@typedoc """
Represents the account of an integration.
- `id`
The id of the account.
- `name`
The name of the account.
"""
@type integration_account :: %Integration.Account{
id: snowflake,
name: String.t()
}
@typedoc """
Represents an guild's integration with a service, (i.e. twitch)
- `id`
The id of the integration.
- `name`
The name of the integration.
- `type`
Integration type; youtube, twitch, etc.
- `enabled`
Whether or not the integration is enabled.
- `syncing`
Whether or not the integration is syncing.
- `role_id`
The id of the role associated with "subscribers" to this integration.
- `expire_behaviour`
The behaviour of expiring subscribers.
- `expire_grace_period`
The grace period before expiring subscribers.
- `user`
The user for this integration.
- `account`
The integration's account information.
- `synced_at`
When this integration was last synced.
"""
@type integration :: %Integration{
id: snowflake,
name: String.t(),
type: String.t(),
enabled: Boolean,
syncing: Boolean,
role_id: snowflake,
expire_behaviour: Integer,
expire_grace_period: Integer,
user: User.t(),
account: integration_account,
synced_at: timestamp
}
@typedoc """
Represents a role in a guild.
- `id`
The id of the role.
- `name`
The name of the role.
- `color`
The color of the role.
- `hoist`
Whether the role is "hoisted" above others in the sidebar.
- `position`
The position of the role in a guild.
- `permissions`
The bitset of permissions for this role. See the `Permissions` module
for more information.
- `managed`
Whether this role is managed by an integration.
- `mentionable`
Whether this role is mentionable.
"""
@type role :: %Role{
id: snowflake,
name: String.t(),
color: Integer,
hoist: Boolean,
position: Integer,
permissions: Integer,
managed: Boolean,
mentionable: Boolean
}
@typedoc """
Represents the presence of a user in a guild.
- `user`
The user this presence is for.
- `roles`
A list of role ids this user belongs to.
- `game`
The current activity of the user, or `nil`.
- `guild_id`
The id of the guild this presences is in.
- `status`
"idle", "online", or "offline"
"""
@type presence :: %Presence{
user: User.t(),
roles: [snowflake],
game: String.t() | nil,
guild_id: snowflake,
status: String.t()
}
@doc """
Finds the highest ranked role of a member in a guild.
This is useful, because the permissions and color
of the highest role are the ones that apply to that member.
"""
@spec highest_role(t, member) :: role
def highest_role(guild, member) do
guild.roles
|> Enum.sort_by(& &1.position)
# never null because of the @everyone role
|> Enum.find(&(&1 in member.roles))
end
defmacrop is_valid_guild_icon_url(type, size) do
quote do
unquote(type) in ["jpg", "jpeg", "png", "webp"] and
unquote(size) in [128, 256, 512, 1024, 2048]
end
end
@doc """
Get the icon image URL for the given guild.
If the guild does not have any icon, returns `nil`.
## Parameters
- `type`: The returned image format. Can be any of `jpg`, `jpeg`, `png`, or `webp`.
- `size`: The desired size of the returned image. Must be a power of two.
If the parameters do not match these conditions, an `ArgumentError` is raised.
"""
@spec icon_url(__MODULE__.t(), String.t(), 16..2048) :: String.t()
def icon_url(guild, type \\ "png", size \\ 256) when is_valid_guild_icon_url(type, size) do
case guild.icon do
nil -> nil
hash -> "https://cdn.discordapp.com/icons/#{guild.id}/#{hash}.#{type}?size=#{size}"
end
end
def icon_url(_guild, _type, _size) do
raise ArgumentError, message: "invalid icon URL type and / or size"
end
@doc false
def from_map(map) do
map
|> field_map("roles", &map_struct(&1, Role))
|> field_map("emojis", &map_struct(&1, Emoji))
|> field_map?("voice_states", &map_struct(&1, VoiceState))
|> fields_from_map?("members", GuildMember)
|> fields_from_map?("channels", Channel)
|> fields_from_map?("presences", Presence)
|> to_struct(__MODULE__)
end
end
| 27.09697
| 93
| 0.617312
|
93a3a5420f9222ab6b6debb53f9843738f8b88c4
| 1,589
|
ex
|
Elixir
|
lib/fare_web/endpoint.ex
|
btihen/fare
|
4fb959b2c5e7d96cdb6049764ebac829f68b8128
|
[
"MIT"
] | null | null | null |
lib/fare_web/endpoint.ex
|
btihen/fare
|
4fb959b2c5e7d96cdb6049764ebac829f68b8128
|
[
"MIT"
] | null | null | null |
lib/fare_web/endpoint.ex
|
btihen/fare
|
4fb959b2c5e7d96cdb6049764ebac829f68b8128
|
[
"MIT"
] | null | null | null |
defmodule FareWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :fare
# 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.
@session_options [
store: :cookie,
key: "_fare_key",
signing_salt: "O897ADfF"
]
socket "/socket", FareWeb.UserSocket,
websocket: true,
longpoll: false
socket "/live", Phoenix.LiveView.Socket, websocket: [connect_info: [session: @session_options]]
# 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: :fare,
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
plug Phoenix.Ecto.CheckRepoStatus, otp_app: :fare
end
plug Phoenix.LiveDashboard.RequestLogger,
param_key: "request_logger",
cookie_key: "request_logger"
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
plug Plug.Session, @session_options
plug FareWeb.Router
end
| 28.890909
| 97
| 0.714915
|
93a3be66766d8292c62384b909212860b2dfc6d5
| 1,393
|
exs
|
Elixir
|
ex_mon/test/ex_mon_test.exs
|
herminiotorres/curso_elixir
|
19519a2ac27b7c3e4973cdb2053c32dd61647cb5
|
[
"MIT"
] | 1
|
2021-08-08T22:50:44.000Z
|
2021-08-08T22:50:44.000Z
|
ex_mon/test/ex_mon_test.exs
|
herminiotorres/curso-elixir
|
19519a2ac27b7c3e4973cdb2053c32dd61647cb5
|
[
"MIT"
] | null | null | null |
ex_mon/test/ex_mon_test.exs
|
herminiotorres/curso-elixir
|
19519a2ac27b7c3e4973cdb2053c32dd61647cb5
|
[
"MIT"
] | null | null | null |
defmodule ExMonTest do
use ExUnit.Case
import ExUnit.CaptureIO
alias ExMon.Player
describe "create_player/4" do
test "returns a player" do
expected_player = %Player{
life: 100,
moves: %{move_avg: :high_kick, move_heal: :heal, move_rnd: :punch},
name: "JohnDoe"
}
assert expected_player == ExMon.create_player("JohnDoe", :high_kick, :punch, :heal)
end
end
describe "start_game/1" do
test "when the game is started, returns a message" do
player = Player.build("JohnDoe", :high_kick, :punch, :heal)
messages =
capture_io(fn ->
assert ExMon.start_game(player) == :ok
end)
assert messages =~ "The game is started!"
assert messages =~ "status: :started"
assert messages =~ "turn: :player"
end
end
describe "make_move/1" do
setup do
player = Player.build("JohnDoe", :high_kick, :punch, :heal)
capture_io(fn ->
assert ExMon.start_game(player) == :ok
end)
# Examples:
# {:ok, player: player}
:ok
end
test "when the move is valid, do the move and the computer makes a move" do
messages =
capture_io(fn ->
ExMon.make_move(:wrong)
end)
assert messages =~ "Invalid move: wrong"
end
test "when the move is invalid, returns an error message" do
end
end
end
| 22.836066
| 89
| 0.604451
|
93a3e89a64a0005d02cc22b3ea3affa92219e70c
| 327
|
ex
|
Elixir
|
lib/chess_app/account/auth_token.ex
|
leobessa/exchess
|
289819d183f3001dddf56810c36298fa669c3a06
|
[
"MIT"
] | 3
|
2017-06-02T20:47:07.000Z
|
2018-05-25T11:17:12.000Z
|
lib/chess_app/account/auth_token.ex
|
leobessa/exchess
|
289819d183f3001dddf56810c36298fa669c3a06
|
[
"MIT"
] | null | null | null |
lib/chess_app/account/auth_token.ex
|
leobessa/exchess
|
289819d183f3001dddf56810c36298fa669c3a06
|
[
"MIT"
] | null | null | null |
defmodule ChessApp.Account.AuthToken do
defstruct [:jwt, :account_id]
alias ChessApp.Account.{AuthToken,Credential}
def from_credential(%Credential{id: account_id} = credential) do
{:ok, jwt, _claims} = Guardian.encode_and_sign(credential, :access)
{:ok, %AuthToken{account_id: account_id, jwt: jwt}}
end
end
| 29.727273
| 71
| 0.740061
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.