Git Product home page Git Product logo

mvfsillva / dialetus-service Goto Github PK

View Code? Open in Web Editor NEW
255.0 11.0 88.0 2.3 MB

API to Informal dictionary for the idiomatic expressions that each Brazilian region It has

Home Page: https://dialetus-service.herokuapp.com

License: MIT License

Dockerfile 0.90% JavaScript 98.92% Shell 0.18%
nodejs api dialects brazilian-dialects javascript rest-api serverless yarn aws-lambda idiomatic-expressions

dialetus-service's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dialetus-service's Issues

Update the project to serverless

The focus of this update the project to works with serverless.

We will use the service bellow in AWS:

CloudFront
AWS S3 - Para salvar as flags
AWS XRAY
AWS Cloud Watch
AWS API Gateway
AWS Lambda
AWS Dynamodb

Intregation Diagram:

dialetus-service

Folders:

root 
 └ node_modules (auto-generated)    → NPM dependencies
 └ test                             → Pasta de teste que centraliza os testes unitários ou funcionais
 └ README.md                        → Arquivo que introduz e explica o projeto
 └ serverless.yml                   → Arquivo principal do Serverless Framework responsavel por configurar os ambientes e importar os arquivos functions.yml
 └ serverless.env.yml               → Arquivo que centraliza as variaveis de ambiente por stage
 └ src                              → Pasta principal com código de todo o projeto
   └ components                     → Comunicação do projeto com o mundo exterior (ex: banco de dados, fila, storage, arquivos locais "/tmp/")
     └ dynamodb                     
     └ s3     
     └ file   
     └ http 
     └ logger  
     └ xray       
   └ lib                            → Funções puras sem conexão externas que servem como ferramenta de "utilidades", por exemplo: String format, Date format, Regex processing, response wrapper, error handler e etc
     └ http                        
        └ handler-success            → Funções que moldam a response HTTP, por exemplo: handler de error para retornar uma status code HTTP especifico, controle de cache, cors, handler de sucesso para padronizar o objeto
        └ handler-error            → Funções que moldam a response HTTP, por exemplo: handler de error para retornar uma status code HTTP especifico, controle de cache, cors, handler de sucesso para padronizar o objeto
     └ string-utils                 
     └ date-utils                 
    └ functions                     →
      └ send-message                → Pasta da função/rota
        └ config.js                 → Módulo que importa as variaveis de ambiente para o scopo da função
        └ function.yml              → Configuração de recursos de função, como: nome da função, trigger da função, por exemplo: HTTP, schedule. sqs, tamanho da memória, cors
        └ handler.js                → Ponto de entrada de função, semelhante a um controller
        └ use-case                  → Modulo responsavel pelas regras de negocio
        └ serializer                → Serializa os dados internos para o modelo de resposta do mundo externo (basicamente cria o body da response)

List of initial libs:

dependencies:

devDependencies:

New property

Is it possible to implement a new property of type image that represented the flag of each state? Can be called flag.
It's much better for UX to have flags in a GridView/ListView than just state names.

Looking for an specific expression

First, congrats @mvfsillva! Awesome and fun project 👏👏👏
I was wondering if we can evolve the API in a way we can search for an specific expression.
I mean, there's some expressions which are used in different regions and sometimes it have the same meaning and sometimes don't.
It'll be nice if the API provides the ability of discovering.

Examples:

Request

curl https://dialetus-service.now.sh/search/bah

Response

]
  {
    "region": "gauches",
    "dialect": "Bah",
    "meanings": ["Tapada", "Lento", "Disperso"],
    "examples": ["Bah, sério?!"]
  }
]

Request

curl https://dialetus-service.now.sh/search/baita

Response

]
  {
    "region": "gauches",
        "dialect": "Baita",
        "meanings": ["Grande", "Imenso"],
        "examples": ["Bah tchê, que baita de um problema tu arranjaste?!"]
  },
  {
    "region": "paulistes",
        "dialect": "Baita",
        "meanings": ["Grande", "Imenso"],
        "examples": ["Meu, que baita de um problema!"]
  }
]

With this approach we can even provide a full search functionality:

Request

curl https://dialetus-service.now.sh/search/ba

Response

]
 {
    "region": "gauches",
        "dialect": "Bah",
        "meanings": ["Tapada", "Lento", "Disperso"],
        "examples": ["Bah, sério?!"]
  },
  {
    "region": "gauches",
        "dialect": "Baita",
        "meanings": ["Grande", "Imenso"],
        "examples": ["Bah tchê, que baita de um problema tu arranjaste?!"]
  },
  {
    "region": "paulistes",
        "dialect": "Baita",
        "meanings": ["Grande", "Imenso"],
        "examples": ["Meu, que baita de um problema!"]
  },
  {
    "region": "paulistes",
         "dialect": "Bagulho",
         "meanings": ["Qualquer tipo de objeto (lapis, papel, celular)"],
         "examples": ["Empresta esse bagulho ai pra mim?", "Passa essa bagulho ai mano!"]
  }
]

Or even better, we could group by regions in the response:

]
 {
    "region": "gauches"
        "dialects": [
         {
           "dialect": "Bah",
           "meanings": ["Tapada", "Lento", "Disperso"],
           "examples": ["Bah, sério?!"]
          },
         {
          "dialect": "Baita",
          "meanings": ["Grande", "Imenso"],
          "examples": ["Bah tchê, que baita de um problema tu arranjaste?!"]
         }
    ]
  }
]

This project and idea is so rich! That's a lot of applications and ways to scale.
E.g.: Integrate with dictionaries, etymology, audio expressions, and so on.
Cool!

Have you considered GraphQL?
Perhaps it could be a good alternative to amplify the service even more 🙂

List of States in Brazil

I am using this issue to document data.

[
  {
    "uf": "AC",
    "label": "Acre",
    "draft": "false"
  },
  {
    "uf": "AL",
    "label": "Alagoas",
    "draft": "false"
  },
  {
    "uf": "AP",
    "label": "Amapá",
    "draft": "false"
  },
  {
    "uf": "AM",
    "label": "Amazonas",
    "draft": "false"
  },
  {
    "uf": "BA",
    "label": "Bahia",
    "draft": "false"
  },
  {
    "uf": "CE",
    "label": "Ceará",
    "draft": "false"
  },
  {
    "uf": "DF",
    "label": "Distrito Federal",
    "draft": "false"
  },
  {
    "uf": "ES",
    "label": "Espírito Santo",
    "draft": "false"
  },
  {
    "uf": "GO",
    "label": "Goiás",
    "draft": "false"
  },
  {
    "uf": "MA",
    "label": "Maranhão",
    "draft": "false"
  },
  {
    "uf": "MT",
    "label": "Mato Grosso",
    "draft": "false"
  },
  {
    "uf": "MS",
    "label": "Mato Grosso do Sul",
    "draft": "false"
  },
  {
    "uf": "MG",
    "label": "Minas Gerais",
    "draft": "false"
  },
  {
    "uf": "PA",
    "label": "Pará",
    "draft": "false"
  },
  {
    "uf": "PB",
    "label": "Paraíba",
    "draft": "false"
  },
  {
    "uf": "PR",
    "label": "Paraná",
    "draft": "false"
  },
  {
    "uf": "PE",
    "label": "Pernambuco",
    "draft": "false"
  },
  {
    "uf": "PI",
    "label": "Piauí",
    "draft": "false"
  },
  {
    "uf": "RJ",
    "label": "Rio de Janeiro",
    "draft": "false"
  },
  {
    "uf": "RN",
    "label": "Rio Grande do Norte",
    "draft": "false"
  },
  {
    "uf": "RS",
    "label": "Rio Grande do Sul",
    "draft": "false"
  },
  {
    "uf": "RO",
    "label": "Rondônia",
    "draft": "false"
  },
  {
    "uf": "RR",
    "label": "Roraima",
    "draft": "false"
  },
  {
    "uf": "SC",
    "label": "Santa Catarina",
    "draft": "false"
  },
  {
    "uf": "SP",
    "label": "São Paulo",
    "draft": "false"
  },
  {
    "uf": "SE",
    "label": "Sergipe",
    "draft": "false"
  },
  {
    "uf": "TO",
    "label": "Tocantins",
    "draft": "false"
  }
]

Change natales to potiguar

I would like to change the term "natales" to "potiguares", following the logic of "Bahia - baianes", "Minas Gerais - mineires", "Paraná - paranaes", and because it would open to a wide range of possibilities regarding to dialects from the country town.

Hash table possibility instead a list

Premisse

For performance case and better scale of glossary, hash tables based information makes the key<->value match faster and easier to scale in matter of matching data through endpoints.

Case of today

GET and endpoint returns a list of objects for the dictionary, if I want to list them all, that's fine, if I need to match one specific word I have to run through the list looking for it.

Use of hash table

If data could be organised like this:

{
  barril: { dialect: 'barril', meanings: [ ... ], examples: [ ... ] },
  migue: { dialect, 'Migué', meanings: [ ... ], examples: [ ... ] }
}

If I want to understand some word, I would just do:

const barril = baianes['barril'];

That way the key<->value matching would be faster and easier to find a word inside the dictionary.

Other "wins" inside this decision

Organising .json files would be way easier, adding new words either. Instead of having a full file of it, you can place everything in a folder like:

dialects
\_ baianes
   \_ barril.json
   \_ migue.json
    ...etc
  • The root endpoint would get everything as a collection and display it in a hash table structure in order to show the full collection;
  • And now you can easily provide a deeper "foldering" endpoint to get specific words, like:
GET https://dialetus-service.now.sh/dialects/baianes/barril-dobrado

response example:

{
  barrilDobrado: {
    "dialect": "Barril Dobrado",
    "meanings": [
      "Problema muito grande",
      "Situação muito complicada",
      "Pessoa de grande Qualiadde"
    ],
    "examples": [
      "Isso ai é barril vey",
      "Você é barril dobrado meu pivete",
      "Eu sou barril dobrado"
    ]
  },
}

New property: Location

Sounds interesting to have a location property. It can be useful to UX/UI map related.

Some examples:
Pin all regions into a map
Open the location for some selected region

Meaning linking support

Add meaning link support

be able to link different meanings from different regions.
E.g.
Oxe Abreviation from Oxente

Api example

{
    dialect: "Oxente",
    meanings: [
        "surpresa",
        "admiração"
    ],
    examples: [
        "Oxente mainha!"
    ]
},

{
    dialect: "Oxe",
    originated: "baianês.Oxente"
    examples: [
        "Oxe omi!"
    ]
},

Each word have a synonyms

For each word, have a synonym section. For example: in the "Carioques" section, the word "Bolado" would have a synonymous word, "Chateado".

Update search endpoint response

We are change the frontend interface, based in that the search endpoint need migrate to a simple response.

Solution:

We must return status code 200 OK:

Sample:

[
  {
    "slug": "oxente",
    "dialect": "Oxente",
    "meanings": ["Surpresa", "Admiração"],
    "examples": ["Oxente mainha!"],
    "region": "baianes"
  },
  {
    "slug": "oxe",
    "dialect": "Oxe",
    "meanings": ["Espanto", "Surpresa"],
    "examples": ["Oxe, o que tu ta fazendo menino.", "Oxe, que negócio estranho boy"],
    "region": "pernambuques"
  },
  {
    "slug": "oxe",
    "dialect": "Oxe",
    "variations": ["baianes.Oxente"],
    "examples": ["Oxe omi!"],
    "region": "potiguares"
  }
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.