Skip to content

Commit cfb90fd

Browse files
committed
FIX: Example did not compile due to a missing file. Project now compiles. Updated help files. Fixed ssc conflict. Updated Setup, Update, and Uninstall features. Added GetStarted message.
1 parent aa4fc1d commit cfb90fd

File tree

10 files changed

+80
-33
lines changed

10 files changed

+80
-33
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Stata module to generate a publication-quality subject disposition flow diagram
77
Use the **_flowchart_** package in Stata to generate a publication-quality **Subject Disposition Flowchart Diagram** in LaTeX Format. This package gives Stata the ability to generate the necessary TikZ code to include in a LaTeX and produce the diagram as a PDF or any other format.
88
The final diagram will be similar in style to the ones used in the PRISMA Statement, CONSORT 2010 Statement, or STROBE Statement Reporting Guidelines, which are very commonly used within formal publications for systematic review, clinical trial, or cohort study research findings.
99

10-
For an example of the package's output, please see [example1output.pdf](https://github.com/IsaacDodd/flowchart/blob/master/example1output.pdf "example1output.pdf") and the example code that produced it in [example1.do](https://github.com/IsaacDodd/flowchart/blob/master/example1.do "example1.do"). Here is a low-resolution screenshot of the PDF:
10+
For an example of the package's output, please see [example1output.pdf](https://github.com/IsaacDodd/flowchart/blob/master/example1output.pdf "example1output.pdf") and the example code that produced it in [flowchart_example1.do](https://github.com/IsaacDodd/flowchart/blob/master/flowchart_example1.do "flowchart_example1.do"). Here is a low-resolution screenshot of the PDF:
1111
![Example1Output](https://github.com/IsaacDodd/flowchart/blob/master/PreviousVersions/example1output.png "Example 1 Output")
1212

1313
The format follows closely the example of a [CONSORT-style flow diagram at TeXample](http://www.texample.net/tikz/examples/consort-flowchart/) which was written in PGF/TikZ by Morten Willert. The example code to generate the above diagram is incldued in the Ancillary Files installed with *flowchart*.
@@ -29,9 +29,9 @@ The format follows closely the example of a [CONSORT-style flow diagram at TeXam
2929

3030
## How to Use
3131

32-
After installation, type **help flowchart** for detailed instructions on how to get started. Study the files **example1.do** and **example2.do** for very carefully laid out examples of usage and a very detailed, thorough explanation of the format.
32+
After installation, type **help flowchart** for detailed instructions on how to get started. Study the files **flowchart_example1.do** and **flowchart_example2.do** for very carefully laid out examples of usage and a very detailed, thorough explanation of the format.
3333

34-
The format for the code follows this typical example, which is available in **example2.do**:
34+
The format for the code follows this typical example, which is available in **flowchart_example2.do**:
3535

3636
```stata
3737
* INITIALIZE: Start a new datatool variable file.

example1output.pdf

-1.89 KB
Binary file not shown.

example2output.pdf

-2.01 KB
Binary file not shown.

flowchart.ado

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ program define flowchart
2323
display ""
2424
display "Getting Started:"
2525
display ""
26-
display " If this is your first time running the flowchart package, type: " _newline
27-
display " . flowchart setup" _newline
26+
if("`1'" == "") {
27+
display " If this is your first time running the flowchart package, type: " _newline
28+
display " . flowchart setup" _newline
29+
}
2830
display `" To start a new flowchart, here is a general starting point: "'
2931
display ""
3032
display `" Start with the command '. flowchart init using <filename>.data'"'
@@ -50,6 +52,10 @@ program define flowchart
5052
display ""
5153
display `" The flowchart package's website is at: https://github.com/IsaacDodd/flowchart/"'
5254
display ""
55+
display "License:" _newline
56+
display " GNU LGPL 2007 - By installing this program you agree to this license, available in full here:" _newline
57+
display `" https://github.com/IsaacDodd/flowchart/blob/master/license.txt"'
58+
display ""
5359
display "Read this message again at anytime by typing 'flowchart getstarted'"
5460
}
5561
else if("`1'" == "help" | "`1'" == "help,") {
@@ -445,28 +451,39 @@ program define flowchart_setup
445451
* Install an updated version of texdoc
446452
display " (2/3) Installing/Updating 'texdoc'..."
447453
display ""
454+
* Install texdoc
448455
capture ssc install texdoc, replace
449456
if (_rc) {
450457
display as error "Setup Error: Installation of dependency 'texdoc' could not be completed. Please check your internet connection and try again."
451458
exit 499
452459
}
460+
* Install sjlatex
461+
capture net install sjlatex, from(http://www.stata-journal.com/production)
462+
if (_rc) {
463+
display as error "Setup Error: Installation of dependency 'sjlatex' for dependency 'texdoc' could not be completed. Please check your internet connection and try again."
464+
exit 499
465+
}
453466
else {
454467
display "...Texdoc installed/updated successfully."
455468
display ""
456469
}
457470
display " (3/3) Installing Ancillary Files for 'flowchart'..."
471+
display ""
458472
capture net get flowchart, from("https://raw.github.com/IsaacDodd/flowchart/master/")
459473
if (_rc) {
460474
display as error "Setup Error: Setup could not install Ancillary Files. Please connect to the internet and try again." _newline " (1) Check your current working directory to see if these ancillary files already exist. If so, there is no need to re-run setup." _newline " (2) Try running the following command:" _newline " . net get flowchart, from(https://raw.github.com/isaacdodd/flowchart/master/)" _newline " (3) You may also download these files directly from the following URL:" _newline " https://github.com/IsaacDodd/flowchart/releases"
461475
exit 499
462476
}
463477
else {
478+
display ""
464479
display "...Ancillary files installed successfully in current working directory:"
465480
pwd
466481
display ""
467482
}
468483
display "|||||| Setup Complete"
469484
display ""
485+
display "__________________________________________"
486+
display ""
470487
if(_rc == 0) {
471488
sleep 2000
472489
flowchart getstarted // Print the get started message.

flowchart.pkg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
v 3
2-
* Reference http://www.stata.com/manuals13/rnet.pdf
32
d FLOWCHART: Generates subject disposition flow diagram figures in LaTeX using PGF/TikZ to include in manuscripts
43
d
5-
d Distribution-Date: 20170801
4+
d Distribution-Date: 20170802
65
d
76
d Requires: Stata version 13 and texdoc
87
d
@@ -17,6 +16,7 @@ f flowchart_example1.do
1716
f flowchart_example2.do
1817
f manuscript.tex
1918
f methods--figure-flowchart.data
19+
f methods--figure-flowchart.tex
2020
f methods--figure-flowchart.tikz
2121
f example1output.pdf
2222
f example2output.pdf

flowchart.sthlp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ Diagram in LaTeX format, similar in style to the ones used in the CONSORT 2010 S
2020
Reporting Guidelines. An example flowchart can be found here: http://www.texample.net/tikz/examples/consort-flowchart/ {p_end}
2121

2222
{phang}
23-
To setup flowchart, type 'flowchart setup'. This will update the flowchart package and its main dependencies in
24-
your system's ado filepath and also download flowchart's ancillary files into your current working directory.
23+
After installing the package, to setup flowchart type 'flowchart setup'. This will update the flowchart
24+
package and its main dependencies in your system's ado filepath and also download flowchart's ancillary
25+
files into your current working directory.
2526
Updates to the FLOWCHART package can be installed by using the 'flowchart setup, update' command
2627
or are available here: https://github.com/IsaacDodd/flowchart/ {p_end}
2728

2829
Support is available at: https://github.com/IsaacDodd/flowchart/issues/new/
29-
Please see the Ancillary Files for extensive examples with explanations of usage. {p_end}
30+
Please see the Ancillary Files for extensive examples with explanations of usage:
31+
flowchart_example1.do, flowchart_example2.do, and manuscript.tex {p_end}
3032

3133
{marker syntax}{...}
3234
{title:Syntax}
@@ -275,8 +277,8 @@ Here is a list of known problems that can arise in using this program and their
275277
version 13 and lower and was fixed by Stata Corp. starting with Stata version 14. This
276278
occurs because Stata keeps track of which packages are installed, from where, and if
277279
you originally installed flowchart from the Boston College SSC database (i.e., through
278-
'ssc install flowchart', or did so through typing 'help flowchart', which chooses the
279-
ssc package by default), so updating flowchart through running 'flowchart setup' likely
280+
'ssc install flowchart', or did so through typing 'help flowchart', which may have chosen
281+
the ssc package by default), so updating flowchart by running 'flowchart setup' likely
280282
installed a second installation of flowchart -- in reality you only have 1 installation
281283
of flowchart but there are 2 entries in Stata's internal database of installed package.
282284

flowchart_example1.do

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,20 @@
3030
*
3131
* DEPENDENCIES:
3232
* After installing flowchart, be sure the following are in place:
33-
* 1. texdoc - STATA Command
33+
* 1. texdoc, sjlatex - STATA Packages
3434
* Installation Instructions:
35-
* In the STATA command-line, run the following 2 commands:
36-
* ssc install texdoc, replace
37-
* net install sjlatex, from(http://www.stata-journal.com/production)
38-
* 2. figure.texdoc = Ancillary File
35+
* In the STATA command-line, run the following command:
36+
* flowchart setup
37+
* This installs 2 dependencies: texdoc and its dependency, sjlatex
38+
* 2. figure-flowchart.texdoc = Ancillary File
3939
* Installation Instructions:
40-
* In the STATA command-line, run the following command:
41-
* net get flowchart, from(https://raw.github.com/IsaacDodd/flowchart/)
42-
* This will install all of the Ancillary Files to your working directory.
40+
* In the STATA command-line, when you ran the setup command, it also
41+
* installed the Ancillary Files into your present working directory.
4342
* 3. LaTeX Setup (Typesetting)
4443
* A LaTeX setup should be installed to compile .tex and .tikz files:
4544
* a) Distribution (MiKTeX or TeXLive)
4645
* Recommended: MiKTeX, then use it to install the following packages:
47-
* datatool, listings, multicols, xcolor, graphicx, tikz
46+
* datatool, listings, multicol, xcolor, graphicx, tikz
4847
* Download: https://miktex.org/download/
4948
* b) Distribution Engine
5049
* Recommended: pdfLaTeX
@@ -80,6 +79,7 @@
8079
*
8180
* /Manuscript/
8281
* |
82+
* |-- ##-[ProjectName]-[Main-Manuscript-File].tex <-- LaTeX Document
8383
* |-- ##-[ProjectName]-[Section]-Fig-[FigureName].tex <-- LaTeX Document
8484
* +-- ##-[ProjectName]-[Section]-Fig-[FigureName].tikz <-- TikZ Picture
8585
*
@@ -120,25 +120,35 @@
120120
* Do File
121121
* This is the .do file that contains your analysis where you can use
122122
* the flowchart commands to generate the diagram.
123-
* See Example: example.do
124-
* LaTeX Document
123+
* See Example: flowchart_example2.do
124+
* LaTeX Documents
125125
* This is a (.tex) file that contains a \begin{figure}...\end{figure}
126126
* Environment command. STATA does not manipulate this file. It instead
127127
* contains all of the design elements that arrange the TikZ picture
128-
* appropriately in the Manuscrupt and also loads the Subanalysis Data
128+
* appropriately in the Manuscript and also loads the Subanalysis Data
129129
* (.data) in the Data file for generating the different components of the
130130
* TikZ picture's diagram (e.g., data for the boxes of a
131131
* Subject Disposition Flowchart).
132+
* See Example: methods--figure-flowchart.tex
133+
* The manuscript's .tex file can then include this .tex file specific to
134+
* the figure directly into the manuscript file with an \input{ } command:
135+
* \input{methods--figure-flowchart.tex}
132136
* See Example: manuscript.tex
133137
* Figure Texdoc Do File - Do Not Edit
134138
* This Do file is a 'Texdoc Do File' which is to say it is invoked by the
135139
* texdoc command in STATA in the Main Analysis File that is producing the
136-
* Subanalysis Data created from your analysis using your dataset.
137-
* See Example: figure-flowchart.texdoc
140+
* Subanalysis Data created from your analysis using your dataset. There's
141+
* no need to edit this file beyond changing its filename to match your
142+
* project's naming convention.
143+
* See Example: figure-flowchart.texdoc (No Need to Edit)
138144
* TikZ Picture (Automatically regenerated)
139145
* This is a 'picture' that is used by the TikZ package in LaTeX to
140-
* generate a diagram in LaTeX.
141-
* See Example: methods--figure-flowchart.tikz
146+
* generate a diagram in LaTeX. There's no need to edit this file beyond
147+
* changing its filename to match your project's naming convention.
148+
* Instead, in your LaTeX document, use the \input{<filename.tikz>} to
149+
* make LaTeX automatically include it in the final document when
150+
* compiling.
151+
* See Example: methods--figure-flowchart.tikz (No Need to Edit)
142152
* Subanalysis Data File (Automatically regenerated)
143153
* The data for a figure is produced from a subanalysis and is assigned to
144154
* variables. The Data file consists of variables with the generated data,
@@ -148,8 +158,10 @@
148158
* the subanalysis. The variables with data produced by the subanalysis
149159
* have to have a unique name and are given a name in the do file that
150160
* produces the figure. Data from the Dataset used in an analysis can be
151-
* used to generate the data for the diagram.
152-
* See Example: methods--figure-flowchart.data
161+
* used to generate the data for the diagram. There's no need to edit the
162+
* file beyond changing its filename to match your project's naming
163+
* convention.
164+
* See Example: methods--figure-flowchart.data (No Need to Edit)
153165
*
154166
* OVERALL:
155167
*

manuscript.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
% \renewcommand{\rmdefault}{ppl} % Font Changes - PPL = Palatino
77
% Layout Management
88
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
9-
\usepackage{multicols}
9+
\usepackage{multicol}
1010
% Design
1111
\usepackage{xcolor} % Design - Custom Colors
1212
\usepackage{graphicx} % Design - Graphics Packages
@@ -38,7 +38,7 @@
3838
% %% Methods
3939
% \input{04-ProjectName-Methods.tex}
4040
\end{multicols} % Temporarily interrupt multicols (and later restart it) to accommodate a figure.
41-
\input{Methods--Figure-Flowchart.tex}
41+
\input{methods--figure-flowchart.tex}
4242
\begin{multicols}{2}
4343
% %% Results
4444
% \input{05-ProjectName-Results.tex}

methods--figure-flowchart.tex

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
%% Flowchart Based on the CONSORT 2010 Statement Guidelines
2+
% Adapted from Citation: Willert, Morten Vejs. (2010 July). A CONSORT-style flowchart of a randomized controlled trial, using the PGF/TikZ package. Retrieved from http://www.texample.net/media/tikz/examples/TEX/consort-flowchart.tex on July 23, 2017. License: Creative Commons attribution license.
3+
% Datatool Implementation - Based on example code from - Citation: P., Michael. (2016 Aug 3.). How to read a Variable from a file in LATEX?. Tex.stackexchange.com. Retrieved from https://tex.stackexchange.com/a/322198/138871 on July 23, 2017.
4+
\begin{figure}
5+
\begin{center}
6+
%% Load Subanalysis Data for Figure into \figvalue{} commands
7+
\DTLloaddb[noheader, keys={subanakey,subanavalue}]{subanalysis-flowchart}{"methods--figure-flowchart.data"}
8+
\newcommand{\figvalue}[1]{\DTLfetch{subanalysis-flowchart}{subanakey}{#1}{subanavalue}}
9+
% Style - Setting the typeface to sans serif and the font size to small
10+
% (the scope of this style is local to the environment)
11+
\sffamily
12+
\footnotesize
13+
\input{methods--figure-flowchart.tikz}
14+
\caption{Flowchart of the analytic sample of survey subjects data.} \label{fig:StudyFlowchart}
15+
\end{center}
16+
\end{figure}

stata.toc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ d
99
d {bf:Installation}
1010
d Type {bf: net install flowchart, from(https://raw.github.com/IsaacDodd/flowchart/issues/new/) }
1111
d {bf:Dependencies}
12-
d {bf:texdoc} - Install this by typing '. ssc install texdoc, replace' after installing flowchart.
12+
d {bf:texdoc} - Install this by typing 'flowchart setup' after installing flowchart.
1313
d The texdoc package (written by Ben Jann) is a dependency for the flowchart package which writes LaTeX-formatted files.
1414
d
1515
d {bf:License}

0 commit comments

Comments
 (0)