Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cpims ovc api #60

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2eb5e03
modify: cpara-form
bmugwe Apr 27, 2022
66a2df5
cpara-validation
bmugwe Apr 28, 2022
d44014c
x
bmugwe Apr 28, 2022
0a34ea0
Added all necessary files
ertush Apr 29, 2022
94de030
Added all files
ertush Apr 29, 2022
2059261
latest working commit : delete for past cpara working
ertush Apr 30, 2022
7e884dd
Latest working commit with migrations working
ertush May 1, 2022
c8fc791
saved sub population questions
ertush May 1, 2022
ba46934
Latest working commit
ertush May 4, 2022
055776c
Latest working commit
ertush May 4, 2022
412d529
Latest working changes
ertush May 4, 2022
032ac3e
latest working commit
ertush May 5, 2022
bb61e51
latest working commit
ertush May 5, 2022
2e1ba52
latest working commit
ertush May 5, 2022
6574382
Latest working commit
ertush May 5, 2022
b604be0
latest working changes
ertush May 6, 2022
cea6a75
Latest working commit with ovcsubpopulation save
ertush May 7, 2022
5dea75b
Cpara version 2 latest update
ertush May 7, 2022
1541702
Latest working commit; pending fetch of ovc sub-population data
ertush May 7, 2022
45f2b75
Latest working commit; pending fetch of ovc sub-population data
ertush May 7, 2022
a922abf
RegOrgUnit GET/POST
ian-njuguna11 Aug 25, 2022
17eb7a3
all suggested api endpoints
ian-njuguna11 Aug 26, 2022
0623efe
cpims_api
ian-njuguna11 Aug 29, 2022
97a5224
drf auth token security
ian-njuguna11 Aug 29, 2022
1f06b73
All registry complete
ian-njuguna11 Aug 30, 2022
da57c8c
cpovc_forms complete
ian-njuguna11 Sep 1, 2022
fcb16df
endpoints testing
ian-njuguna11 Sep 1, 2022
f142f3c
all cpovc_forms
ian-njuguna11 Sep 5, 2022
48f5857
all main endpoints
ian-njuguna11 Sep 7, 2022
b64f2d9
api docs & schema
moturiphil Sep 14, 2022
e8b464e
api docs
moturiphil Sep 14, 2022
7384160
finalizing api service
ian-njuguna11 Sep 23, 2022
6085d53
finalizing api service
ian-njuguna11 Sep 23, 2022
0546cdd
finalizing api service
ian-njuguna11 Sep 23, 2022
eb08f4d
disable_simple_jwt_to_access_end_points
ian-njuguna11 Mar 22, 2023
c0195b1
token_based_auth
ian-njuguna11 Mar 23, 2023
41297c3
random_int_for_dash
ian-njuguna11 Mar 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions cpims/settings.py
Original file line number Diff line number Diff line change
@@ -16,10 +16,10 @@
ALLOWED_HOSTS = ['*']

cpims_db_host = os.environ.get('CPIMS_HOST') if os.environ.get('CPIMS_HOST') else '127.0.0.1'
cpims_db_pass = os.environ.get('CPIMS_PASSWORD') if os.environ.get('CPIMS_PASSWORD') else 'Xaen!ee8'
cpims_db_instance = os.environ.get('CPIMS_DB') if os.environ.get('CPIMS_DB') else 'cpims_upgrade'
cpims_db_pass = os.environ.get('CPIMS_PASSWORD') if os.environ.get('CPIMS_PASSWORD') else 'userpassword'
cpims_db_instance = os.environ.get('CPIMS_DB') if os.environ.get('CPIMS_DB') else 'cpims'
cpims_db_port = os.environ.get('CPIMS_PORT') if os.environ.get('CPIMS_PORT') else '5432'
cpims_db_user = os.environ.get('CPIMS_DBUSER') if os.environ.get('CPIMS_DBUSER') else 'cpimsdbuser'
cpims_db_user = os.environ.get('CPIMS_DBUSER') if os.environ.get('CPIMS_DBUSER') else 'username'
cpims_debug = eval(os.environ.get('CPIMS_DEBUG')) if os.environ.get('CPIMS_DEBUG') else False

DEBUG = cpims_debug
@@ -115,9 +115,9 @@
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'cpims',
'USER': 'username',
'PASSWORD': '123456ab',
'NAME': cpims_db_instance,
'USER': cpims_db_user,
'PASSWORD': cpims_db_pass,
'HOST': 'localhost',
'PORT': '5432', },
'reporting': {
2 changes: 1 addition & 1 deletion cpovc_forms/models.py
Original file line number Diff line number Diff line change
@@ -1440,7 +1440,7 @@ class OVCCareCpara_upgrade(models.Model):
domain = models.CharField(max_length=50)
event = models.ForeignKey(OVCCareEvents, on_delete=models.CASCADE)
date_of_event = models.DateField()
date_of_previous_event =models.DateField(null=True, blank=True)
date_of_previous_event = models.DateField(null=True, blank=True)
timestamp_created = models.DateTimeField(default=timezone.now)
is_void = models.BooleanField(default=False)
timestamp_updated = models.DateTimeField(auto_now=True)
65 changes: 60 additions & 5 deletions static/js/cpara-validate-benchmark.js
Original file line number Diff line number Diff line change
@@ -2,9 +2,9 @@


// Healthy Goal 1 >> Benchmark 1
validBench(['cphealth1', 'cphealth2', 'cphealth3', 'cphealth4', 'cphealth5'], ['AYES','AYES','AYES','AYES','AYES'], 'cp1b');
validBench(['cphealth1', 'cphealth2', 'cphealth3', 'cphealth4', 'cphealth5'], ['AYES,ANNO','AYES,ANNO','AYES','AYES','AYES'], 'cp1b');
// Healthy Goal 2 >> Benchmark 2
validBench(['cphealth6','cphealth7','cphealth8','cphealth9','cphealth10','cphealth11','cphealth12','cphealth13','cphealth14'], ['AYES','AYES','AYES','AYES','AYES','AYES','AYES','AYES','AYES'], 'cp2b');
validBench(['cphealth6','cphealth7','cphealth8','cphealth9','cphealth10','cphealth11','cphealth12','cphealth13','cphealth14'], ['AYES,ANNO','AYES,ANNO','AYES','AYES','AYES','AYES','AYES','AYES','AYES'], 'cp2b');
// Healthy Goal 3 >> Benchmark 3
validBench(['cphealth18','cphealth19','cphealth20'],['AYES','AYES','AYES'],'cp3b')
// Healthy Goal 4 >> Benchmark 4
@@ -25,6 +25,11 @@ validDate('cp2d','cp1d','AYES','ANNO');
// validDate('cp2q','cp1q','ANNO','AYES');
validDate('children_rsk_hiv_assess_date','cp1q','ANNO','AYES');






var benchmarkScore = 0;
$('input[name=cp74q],input[name=cp75q],input[name=cp76q],input[name=cp77q],input[name=cp78q],input[name=cp79q]').attr('readonly', true);

@@ -210,6 +215,9 @@ $('input[type=radio]').change(function (e) {
$('input[name=p79q]').val(healthScore+stableScore+safeScore+schoolScore); //Total Score
$('input[name=bench_array]').val(JSON.stringify(bench_array));
console.log('benchmark_score => '+JSON.stringify(bench_array));

changeQnOnCondition('cphealth6', 'AYES', 'cphealth7', false)
changeQnOnCondition('cphealth6', 'ANNO', 'cphealth7', true)


});
@@ -289,13 +297,39 @@ function validBench(arrayOfInputsToCheck, arrayOfExpectedValues, idOfBenchmarkQn
$('input').change(function () {
markBenchmark(idOfBenchmarkQn, false);
var proceed = 0;
let thisValArr = [];

$.each(arrayOfInputsToCheck, function (inx, inpt) {
var thisval = $('input[name='+inpt+']:checked').val();
if(thisval == arrayOfExpectedValues[inx]){
proceed += 1;
return proceed
thisValArr.push(thisval)

if(arrayOfExpectedValues[inx].split(',').length > 1){
if(thisval == arrayOfExpectedValues[inx].split(',')[0] || thisval == arrayOfExpectedValues[inx].split(',')[1]){

if(inpt == 'cphealth2' && thisval === 'ANNO' && thisValArr[inx-1] === 'ANNO') { // Custom validation for q 1.1 & 1.2
thisValArr = []
return proceed

}

// condition =

// if(condition) { // Custom validation for q 2.1 & 2.2
// return proceed

// }

proceed += 1;
return proceed
}
}
else {
if(thisval == arrayOfExpectedValues[inx]){
proceed += 1;
return proceed
}
}

});

if(proceed == arrayOfInputsToCheck.length){
@@ -306,6 +340,27 @@ function validBench(arrayOfInputsToCheck, arrayOfExpectedValues, idOfBenchmarkQn
})
}


function changeQnOnCondition(q1, expectedVal, q2, tostate){

var thisval = $('input[name='+q1+']:checked').val();
if(thisval === expectedVal) { // Custom validation for q 2.1 & 2.2
if(tostate){
$('input[name='+q2+']').removeAttr('disabled');
$('input[name='+q2+'][value=ANNO]').prop("checked", false);
// $('input[name='+q2+']').attr('disabled', true);
}
else {
$('input[name='+q2+']').removeAttr('disabled');
$('input[name='+q2+'][value=ANNO]').prop("checked", true);
$('input[name='+q2+']').attr('disabled', true);
}

// markBenchmark(q2, tostate)
}

}

function markBenchmark(benchmarkId, passOrFail) {
console.log('marking benchmark' +benchmarkId)
if(passOrFail){
10 changes: 5 additions & 5 deletions templates/forms/new_cpara_upgrade.html
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ <h1 class="page-header">Forms <small>New Case Plan Achievement Readiness Assessm
<h4 class="panel-title"> Case Plan Achievement Readiness Assessment || {{care_giver}}</h4>
</div>
<div class="panel-body">
<form class="form-horizontal form-bordered form-control" action="." method="POST" data-parsley-validate="false" name="form-wizard-hhva" id="new_hhva" novalidate>
<form class="form-horizontal form-bordered form-control" style="border: 0px" action="." method="POST" data-parsley-validate="false" name="form-wizard-hhva" id="new_hhva" novalidate>
{% csrf_token %}
<div class="row">
<div class="col-md-12">
@@ -114,18 +114,18 @@ <h4 class="panel-title"> Case Plan Achievement Readiness Assessment || {{care_gi
<div class="wizard-step-1">
<div class="panel-body">
<div class="row">
<div class="col-md-6">
<div class="col-md-12">
<div class="form-group">
<label class="control-label formlabel">Date of Assessment:</label><br/>
<input type="text" class="form-control" name="d_o_a">
<input type="text" class="form-control display-flex flex-direction-row flex-grow" name="d_o_a">
</div>
</div>
</div>
<hr/>
<div class="panel-body">
{#<form action="." method="post" name="ovcreg_form" id="ovcreg_form" data-parsley-validate="true">#}
{#{% csrf_token %}#}
<div style="overflow-x: auto; min-height: 300px;">
<div style="overflow-x: auto; display: flex; flex-direction: row; flex: auto;">
<input type="hidden" name="ovc_id" id="ovc_id" value="{{ creg.person_id }}">
<table width="100%" class="table table-profile">
<tbody>
@@ -194,7 +194,7 @@ <h4 class="panel-title"> Case Plan Achievement Readiness Assessment || {{care_gi
<hr/>
<div class="col-md-12">
<h4>Details of all children below 18 years currently living in the household.</h4>
<div class="alert alert-info">
<div class="alert alert-info ">
<strong>Note:</strong><br/>
<p>Includes any other aged above 18 years if still in school</p>
</div>