Skip to content

Commit

Permalink
Merge branch 'staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
Adi Eyal committed Sep 30, 2020
2 parents 812e434 + 29e2faf commit 12f6100
Show file tree
Hide file tree
Showing 29 changed files with 2,660 additions and 1,203 deletions.
11 changes: 9 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
{
"presets": [
"env"
"@babel/preset-env"
],
env: {
test: {
plugins: [
'@babel/plugin-proposal-class-properties',
]
}
},
"plugins": [
"transform-regenerator"
"transform-regenerator",
]
}
52 changes: 52 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
## Description

A meaningful description of proposed change in your own words.

## Related Issue


## How to test it locally


## Screenshots


## Changelog

### Added

### Updated

### Removed


## Checklist

- [ ] 🚀 is the code ready to be merged and go live?
- [ ] 🛠 does it work (build) locally

### Pull Request

- [ ] 📰 good title
- [ ] 📝good description
- [ ] 🔖 issue linked
- [ ] 📖 changelog filled out

### Commits

- [ ] commits are clean
- [ ] commit messages are clean

### Code Quality

- [ ] 🚧 no commented out code
- [ ] 🖨 no unnecessary logging
- [ ] 🎱 no magic numbers
- [ ] ⚙️ ran jslint
- [ ] 🧰 ran codeclimate locally

### Testing

- [ ] ✅ added (appropriate) unit tests
- [ ] 💢 edge cases in tests were considered
- [ ] ✅ ran tests locally & are passing
19 changes: 5 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
os: linux
language: python
python:
- "3.7"
addons:
chrome: stable
language: node_js
node_js:
- "14"
cache:
- pip
- yarn: true
- directories:
- node_modules
install:
- pip install -r requirements.txt
services:
- docker
before_script:
- docker-compose up -d
- npm install
script:
- ./run_test.sh
after_script:
- docker-compose down
- npm test
53 changes: 52 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
# Installation
# Introduction
Wazimap-NG is the next version of [Wazimap](http://www.wazimap.co.za). It provides a platform for users to bind tabular data to spatial boundaries in order create curated views of datasets. Yes - that's probably too vague a description to understand what it is. Hopefully the images below provide a better description:

<a href="https://postimg.cc/G8XkZRhV" target="_blank"><img src="https://i.postimg.cc/G8XkZRhV/Screen-Shot-2020-09-27-at-09-50-00.png" alt="Screen-Shot-2020-09-27-at-09-50-00"/></a> <a href="https://postimg.cc/MM67PHx1" target="_blank"><img src="https://i.postimg.cc/MM67PHx1/Screen-Shot-2020-09-27-at-09-50-33.png" alt="Screen-Shot-2020-09-27-at-09-50-33"/></a><br/><br/>
<a href="https://postimg.cc/4HnzG0Yd" target="_blank"><img src="https://i.postimg.cc/4HnzG0Yd/Screen-Shot-2020-09-27-at-09-50-50.png" alt="Screen-Shot-2020-09-27-at-09-50-50"/></a> <a href="https://postimg.cc/MXsDL7nH" target="_blank"><img src="https://i.postimg.cc/MXsDL7nH/Screen-Shot-2020-09-27-at-09-51-30.png" alt="Screen-Shot-2020-09-27-at-09-51-30"/></a><br/><br/>

See a link to the beta site here: [https://beta.youthexplorer.org.za](https://beta.youthexplorer.org.za).

You can find the frontend code in this repository. The backend is available here: [https://github.com/openupsa/wazimap-ng](https://github.com/openupsa/wazimap-ng).

# New features

The main new features are:

* Admins now have more flexibility when it comes to loading data. This includes uploading massive datasets and then slicing and dicing in the backend rather than pre-preparing datasets beforehand.
* Point data is now fully integrated as a first-class spatial object.
* Choropleths built into the main view. These were hidden behind multiple clicks in the previous version.
* One platform can host multiple profiles off the same database.
* The Rich data view allows richer disaggregation of indicators.
* The administrator can configure the view to use custom basemaps, colours, and other UI settings.
* Arbitrary spatial boundaries and hierarchies can be loaded onto the same server.
* Toggling of overlapping boundary layers such as switching between wards and mainplaces which typically cover the same areas.
* Integration into third-party data sources for realtime data feeds.

# Related software
There is no shortage of mapping software available, both commerical and open-source. Wazimap focuses on providing a platform for data custodians to showcase their datasets and mashing them up with public data. The most similar tool that we have found is the excellent [GeoNode](https://geonode.org/). We feel that approach to publishing data is significantly different enough to warrant a separate project.

# Roadmap
Version 0.8 is due soon and will fix bugs that currently don't have workarounds. We'll publish the 1.0 roadmap soon.

# Future features
* WFS endpoint for publishing data to other GIS software
* Pluggable data visualisations
* Better handling of geography hierarchies.
* Improved handling of temporal and other types of non-census-like data.
* Speed improvements
* A large standard database of public datasets.


# Installation


```bash
Expand All @@ -14,3 +52,16 @@ yarn push-gh-pages # pushes to github for hosting
```


# Documentation
These are works in progress:

* [Technical manual](https://openup.gitbook.io/wazi-ng-technical/)
* [Administrator manual](https://openup.gitbook.io/wazimap-ng/)

# Contributions
Contributions are welcome - we are working towards making this process easier.

# Shoulders of giants
This project is the next iteration of a number of excellent projects starting with [CensusReporter](https://censusreporter.org/) and [Wazimap](http://www.wazimap.co.za) that followed it. Special thanks to William Bird from [Media Monitoring Africa](https://mediamonitoringafrica.org) whose initial idea (and funding) it was to build a tool to help journalists better understand areas they were reporting on. Also thanks to Chris Berens from [VPUU](vpuu.org.za) who directed funding to help kickstart this new build. Finally, all of the amazing spatial software and tools developed by one of the most dedicated open source communities out there.


22 changes: 22 additions & 0 deletions __tests__/controller.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Controller from '../src/js/controller';

describe('Controller', () => {

it('initialize successully', () => {
let controller = new Controller({});
});
describe('Event loop', () => {
it('adds the state to payload', () => {
let controller = new Controller({});
let result = null;
let payload = "expected"
controller.on('eventname', (e) => result = e)

controller.triggerEvent('eventname', payload);

expect(result).toHaveProperty('state')
expect(result).toHaveProperty('payload')
});
});
});

47 changes: 47 additions & 0 deletions __tests__/utils.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import {validation, defaultIfMissing} from '../src/js/utils';

describe('Testing validation functions', () => {


test.each([
[null, true], [undefined, false], [{}, false],
['', false], [NaN, false]])('.isNull(%s)', (value, expected) => {
expect(validation.isNull(value)).toBe(expected);
});

test.each([
[null, false], [undefined, true], [{}, false],
['', false], [NaN, false]])('.isUndefined(%s)', (value, expected) => {
expect(validation.isUndefined(value)).toBe(expected);
});

test.each([
[null, false], [undefined, false], [{}, false],
['', true], [NaN, false]])('.isEmptyString(%s)', (value, expected) => {
expect(validation.isEmptyString(value)).toBe(expected);
});

test.each([
[null, false], [undefined, false], [{}, true],
['', false], [NaN, false]])('.isEmptyObject(%s)', (value, expected) => {
expect(validation.isEmptyObject(value)).toBe(expected);
});

test.each([
[null, true], [undefined, true], [{}, true],
['', true], [5, false]])('.isMissingData(%s)', (value, expected) => {
expect(validation.isMissingData(value)).toBe(expected);
});
});

describe('Testing defaults', () => {
test('checkAny function works correctly', () => {
expect(defaultIfMissing(5, 5)).toBe(5);
expect(defaultIfMissing('XXX', 5)).toBe('XXX');
expect(defaultIfMissing(undefined, 5)).toBe(5);
expect(defaultIfMissing(null, 5)).toBe(5);
expect(defaultIfMissing({}, 5)).toBe(5);
expect(defaultIfMissing('', 5)).toBe(5);
})
})

17 changes: 13 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"d3-selection": "^1.4.1",
"data-visualisations": "https://github.com/vulekamali/data-visualisations.git#reusable",
"html2canvas": "^1.0.0-rc.5",
"jquery": "^3.5.1",
"js": "^0.1.0",
"leaflet": "~1.3.1",
"leaflet-event-forwarder": "^0.0.3",
Expand All @@ -29,20 +30,23 @@
},
"devDependencies": {
"@babel/cli": "^7.8.3",
"@babel/core": "^7.0.0-0",
"@babel/core": "^7.11.6",
"@babel/plugin-proposal-class-properties": "^7.10.1",
"@babel/preset-env": "^7.9.6",
"@babel/preset-env": "^7.11.5",
"babel-core": "^6.26.3",
"babel-jest": "^26.3.0",
"babel-loader": "^8.0.6",
"babel-plugin-transform-regenerator": "^6.26.0",
"babel-preset-env": "^1.7.0",
"cssnano": "^4.1.10",
"jest": "^26.4.2",
"parcel": "^1.12.4",
"parcel-bundler": "^1.12.4"
},
"scripts": {
"start": "parcel ./src/index.html",
"test": "./run_test.sh",
"test": "jest",
"test:watch": "jest --watch",
"prebuild-dev": "shx rm -rf dist/*",
"build-dev": "parcel build ./src/index.html --no-minify --public-url ./",
"prebuild": "shx rm -rf dist/*",
Expand All @@ -51,5 +55,10 @@
"push-staging": "push-dir --remote=staging --dir=dist --branch=gh-pages --cleanup --verbose",
"clean-files": "cp dist/js*.js dist/wazimap-ng.js; cp dist/js*.js.map dist/wazimap-ng.js.map; cp dist/js*.css dist/wazimap-ng.css"
},
"browserslist": "> 0.25%, not dead"
"browserslist": "> 0.25%, not dead",
"jest": {
"setupFiles": [
"./setup-jest.js"
]
}
}
2 changes: 2 additions & 0 deletions setup-jest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import $ from 'jquery';
global.$ = global.jQuery = $;
5 changes: 3 additions & 2 deletions src/401.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<!-- This site was created in Webflow. http://www.webflow.com -->
<!-- Last Published: Mon Jul 20 2020 06:33:57 GMT+0000 (Coordinated Universal Time) -->
<!-- Last Published: Tue Sep 22 2020 11:38:29 GMT+0000 (Coordinated Universal Time) -->
<html data-wf-page="5ecb7ed6bb713f704f48319e" data-wf-site="5ecb7ed6bb713f2f4b48319b">
<head>
<meta charset="utf-8">
Expand Down Expand Up @@ -32,6 +32,7 @@
});
window.gtag = gtag;
</script>
<script src="https://kit.fontawesome.com/95e41092af.js" crossorigin="anonymous"></script>
</head>
<body>
<div class="utility-page-wrap">
Expand All @@ -52,7 +53,7 @@ <h2>Protected Page</h2><input type="password" autofocus="true" maxlength="256" n
</form>
</div>
</div>
<script src="https://d3e54v103j8qbb.cloudfront.net/js/jquery-3.4.1.min.220afd743d.js?site=5ecb7ed6bb713f2f4b48319b" type="text/javascript" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script src="https://d3e54v103j8qbb.cloudfront.net/js/jquery-3.5.1.min.dc5e7f18c8.js?site=5ecb7ed6bb713f2f4b48319b" type="text/javascript" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="js/webflow.js" type="text/javascript"></script>
<!-- [if lte IE 9]><script src="https://cdnjs.cloudflare.com/ajax/libs/placeholders/3.0.2/placeholders.min.js"></script><![endif] -->
</body>
Expand Down
2 changes: 1 addition & 1 deletion src/about.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<!-- This site was created in Webflow. http://www.webflow.com -->
<!-- Last Published: Fri Sep 04 2020 06:59:16 GMT+0000 (Coordinated Universal Time) -->
<!-- Last Published: Tue Sep 22 2020 11:38:29 GMT+0000 (Coordinated Universal Time) -->
<html data-wf-page="5ecf610e0e918eeee29e9d23" data-wf-site="5ecb7ed6bb713f2f4b48319b">
<head>
<meta charset="utf-8">
Expand Down
12 changes: 9 additions & 3 deletions src/css/wazimap-ng-v1.webflow.css
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3462,7 +3462,6 @@ label {
font-size: 0.85em;
font-weight: 500;
text-decoration: none;
text-transform: capitalize;
cursor: pointer;
}

Expand Down Expand Up @@ -6373,13 +6372,13 @@ label {
top: auto;
right: 0%;
bottom: 0%;
z-index: 999;
min-height: 44px;
margin-right: 50px;
margin-bottom: 10px;
border-radius: 4px;
background-color: #fff;
box-shadow: 0 0 0 -1px rgba(0, 0, 0, 0.2), 0 1px 6px -2px rgba(0, 0, 0, 0.3);
z-index: 999;
}

.mag-geo__dropdown_wrap {
Expand All @@ -6406,7 +6405,10 @@ label {
right: 0%;
bottom: 0%;
z-index: 3;
display: none;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
width: 100vw;
height: 100vh;
-webkit-box-pack: center;
Expand All @@ -6420,6 +6422,10 @@ label {
background-color: rgba(0, 0, 0, 0.5);
}

.warning-modal.hidden {
display: none;
}

.warning {
position: absolute;
display: -webkit-box;
Expand Down
Loading

0 comments on commit 12f6100

Please sign in to comment.