GithubHelp home page GithubHelp logo

opencrvs / opencrvs-core Goto Github PK

View Code? Open in Web Editor NEW
79.0 19.0 58.0 901.64 MB

A global solution to civil registration

Home Page: https://www.opencrvs.org

License: Other

HTML 0.07% TypeScript 98.69% JavaScript 0.31% Shell 0.58% Dockerfile 0.07% MDX 0.27%

opencrvs-core's Introduction

OpenCRVS

A digital public good for civil registration
Report an issue · Join our community · Read our documentation · www.opencrvs.org

License: MPL 2.0

OpenCRVS

OpenCRVS (Civil registration & Vital Statistics) is a digital public good to help achieve universal civil registration and evidence-based decision making in all country contexts.

We are on a mission to ensure that every individual on the planet is recognised, protected and provided for from birth.


Important! Please read

To proceed, refer to our documentation. It contains all the information you need.

Become part of the OpenCRVS Community

We want to see OpenCRVS implemented across the world. We can’t do this alone. Through the OpenCRVS Community, we are uniting experts in civil registration and other interested parties.

Visit our website

Join our community

We greatly appreciate any contributions to opencrvs-core

Raise an issue or join our community to ask for a new feature

  1. Raise an issue
  2. Involve yourself in design discussions
  3. Co-create development tasks with our team
  4. Fork the repo
  5. Create a branch with your changes
  6. Submit a PR
  7. Address any comments the core contributors may have
  8. The core contributors will merge the code once it is ready, thanks for you contribution to ensure every individual on the planet is recognised, protected and provided for from birth!

By contributing to the OpenCRVS code, you are conforming to the terms of the license.


License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

OpenCRVS is also distributed under the terms of the Civil Registration & Healthcare Disclaimer located at http://opencrvs.org/license.

Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.

opencrvs-core's People

Contributors

armanbhuiyan-dsi avatar atiqzaman-dsi avatar dependabot[bot] avatar eezi avatar emon-swe-sust avatar euanmillar avatar jpye-finch avatar kayumuzzaman avatar maacpiash avatar mgorabbani avatar modupeadeonojobi avatar mushrafulhoque-dsi avatar nafistiham avatar naftis avatar nil20 avatar nsamadavid avatar rabiulislamanik avatar rcrichton avatar renovate[bot] avatar rikukissa avatar sadman-ilham avatar sadmananik avatar sahriartoufiq avatar sifulovi avatar soumita-dsi avatar tahmidrahman-dsi avatar tofaelahmed-dsi avatar wilrona avatar yeasinhossain-dsi avatar zangetsu101 avatar

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

Watchers

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

opencrvs-core's Issues

Windows compatibility

Didn't manage to get the project running on Windows. OSX and Ubuntu seem to be working just fine. Not an urgent thing, but probably best to get this fixed at some point. Thoughts?

Replace moment.js with date-fns

Moment.js is a heavy library.

We need to replace moment with date-fns in client and metrics and farajaland with date-fns.

We need to only import the function we need to use each time like this:

import addDays from 'date-fns/addDays'

  • Remove the package and refactor all calculations that are rendered with moment with date-fns
  • Add an eslint rule to enforce the import style

Lerna tests on Travis randomly fail - Running concurrently is too slow

Occasionally Lerna tests on Travis fail with no output and Travis crashes.

For the failing build it looks like Lerna didn't ever produce any output for the login app tests. This is different from cases when the tests pass on travis. Perhaps it somehow getting stuck on the login tests and they are never completing. Still not 100% sure if this is just coincidence or not.

The commits should make sure Lerna doesn't hide any errors that may be occurring and ensure that Travis will attempt the tests 3 times before giving up.

Not sure though if this is resolved yet, and having tests not run in parallel will slow down everything once the project grows.

204f760

Replace Notification with FloatingNotification everywhere

Notification is a very old component. All instances must be replaced with FloatingNotification
Screenshot 2022-02-14 at 10 23 19

If you change profile image, then you see the correct Notification style

Also please look at refactor of the styles and the callback naming convention is a bit strange

Stylelint raises a false positive for no-duplicate-selectors when using non standard selectors in styled-components

${} causes a stylelint false positive for no-duplicate-selectors when using non standard selectors in styled-components

const StyledButton = styled(PrimaryButton)`
justify-content: center;
${ButtonIcon} {
  margin: 1em
}

Discovered here:

8d7e89d#diff-08e3b93dc8a702ba003519765ab8fd14

Stylelint issue raised here: stylelint/stylelint#2199

This could be expected behaviour for Stylelint, and in fact the error could be an issue with StyledComponents "styled" method.

The only solution for now is to disable stylelint for this pattern:

const StyledButton = styled(PrimaryButton)`
justify-content: center;
/* stylelint-disable */
${ButtonIcon} {
/* stylelint-enable */
  margin: 1em
}

Make sure all projects define their own dependencies in their package.json files

Seems like many clients do not have all of their dependencies in their package.json files. At least register and login are missing styled-components completely.

Also: make sure node_modules directories inside subprojects do not have duplicated versions of libraries like React or node_modules that both the client app and components library is using.

Add a custom linting rule

  1. Last part of message id foo.bar.baz has to match with the key on the defineMessages object
  2. No hard-coded strings anywhere in the code (there's an existing linting rule for this)
    • If translations are fetched from a CMS or similar, this might be tricky
  3. Shows a linting error in the defineMessages block if the item isn't found in the message-file
  4. Make sure translation objects don't have messages that aren't used anywhere

Resource:

Introduce Fragments in Apollo Client and MockedProvider

We need to upgrade our GraphQL approach to use fragments in order to remove these warnings in tests and the technical debt incurred by MockedProvider not being able to match types properly in responses.

d1bd9d8

This work has been started but is incomplete: https://graphql-code-generator.com/docs/plugins/fragment-matcher

6302fa8#diff-9bc1cc81da67b3814a0e9b193c1cbfa6

WARNING: heuristic fragment matching going on! DEPRECATION WARNING: using fragments without __typename is unsupported behavior and will be removed in future versions of Apollo client. You should fix this and set addTypename to true now. You're using fragments in your queries, but either don't have the addTypename true option set in Apollo Client, or you are trying to write a fragment to the store without the __typename. Please turn on the addTypename option and include __typename when writing fragments so that Apollo Client can accurately match fragments.

Component types need to be unnecessarily defined

This is what's causing it:
microsoft/TypeScript#5711

So what we need to do:

import * as React from 'react'; // not referenced anywhere
import styled, { 
  StyledComponentClass /* not referenced anywhere */ 
} from 'styled-components'; 

export const Button = styled.button`
  background: red;
`;

Which leads us having to disable noUnusedLocals from tsconfig.json, which then again hides all unused variables, which is not ideal.

Refactor: App.tsx if blocks

https://github.com/jembi/OpenCRVS/blob/master/packages/register/src/App.tsx#L92-L152

would be easier to read if it was

if (!initialDraftsLoaded) {
  return (
    <ThemeProvider theme={getTheme(config.COUNTRY)}>
      <StyledSpinner id="appSpinner" />
    </ThemeProvider>
  )
}
return (
  <ApolloProvider client={this.props.client || client}>
    <Provider store={this.props.store}>
      <I18nContainer>
        <ThemeProvider theme={getTheme(config.COUNTRY)}>
          <ConnectedRouter history={this.props.history}>
            <ScrollToTop>
              <NotificationComponent>
                <Page>
                  <Switch>
                    <ProtectedRoute
                      exact
                      path={routes.HOME}
                      component={Home}
                    />
                    <ProtectedRoute
                      exact
                      path={routes.SELECT_VITAL_EVENT}
                      component={SelectVitalEvent}
                    />
                    <ProtectedRoute
                      exact
                      path={routes.SELECT_INFORMANT}
                      component={SelectInformant}
                    />
                    <ProtectedRoute
                      exact
                      path={routes.DRAFT_BIRTH_PARENT_FORM}
                      component={RegisterForm}
                    />

                    <ProtectedRoute
                      path={routes.DRAFT_BIRTH_PARENT_FORM_TAB}
                      component={RegisterForm}
                    />
                    <ProtectedRoute
                      path={routes.SAVED_REGISTRATION}
                      component={SavedRegistration}
                    />
                    <ProtectedRoute
                      path={routes.WORK_QUEUE}
                      component={WorkQueue}
                    />
                  </Switch>
                </Page>
              </NotificationComponent>
            </ScrollToTop>
          </ConnectedRouter>
        </ThemeProvider>
      </I18nContainer>
    </Provider>
  </ApolloProvider>
) 

No payload type inference in reducer branches

To clarify:

If you try to observe the type of action's payload inside one of the switch branches, TS will only give you any or something as unuseful, where as it should give you the exact type that corresponds with the action type in question.

Typing issue of some sort apparently

Refactor: Abstraction leak in App.tsx

  async loadDraftsFromStorage() {
    const draftsString = await storage.getItem('drafts')
    const drafts = JSON.parse(draftsString ? draftsString : '[]')
    this.props.store.dispatch(setInitialDrafts(drafts))
    this.setState({ initialDraftsLoaded: true })
  }

should be moved to draft reducer. As a general rule, localStorage (or any other data / services) shouldn't be accessed outside reducers at all

Running "yarn add" in a package fails because internal packages are not published

➜  client git:(master) yarn add react-intl
yarn add v1.3.2
warning ../../package.json: No license field
[1/4] 🔍  Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/@opencrvs%2fcomponents: Not found".
info If you think this is a bug, please open a bug report with the information provided in "/Users/rrou/Code/OpenCRVS/packages/client/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Don't show coverage report in local environment by default

TASK: Only print out coverage report when tests are run on CI, but not on development:
It doesn't really provide any extra information and it completely clutters the test output.

yarn test --coverage=none --watch works as a workaround

Rethink how Register - app's "ProtectedRoute" should work

At the moment it redirects the user to login if the user doesn't have a token or if the token is invalid / expired. From an offline-mode perspective, this probably won't work too well. If the user if off the grid, they cannot do any backend requests meaning the login wouldn't work in any case

Add typing to <Query /> components

Preferably import the types in the gateway project to frontend projects. Maybe we should also create module where we would have all the queries in one place.

Update React

Seems that we're using a relatively old version of React. Would be nice to use a more recent version to be able to use Hooks etc

Refactor how we manage drafts in Formik

One of the key selling points for Formik, is that we dont store the data in redux. But we are storing the draft data in redux. In fact we store all the drafts.

There is no need to store all the drafts. We might want to store only the active draft in redux as it may be quicker to read the draft from redux than from IndexedDB when we need it, but do we really need to? Can we load from indexedDB all the time? Which is faster?

Also regarding saving a draft, should we only do this when the user clicks save draft rather than automatically after finishing typing? It does slow down the application and perhaps the performance may be improved by fixing our drafts redux issues, but maybe saving a draft should be user initiated. @jpye-finch certainly wanted some feedback to the user each time this happens and we have a pop up Notification component to do that when the user clicks save draft, but that would be annoying to do after every time the user finishes typing.

I wonder what the benefits are. Thanks to @mgorabbani for raising these issues.

Reconsider pre-commit and pre-push hooks

Especially pre-push hook is a bit annoying since it takes fairly long to run all tests for all projects. The same thing is also done by CI which leads me to believe this isn't so helpful after all.

Pre-commit hook on the other hand is still fairly quick and useful for people who don't have their editor automatically formatting everything. Would be nice if it would be optional though. Find myself using --no-verify way too often these days, which isn't a good sign

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.