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

Open 1685 supplier vax #1225

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 26 additions & 0 deletions bin/filter/filter_suppliervax.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env python
"filter for contract-data.csv and verification-data.csv"

import csv
import sys

REMOVE_COLUMNS = [
'record_created',
'record_modified',
'user_modified',
]

def main():
reader = csv.DictReader(sys.stdin)
outnames = [f for f in reader.fieldnames if f not in REMOVE_COLUMNS]
writer = csv.DictWriter(sys.stdout, outnames)
writer.writeheader()
for row in reader:
try:
for rem in REMOVE_COLUMNS:
del row[rem]
writer.writerow(row)
except ValueError:
pass

main()
35 changes: 33 additions & 2 deletions bin/pd/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
targets := ati briefingt qpnotes contracts contractsa dac experiment grants hospitalityq inventory \
nap reclassification service travela travelq wrongdoing
nap reclassification service travela travelq wrongdoing suppliervax
csv_files := \
ati.csv ati-nil.csv \
briefingt.csv \
Expand All @@ -17,7 +17,8 @@ csv_files := \
service.csv service-std.csv \
travela.csv \
travelq.csv travelq-nil.csv \
wrongdoing.csv
wrongdoing.csv \
contract-data.csv verification-data.csv
fdir := $(PD_FILTER_SCRIPT_DIRECTORY)
paster := $(REGISTRY_PASTER_COMMAND)
registry_python := $(REGISTRY_PYTHON_COMMAND)
Expand Down Expand Up @@ -636,5 +637,35 @@ $(workdir)/wrongdoing.csv:
$(workdir)/filtered/wrongdoing.csv: $(workdir)/wrongdoing.csv
$(fdir)/filter_wrongdoing.py < $< > $@

###
### Supplier Vaccination
###
.PHONY: suppliervax
suppliervax: upload-suppliervax rebuild-suppliervax

.PHONY: upload-suppliervax
upload-suppliervax: $(workdir)/filtered/contract-data.csv #$(workdir)/filtered/verification-data.csv
@echo Uploading Supplier Vaccination...
@$(ckanapi) action resource_patch -c $(registry_ini) \
id=5334e05b-5c48-4cba-b5e3-cf755ef43dd3 upload@"$(workdir)/filtered/contract-data.csv" \
> /dev/null
# @$(ckanapi) action resource_patch -c $(registry_ini) \
# id=0d10f492-fcc3-467e-bd22-98492226569e upload@"$(workdir)/filtered/verification-data.csv" \
# > /dev/null

.PHONY: rebuild-suppliervax
rebuild-suppliervax: $(workdir)/filtered/contracts.csv #$(workdir)/filtered/contracts-nil.csv
# no search for suppliervax

$(workdir)/contract-data.csv:
$(paster) $(combine) contract-data -d $(workdir) -c $(registry_ini)

#$(workdir)/verification-data.csv:
# $(paster) $(combine) verification-data -d $(workdir) -c $(registry_ini)

$(workdir)/filtered/contract-data.csv: $(workdir)/contract-data.csv
$(fdir)/filter_suppliervax.py < $< > $@
#$(workdir)/filtered/verification-data.csv: $(workdir)/verification-data.csv
# $(fdir)/filter_suppliervax.py < $< > $@

endif
4 changes: 4 additions & 0 deletions ckanext/canada/internal/static/internal.css
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,10 @@ ul#brf-pkg { padding-left: 0; }
#mn-pd { border-left: solid 6px #44a; }
#pd i { color: #44a; }

#ql-suppliervax { border-left: solid 3px #7e0c33; border-top: solid 1px #ddd; }
#ql-suppliervax i { color: #7e0c33; margin-right: 10px; }
#mn-suppliervax { border-left: solid 6px #7e0c33; }

.label.dataset-private { display: none; }

#quick-links .fa-question-circle-o {
Expand Down
2 changes: 2 additions & 0 deletions ckanext/canada/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ def update_config(self, config):
ckanext.canada:tables/dac.yaml
ckanext.canada:tables/nap.yaml
ckanext.canada:tables/experiment.yaml
ckanext.canada:tables/suppliervax.yaml
"""
config['ckan.search.show_all_types'] = True
config['search.facets.limit'] = 200 # because org list
Expand All @@ -322,6 +323,7 @@ def update_config(self, config):
ckanext.canada:schemas/info.yaml
ckanext.canada:schemas/prop.yaml
"""
config['scheming.organization_schemas'] = 'ckanext.canada:schemas/organization.yaml'

# Enable our custom DCAT profile.
config['ckanext.dcat.rdf.profile'] = 'canada_dcat'
Expand Down
Loading