Skip to content

Commit

Permalink
Merge branch 'v0.22.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
fredkingham committed Sep 5, 2022
2 parents a15cebb + 9dd1a98 commit bf74fcc
Show file tree
Hide file tree
Showing 18 changed files with 120 additions and 76 deletions.
18 changes: 0 additions & 18 deletions .appveyor.yml

This file was deleted.

78 changes: 78 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
on: [pull_request]
name: CI
jobs:
# run python/js tests, coveralls and lint
integration-test:
name: python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
services:
postgres:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ci_db_test
ports:
- 5432:5432
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
python-version:
- 3.6
- 3.7
- 3.8
- 3.9
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up ruby for coveralls
uses: actions/setup-ruby@v1
- name: Set up js
uses: actions/setup-node@v1
- name: Install js dependencies
run: npm install [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]
- name: Install opal
run: pip install -e .
- name: Install dependencies
run: pip install -r test-requirements.txt
- run: gem install coveralls-lcov
- name: run tests
run: opal test --coverage
- name: flake8
run: flake8
- name: combine coveralls
run: find coverage -name "lcov.info" -exec coveralls-lcov -v -n {} \; > coverage/coverage.json
- run: coveralls --merge=coverage/coverage.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}"
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
# make sure the python side of things works on windows
other-os-tests:
name: ${{ matrix.os }} python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- windows-latest
python-version:
- 3.9
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install opal
run: pip install -e .
- name: Install dependencies
run: pip install -r test-requirements.txt
- name: run tests
run: opal test py
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Opal
====

[![Build Status](https://travis-ci.org/openhealthcare/opal.svg?branch=v0.11.0)](https://travis-ci.org/openhealthcare/opal)
![Build](https://github.com/openhealthcare/opal/workflows/.github/workflows/build.yml/badge.svg)

[![Coverage Status](https://coveralls.io/repos/github/openhealthcare/opal/badge.svg?branch=v0.11.0)](https://coveralls.io/github/openhealthcare/opal?branch=v0.11.0)
[![PyPI version](https://badge.fury.io/py/opal.svg)](https://badge.fury.io/py/opal)

[![PyPI version](https://badge.fury.io/py/opal.svg)](https://badge.fury.io/py/opal)

Opal is a full stack web framework that makes building digital tools for health care easy.

Expand Down
8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
### 0.22.2 (Minor Release)

#### The future filter now accepts strings

The filter `future` now accepts a string as outputted by the Opal date serialization
e.g. 27/12/2022.


### 0.22.1 (Minor Release)

#### Exclude many to one relationships from the advanced search
Expand Down
2 changes: 1 addition & 1 deletion doc/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ dev_addr: 0.0.0.0:8965
include_next_prev: false

extra:
version: v0.22.1
version: v0.22.2

markdown_extensions:
- fenced_code
2 changes: 1 addition & 1 deletion opal/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
Declare our current version string
"""
__version__ = '0.22.1'
__version__ = '0.22.2'
5 changes: 3 additions & 2 deletions opal/core/search/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import logging
import os
import tempfile
import zipfile

from django.template import loader
from django.core.serializers.json import DjangoJSONEncoder
Expand Down Expand Up @@ -84,7 +83,9 @@ def get_field_names_to_render(self):

# We should have id, patient_id, episode_id in every subrecord
# CSV, if these fields are present, make them appear first.
id_fields = [f for f in ["id", "patient_id", "episode_id"] if f in result]
id_fields = [
f for f in ["id", "patient_id", "episode_id"] if f in result
]

for f in id_fields:
result.remove(f)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
//
// This is the main PatientSummary class for OPAL.
//
angular.module('opal.services').factory('PatientSummary', function(UserProfile) {
angular.module('opal.services').factory('PatientSummary', function() {
var PatientSummary = function(jsonResponse){
var startYear, endYear;
var self = this;

if(jsonResponse.start_date){
startYear= moment(jsonResponse.start_date, 'DD/MM/YYYY').format("YYYY");
Expand All @@ -28,9 +27,6 @@ angular.module('opal.services').factory('PatientSummary', function(UserProfile)
this.categories = jsonResponse.categories.join(", ");
this.link = "/#/patient/" + jsonResponse.patient_id;
this.hospitalNumber = jsonResponse.hospital_number;
UserProfile.load().then(function(user_profile){
self.canViewPatientNotes = _.contains(user_profile.roles.default, "micro_haem");
})
};

return PatientSummary;
Expand Down
1 change: 0 additions & 1 deletion opal/core/search/static/js/test/extract.controller.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ describe('ExtractCtrl', function(){
{categories: []}
]
});
$httpBackend.expectGET('/api/v0.1/userprofile/').respond({roles: {default: []}});
$scope.criteria[0] = {
combine : "and",
column : "symptoms",
Expand Down
1 change: 0 additions & 1 deletion opal/core/search/static/js/test/search.controller.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ describe('SearchCtrl', function (){
$httpBackend.expectGET('/search/simple/?query=jane').respond(
{object_list: [{categories: []}]}
);
$httpBackend.expectGET('/api/v0.1/userprofile/').respond({roles: {default: []}});
expect($scope.query.searchTerm.length).toBe(0);
$scope.query.autocompleteSearchTerm = 'jane';
expect($scope.getQueryParam()).toEqual('jane');
Expand Down
7 changes: 5 additions & 2 deletions opal/core/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

from opal.utils import write

TRAVIS = os.environ.get('TRAVIS', False)
# We're using the GITHUB_WORKFLOW env variable
# to determine that we are running in a github action.
# GITHUB_WORKFLOW is set in the env by github.
GITHUB_ACTION = os.environ.get('GITHUB_WORKFLOW', False)


def _has_file(where, filename):
Expand Down Expand Up @@ -84,7 +87,7 @@ def _run_js_tests(args):
# to a string
env["OPAL_LOCATION"] = str(args.opal_location)

if TRAVIS:
if GITHUB_ACTION:
karma = './node_modules/karma/bin/karma'
else:
karma = 'karma'
Expand Down
4 changes: 2 additions & 2 deletions opal/static/js/opal/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ filters.filter('daysSince', function(daysToFilter){
});


filters.filter('future', function(){
filters.filter('future', function(toMomentFilter){
return function(i, includeToday){
if(!i){
return false;
}
var today = new moment();
var input = moment(i);
var input = toMomentFilter(i);

if(includeToday && input.isSame(today, "day")){
return true;
Expand Down
4 changes: 4 additions & 0 deletions opal/static/js/test/filters.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@ describe('filters', function() {
expect(futureFilter(tomorrow)).toBe(true);
});

it('should work for strings that look like dates', function(){
expect(futureFilter('27/12/5000')).toBe(true);
});

it('should return true if today if we include today', function(){
expect(futureFilter(new Date(), true)).toBe(true);
});
Expand Down
4 changes: 2 additions & 2 deletions opal/tests/js_config/karma_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ module.exports = function(includedFiles, baseDir, coverageFiles){
}
];

if(process.env.TRAVIS){
browsers = ["Firefox"];
if(process.env.GITHUB_WORKFLOW){
browsers = ["FirefoxHeadless"];
plugins.push("karma-firefox-launcher");
plugins.push("karma-coveralls");
if(useCoverage){
Expand Down
13 changes: 7 additions & 6 deletions opal/tests/test_core_test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from opal.core import test_runner


class RunPyTestsTestCase(OpalTestCase):

@patch('subprocess.check_call')
Expand Down Expand Up @@ -148,10 +149,10 @@ def test_run_tests_for_unknown_config(self, sysexit, writer, has_file):
class RunJSTestsTestCase(OpalTestCase):

def setUp(self):
self.TRAVIS = test_runner.TRAVIS
self.GITHUB_ACTION = test_runner.GITHUB_ACTION

def tearDown(self):
test_runner.TRAVIS = self.TRAVIS
test_runner.GITHUB_ACTION = self.GITHUB_ACTION

@patch('subprocess.check_call')
def test_run_tests(self, check_call):
Expand All @@ -160,21 +161,21 @@ def test_run_tests(self, check_call):
mock_args.coverage = False
mock_args.test = None
mock_args.failfast = False
test_runner.TRAVIS = False
test_runner.GITHUB_ACTION = False
test_runner._run_js_tests(mock_args)
self.assertEqual(
['karma', 'start', 'config/karma.conf.js', '--single-run'],
check_call.call_args[0][0]
)

@patch('subprocess.check_call')
def test_run_tests_travis(self, check_call):
def test_run_tests_github(self, check_call):
mock_args = MagicMock(name="args")
mock_args.userland_here = ffs.Path('.')
mock_args.coverage = False
mock_args.test = None
mock_args.failfast = False
test_runner.TRAVIS = True
test_runner.GITHUB_ACTION = True
test_runner._run_js_tests(mock_args)
self.assertEqual(
[
Expand All @@ -198,7 +199,7 @@ def test_run_tests_failfast(self, check_call):
mock_args.coverage = False
mock_args.test = None
mock_args.failfast = True
test_runner.TRAVIS = False
test_runner.GITHUB_ACTION = False
test_runner._run_js_tests(mock_args)
self.assertEqual(
[
Expand Down
6 changes: 3 additions & 3 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@
}
)

if 'TRAVIS' in os.environ:
if os.environ.get('GITHUB_WORKFLOW') and not os.environ.get('RUNNER_OS') == 'Windows':
test_settings_config["DATABASES"] = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'travis_ci_test',
'NAME': 'ci_db_test',
'USER': 'postgres',
'PASSWORD': '',
'PASSWORD': 'postgres',
'HOST': 'localhost',
}
}
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
]
},
install_requires=[
# We pin kombu because kombu 5.3 imports does not work on python 3.6.9
'kombu==5.1.0',
'ffs>=0.0.8.2',
'Jinja2==2.10.1',
'django==2.2.16',
Expand Down

0 comments on commit bf74fcc

Please sign in to comment.