forked from caravancoop/sfm
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #825 from security-force-monitor/hcg/mm-import
Remove redundant import steps for easier debugging
- Loading branch information
Showing
14 changed files
with
2,395 additions
and
1,789 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Variables for the archive data | ||
COUNTRY_NAMES=$(shell perl -pe "s/,/ /g" import_docket.csv | cut -d' ' -f5) | ||
ENTITIES=units.csv persons.csv incidents.csv locations.csv locations.geojson sources.csv | ||
|
||
clean_archive : | ||
rm -rf $(DATA_ARCHIVE_PATH)/* | ||
|
||
.PHONY : $(DATA_ARCHIVE_PATH) data_archive wwic_download.zip directories \ | ||
data/wwic_download/metadata/sfm_research_handbook.pdf clean_archive | ||
|
||
# Create the data archive and upload it to S3 | ||
data_archive : wwic_download.zip | ||
aws s3 cp $< s3://$(shell cat configs/s3_config.json | jq -r '.data_archive_bucket')/ | ||
rm $< | ||
|
||
wwic_download.zip : filtered_data data/wwic_download/metadata/sfm_research_handbook.pdf | ||
cd data/wwic_download && zip -r ../../$@ . | ||
|
||
filtered_data: directories $(SOURCE_DATA_PATH) $(foreach country,$(COUNTRY_NAMES),$(patsubst %,$(country)_%,$(ENTITIES))) | ||
echo "filtered csvs for entities" | ||
|
||
directories : | ||
mkdir -p $(foreach country,$(COUNTRY_NAMES),$(DATA_ARCHIVE_PATH)/$(country)) | ||
|
||
define filter_entity_data | ||
$(shell csvgrep --columns $(1):status:admin --match 3 $< | \ | ||
python data/processors/blank_columns.py --entity $(1) > $(DATA_ARCHIVE_PATH)/$*/$@) | ||
endef | ||
|
||
%_units.csv : $(SOURCE_DATA_PATH)/%/units.csv | ||
$(call filter_entity_data,unit) | ||
|
||
%_persons.csv : $(SOURCE_DATA_PATH)/%/persons.csv | ||
$(call filter_entity_data,person) | ||
|
||
%_incidents.csv : $(SOURCE_DATA_PATH)/%/incidents.csv | ||
$(call filter_entity_data,incident) | ||
|
||
%_sources.csv : $(SOURCE_DATA_PATH)/%/sources.csv | ||
cp $< $(DATA_ARCHIVE_PATH)/$*/$@ | ||
|
||
%_locations.csv : $(SOURCE_DATA_PATH)/%/locations.csv | ||
cp $< $(DATA_ARCHIVE_PATH)/$*/$@ | ||
|
||
%_locations.geojson : $(SOURCE_DATA_PATH)/%/locations.geojson | ||
cp $< $(DATA_ARCHIVE_PATH)/$*/$@ | ||
|
||
data/wwic_download/metadata/sfm_research_handbook.pdf : | ||
curl -o $@ https://help.securityforcemonitor.org/_/downloads/en/latest/pdf/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,2 @@ | ||
source_document_id,location_document_id,entitity_document_id,sfm:iso,sfm:country_name | ||
1dkGS6Ocyc2YYQ5IopEdjz38t9kaT34XfIAab0iteGoY,1ztOfGaQT3WDrq-BOjT0x5VErzgrWQ0Ku,1Ck11zLFVP6iJZFAR0_Xsq0UaeEJrmFl7ysbFX9mGu7c,ae,united-arab-emirates | ||
1dkGS6Ocyc2YYQ5IopEdjz38t9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z38t9kaT34XfIAab0iteGoY,1syUOihIFKzk6QsLXd7XNUZIwzZZfAqEH,1UcgoJ_ytS-WSWl2_5OuV9h92wSCBWRFBoDtr4Ztqt14,ml,mali | ||
1dkGS6Ocyc2YYQ5IopEdjz38t9kaT34XfIAab0iteGoY,1dU24WM8MAnqApFcBoYCiKPzPevebal6_,1vwb7ENaOeVRJIc5iCDBbF8K0Oql4SscENmLEdUT77Hg,mm,myanmar | ||
1dkGS6Ocyc2YYQ5IopEdjz38t9kaT34XfIAab0iteGoY,17Zqej6mrCT3BBBKcKj7949qHyRCa-9SJ,1cUtCEUuZRMqcxlRqFyoEM9eAdiDdWy2DUocroYivCx4,mr,mauritania | ||
1dkGS6Ocyc2YYQ5IopEdjz38t9kaT34XfIAab0iteGoY,1nVWV5_1kGDwyWJ3PPqExKfchs3sAlEuh,168KuHwUr9565zWaQVZ5au3qtGOb-qyJx_WOwNzqt_Eo,mx,mexico | ||
1dkGS6Ocyc2YYQ5IopEdjz38t9kaT34XfIAab0iteGoY,1qlHquI9EDz2lteBcjz_MheNLspg3mp_q,1_Pj5BryFXUPQPmMigII8G2HBUrpsnkK5V-Zu_9LCdGw,ne,niger | ||
1dkGS6Ocyc2YYQ5IopEdjz38t9kaT34XfIAab0iteGoY,1boFMPurqyxbfYBvfisRiROmzr8TuPI8j,1f3W3qJATCzVjZGw239Wy3D25THs8ThnvoC24aUFaGZQ,ng,nigeria | ||
1dkGS6Ocyc2YYQ5IopEdjz38t9kaT34XfIAab0iteGoY,1nMXXtFwJ3TqeynpKSW11uYAzihSMV8So,1Uc5eZswLB6mrwQLhd_OYQm7v7ThH99N0eb7RbTtD5iY,np,nepal | ||
1dkGS6Ocyc2YYQ5IopEdjz38t9kaT34XfIAab0iteGoY,19o8a1zwxUEYFxvZkqs2AwCyIm0oe_CPF,1h1a0S5aVv9Z3wucgKsYXmg5Z_CWzsKfjJSfJFcXxPSY,ph,philippines | ||
1dkGS6Ocyc2YYQ5IopEdjz38t9kaT34XfI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uFuzNr2lVLwfD7hknTbX8E-Dw,12O-PyMp4CN7O8ZdnZpCNm8Rs3lzLfMvo,1uVz_9edm0ejSGOHCRV2BWZoPPKOX64XpBORjm47hopU,mm,myanmar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.