Skip to content

Commit

Permalink
version 1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
luizaandrade authored Apr 29, 2020
2 parents 5069c47 + f923e07 commit 66ec8e8
Show file tree
Hide file tree
Showing 16 changed files with 272 additions and 190 deletions.
125 changes: 70 additions & 55 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,56 +1,71 @@
#ietoolkit specific files
test/
########################################################################
#
# Based on DIME .gitignore template. Follow the instructions in the URL
# below to set up this template in your own repository
# https://github.com/worldbank/dime-github-trainings/tree/master/GitHub-resources/DIME-GitHub-Templates
#
# Note that if you are using GitKraken, you need to use version 5.x or more
# recent for this template to work properly
#
########################################################################

#######################
# Start by ignoring everything, and below we are explicitly saying
# what to not ignore
*

#######################
# List of files with GitHub functionality anywhere in the repo
# that we do not want to ignore

# These files include GitHub settings
!.gitignore
!.gitattributes

# Keep markdown files used for documentation on GitHub
!README.md
!CONTRIBUTING.md
!LICENSE*

#######################
# For performance reasons, if a folder is already ignored, then
# GitHub does not check the content for that folder for matches
# with additional rules. The line below includes folder in the
# top folder (but not their content), so that anything matching
# the rules below will still not be ignored.
!*/

#######################
# The following file types are code that should always be
# included no matter where in the repository folder they are
# located unless you explicitly ignore that folder

# Stata
!/**/*.do
!/**/*.ado

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

# =========================
# Operating System Files
# =========================

# OSX
# =========================

.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Folders and files that are only relevant for testing
run/
admin/
*.xls
*.xlsx
# R
!/**/*.R
!/**/*.Rmd

# LaTeX
!/**/*.tex
!/**/*.bib

# Python
!/**/*.py
!/**/*.ipynb
# Still ignore .ipynb files in checkpoint folders
.ipynb_checkpoints

# Matlab
!/**/*.m

# Markdown
!/**/*.md

# Julia
!/**/*.jl

#Ignore test folder
test/
1 change: 1 addition & 0 deletions admin/checklist-submitting-SSC.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- [ ] 4.2 - If any of the meta info (title, description, keywords, version or authour/contact) has changed then include those updates in your email.
- [ ] 5. **Draft release note** - Go to the [release notes](https://github.com/worldbank/iefieldkit/releases) and draft a new release note for the new version. Follow the format from previous releases with links to [issues](https://github.com/worldbank/iefieldkit/issues) solved.
- [ ] 6. **Wait for publication confirmation** - Do not proceed pass this step until Prof. Baum has confirmed that the new version is uploaded to the servers.
- [ ] 6.1 - Update the package from SSC and make sure it's the latest version.
- [ ] 7. **Merge version branch to *master*** - If step 2 and 3 was done correctly, then there should not be any merge conflicts in this step.
- [ ] 8. **Rebase *develop* to *master*** - This step brings edits done in 3 and 3.1, as well as version updates done in 3.2 and 3.3 into the *develop* branch. The same result can be accomplished - although by creating a slightly messier history - by merging *master* into *develop*. Regardless if the branches are merged or rebased, if any branches created of *develop* was not included in this version, make sure to rebase them to *develop* afterwards, otherwise there is a big risk for very messy conflicts in the future.
- [ ] 9. **Publish release note** - Once the new version is up on SSC, publish the release note.
Expand Down
9 changes: 7 additions & 2 deletions run/Master.do
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ qui {
Part I: Set up
*******************************************************************************/

* Set folder paths
* Set root paths
global GitHub ""
global AnalyticsDB ""

* Calculate globals
* Set up folder globals
global iefieldkit "${GitHub}/iefieldkit"
global form "${AnalyticsDB}/Data Coordinator/iefieldkit/ietestform"
global testouput "${iefieldkit}/run/output"

* Select commands to test
local ieduplicates 1
Expand All @@ -41,6 +42,10 @@ qui {
noi di as error "No commands to test"
exit
}

** Test if output folder exists, if not create it
mata : st_numscalar("r(dirExist)", direxists("${testouput}"))
if `r(dirExist)' == 0 mkdir "${testouput}"
}

/*******************************************************************************
Expand Down
39 changes: 23 additions & 16 deletions run/ieduplicates.do
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
* Add the path to your local clone of the iefieldkit repo
do "${iefieldkit}/src/ado_files/ieduplicates.ado"

local iedup_output "${testouput}/ieduplicates_output"

** Test if output folder exists, if not create it
mata : st_numscalar("r(dirExist)", direxists("`iedup_output'"))
if `r(dirExist)' == 0 mkdir "`iedup_output'"

sysuse auto, clear
encode make, gen(uuid)
Expand All @@ -20,54 +25,56 @@
*******************************************************************************/

* No duplicates
ieduplicates make using "${iefieldkit}\foo", uniquevars(make)
ieduplicates make using "`iedup_output'\foo", uniquevars(make)

* Test file format
use `duplicates', clear
ieduplicates uuid using "${iefieldkit}\foo.xlsx", uniquevars(make) force
ieduplicates uuid using "`iedup_output'\foo.xlsx", uniquevars(make) force

use `duplicates', clear
ieduplicates uuid using "${iefieldkit}\foo.xls", uniquevars(make) force
ieduplicates uuid using "`iedup_output'\foo.xls", uniquevars(make) force

* Test folder and suffix syntax
use `duplicates', clear
ieduplicates uuid, uniquevars(make) folder("${iefieldkit}") force
ieduplicates uuid, uniquevars(make) folder("`iedup_output'") force

use `duplicates', clear
ieduplicates uuid, uniquevars(make) folder("${iefieldkit}") suffix(bar) force

ieduplicates uuid, uniquevars(make) folder("`iedup_output'") suffix(bar) force

/*******************************************************************************
Yes error
*******************************************************************************/

* Observations were removed
cap ieduplicates uuid using "${iefieldkit}", uniquevars(make)
cap ieduplicates uuid using "`iedup_output'\iedupreport.xlsx", uniquevars(make)
di _rc
assert _rc == 9
* Without 'clear' option

* Without 'force' option
use `duplicates', clear
cap ieduplicates uuid using "${iefieldkit}\foo", uniquevars(make)
cap ieduplicates uuid using "`iedup_output'\foo", uniquevars(make)
di _rc
assert _rc == 198

* Invalid format
use `duplicates', clear
cap ieduplicates uuid using "${iefieldkit}\foo.csv", uniquevars(make)
cap ieduplicates uuid using "`iedup_output'\foo.csv", uniquevars(make)
assert _rc == 198

use `duplicates', clear
cap ieduplicates uuid using "${iefieldkit}\foo.", uniquevars(make) force
cap ieduplicates uuid using "`iedup_output'\foo.", uniquevars(make) force
di _rc
assert _rc == 198

* Invalid name
use `duplicates', clear
cap ieduplicates uuid using "${iefieldkit}\.xlsx", uniquevars(make)
cap ieduplicates uuid using "`iedup_output'\.xlsx", uniquevars(make)
di _rc
assert _rc == 198

*Check that cd is not working
cd "${iefieldkit}"
cd "`iedup_output'"
use `duplicates', clear
cap ieduplicates uuid using "foo", uniquevars(make) force
di _rc
assert _rc == 198


Loading

0 comments on commit 66ec8e8

Please sign in to comment.